Esempio n. 1
0
    def _init_logging(self, debug, verbose):
        """Initialize the logging instance.

        As this is called from __init__, and this class isn't intended to be
        run as is as the main method, we don't call getAppLogger here.
        """
        if debug:
            self.loglevel = "DEBUG"
        elif verbose:
            self.loglevel = "INFO"
        # else use class default

        #  Set the log level for the module itself, as this class "runs the
        #  show" for the whole deploy_map module.
        module_logger = getModuleLogger(__name__)
        module_logger.setLevel(self.loglevel)

        # Set the log level for this particular class instance. Note that the
        # result of fullname(self) isn't under the same log hierarchy as
        # __name__
        self.logger = getLogger(fullname(self))
        self.logger.setLevel(self.loglevel)

        self.logger.notify("Logging intialized for %s", __name__)
Esempio n. 2
0
)

# TODO: use anf.stateFile or whatever it ends up being called.
from .error import Poc2MongoAuthError, Poc2MongoConfigError, Poc2MongoError
from .util import (
    MAX_EXTRACT_ERRORS,
    ConfigurationError,
    OrbConnectError,
    OrbRejectException,
    OrbSelectException,
    Poc,
    TooManyExtractError,
    stateFile,
)

logger = getModuleLogger(__name__)

MongoDbConfig = namedtuple(
    "MongoDbConfig",
    ["user", "host_and_port", "password", "namespace", "collection"])


class Poc2MongoApp:
    """Application instance for poc2mongo."""
    def __init__(self, argv=None):
        """Initialize object, read config."""
        # Read configuration from command-line
        usage = "Usage: %prog [options]"

        parser = OptionParser(usage=usage)
        parser.add_option(
Esempio n. 3
0
"""The anf.deploymentmap module."""

import argparse
import collections
from pprint import pformat
import string

from anf.logutil import fullname, getLogger, getModuleLogger

from . import constant, database, gmtplotter, util
from .. import gmt
from ..gmt import region

LOGGER = getModuleLogger(__name__)

DEFAULT_PARAMS = {
    "symsize": constant.DEFAULT_SYMSIZE,
    "use_color": constant.DEFAULT_USE_COLOR,
    "log_level": constant.DEFAULT_LOG_LEVEL,
}
"""These items may be overriden by read_pf."""

MapFilenames = collections.namedtuple(
    "MapFilenames",
    [
        "intermediate_file_prefix",
        "intermediate_file_suffix",
        "final_file_prefix",
        "final_file_suffix",
    ],
)
Esempio n. 4
0
"""Wrapper around Generic Mapping Tools for deployment map making."""

import os
import tempfile

from anf import logutil

from . import util
from ..gmt import GmtXYStationFileInfo, command

LOGGER = logutil.getModuleLogger(__name__)


class GmtDeployMapPlotter:
    """Plot a deployment map for a given start_time and end_time."""

    deployment_types = {}

    def __init__(
        self,
        map_type,
        deployment_type,
        start_time,
        end_time,
        station_metadata_objects,
        config,
        file_prefix: str,
        file_suffix: str,
    ):
        """Initialize a deployment map plotter for a particular time period.