def __init__(self, options, **kwargs):
        self.config = ConfigObject('config', None)

        if isinstance(options, dict): opt_dict = options
        else: opt_dict = optionsAsDict(options)

        for key, value in opt_dict.items():
            if not key.startswith('_') and value is not None:
                self.config[key] = opt_dict[key]

        for key, value in kwargs.items():
            if not key.startswith('_') and value is not None:
                self.config[key] = kwargs[key]
        if 'pkg_path' not in self.config: self.config['pkg_path'] = PKG_DIRPATH

        config_keys = self.config.keys()

        if 'working_dir' not in config_keys:
            self.config['working_dir'] = WORKING_DIR

        if 'ManagerClass' not in config_keys:
            self.config.newChild('ManagerClass')
            self.config.ManagerClass.hdf5 = HDF5DataFileManager
            self.config.ManagerClass.index = HDF5DataFileManager
            self.config.ManagerClass.stats = HDF5DataFileManager
            self.config.ManagerClass.statistics = HDF5DataFileManager
            self.config.ManagerClass.hour = ObsnetDataFileManager
            self.config.ManagerClass.hours = ObsnetDataFileManager
            self.config.ManagerClass.day = ObsnetDataFileManager
            self.config.ManagerClass.days = ObsnetDataFileManager

        if 'station_filename_tmpl' not in config_keys:
            self.config['station_filename_tmpl'] = '%d_%s.h5'

        if 'station_index_file' not in config_keys:
            index_filepath = os.path.join(self.config.working_dir,
                                          'station_index.h5')
            self.config['station_index'] = index_filepath
        if 'debug' not in config_keys:
            self.config.debug = False
        self.debug = self.config.debug
Beispiel #2
0
import numpy as N

from rccpy.utils.config import ConfigObject

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

PRECIP_ELEMENTS = ('pcpn', )
TEMPERATURE_ELEMENTS = ('dewpt', 'dewpt_depr', 'srad', 'st4i', 'st8i', 'temp')

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

elements = ConfigObject('elements', None)

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# elements contains configuration parameters that MUST be set for each element
#
# description : detailed description of element
# raw_type : used to specify how the dat is stored in the data files - expressed
#            as a tuple (dtype, data units, missing value, frequency, interval)
#            frequency : observation frequency (time span e.g.'hour','day',etc.)
#            interval : number of time spans per data value
# serial_type : used to specify output data transforms for extracting data from
#               hdf5 files via getSerialData() of HDF5DataFileManager an it's
#               subclasses : expressed as tuple (dtype, units, missing values)
# tsvar_type : used for extracting data using UCAN interface:
#              expressed as tuple (dtype, missing, units, tsv name, tsv units)
#              generated data elements do not have tsvar_type
# units : used expressed as tuple (hdf5 type, hdf5 units, script type, script units)
# value_type : used to convey character and limits of observed data values
#              expressed as tuple (data character, min reasonable value,
Beispiel #3
0
#    validation.email.header.missing
#    validation.email.header.missing[bcc, cc, mail_to, sender, signature, subject]
#    validation.email.header.summary
#    validation.email.header.summary[bcc, cc, mail_to, sender, signature, subject]
#    validation.email.header.test
#    validation.email.header.test[bcc, cc, mail_to, sender, signature, subject]
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# initialize validation configuration
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

validation = ConfigObject('validation', None)
validation.constraints = (('network', '!=', 'icao'), ('active', '=', 'Y'))
validation.search_criteria = (('network', '!=', 'icao'), )

# station.(activate or deactivate or missing).(html or text)
activate = ConfigObject('activate', None, 'html', 'text')
deactivate = ConfigObject('deactivate', None, 'html', 'text')
missing = ConfigObject('missing', None, 'html', 'text')
station = ConfigObject('station', None, activate, deactivate, missing)
del activate, deactivate, missing

# summary.(activate or deactivate or missing)
summary = ConfigObject('summary', None, 'activate', 'deactivate', 'missing')

# content.(station or summary)
content = ConfigObject('content', None, station, summary)
Beispiel #4
0
#    sensors.email.header.error[bcc, cc, mail_to, sender, signature, subject]
#    sensors.email.header.summary
#    sensors.email.header.summary[bcc, cc, mail_to, sender, signature, subject]
#    sensors.email.header.test
#    sensors.email.header.test[bcc, cc, mail_to, sender, signature, subject]
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# initialize sensor error detection configuration
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

sensors = ConfigObject('sensors', None, 'email.header', 'email.content',
                       'email.content.error.html', 'email.content.error.text',
                       'email.content.summary.detail', 'pcpn')

# some attributes coomon to all sensors
sensors.constraints = (('network', '!=', 'icao'), ('active', '=', 'Y'))
sensors.end_hour = 7
sensors.grid_offset = 0.0625  # 5 x 5 grid, 20 km**2
sensors.search_criteria = (('network', '!=', 'icao'), )
sensors.start_hour = 8
sensors.station_metadata =\
        'sid,name,ucanid,active,network,lat,lon,first_hour,last_report'

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# precip specific attributes
#
from rccpy.utils.config import ConfigObject

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# initialize validation configuration
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

validation = ConfigObject('validation',None)
validation.constraints = (('network','!=','icao'),('active','=','Y'))
validation.search_criteria = (('network','!=','icao'),)

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# initialize limits for data extremes
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

extremes = ConfigObject('extremes',None)
extremes.stddevs = {
    'invalid' : {'daily_pcpn':10,'dewpt':7,'dewpt_depr':7,'lwet':7,'pcpn':10,
                 'rhum':7,'srad':7,'st4i':7,'st8i':7,'temp':7,'wdir':7,'wspd':7},
    'suspect' : {'daily_pcpn':7,'dewpt':4,'dewpt_depr':4,'lwet':4,'pcpn':7,
                 'rhum':4,'srad':4,'st4i':4,'st8i':4,'temp':4,'wdir':4,'wspd':4},
    }

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# initialize sequence filters and limits
#
import numpy as N

from rccpy.utils.config import ConfigObject

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

PRECIP_ELEMENTS = ('pcpn', )
TEMPERATURE_ELEMENTS = ('dewpt', 'dewpt_depr', 'srad', 'st4i', 'st8i', 'temp')

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

datasets = ConfigObject('datasets', None)

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# datasets contains configuration parameters that MUST be set for each dataset
#
# description : detailed description of dataset
# raw_type : used to specify how the dat is stored in the data files - expressed
#            as a tuple (dtype, data units, missing value, frequency, interval)
#            frequency : observation frequency (time span e.g.'hour','day',etc.)
#            interval : number of time spans per data value
# serial_type : used to specify output data transforms for extracting data from
#               hdf5 files via getSerialData() of HDF5DataFileManager an it's
#               subclasses : expressed as tuple (dtype, units, missing values)
# tsvar_type : used for extracting data using UCAN interface:
#              expressed as tuple (dtype, missing, units, tsv name, tsv units)
#              generated data datasets do not have tsvar_type
# units : used expressed as tuple (hdf5 type, hdf5 units, script type, script units)
# value_type : used to convey character and limits of observed data values
#              expressed as tuple (data character, min reasonable value,
Beispiel #7
0
from rccpy.utils.config import ConfigObject

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

DEFAULT_DATASETS = ('lwet','pcpn','rhum','srad','st4i','st8i','temp','wdir','wspd')
DEFAULT_METADATA = ('network','state','id','name','lon','lat','elev') 

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

networks = ConfigObject('networks',None)

networks.cu_log = { 'metadata' : DEFAULT_METADATA,
                    'elements' : DEFAULT_DATASETS,
                  }
networks.icao = { 'metadata' : DEFAULT_METADATA,
                  'elements' : ('pcpn','rhum','temp','wdir','wspd'),
                }
networks.newa = { 'metadata' : DEFAULT_METADATA,
                  'elements' : DEFAULT_DATASETS,
                }

networks.newa.coordinators = { 'CT' : { 'contact' : 'Mary Concklin',
                                        'email'   : '*****@*****.**' },
                               'MA' : { 'contact' : 'Jon Clements ',
                                        'email'   : '*****@*****.**' },
                               'PA' : { 'contact' : 'Rob Crassweller ',
                                        'email'   : '*****@*****.**' },
                               'NY' : { 'contact' : 'Juliet Carroll ',
                                        'email'   : '*****@*****.**' },
                               'VT' : { 'contact' : 'Terry Bradshaw ',
Beispiel #8
0
from rccpy.utils.config import ConfigObject

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# initialize configuration of services
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

services = ConfigObject('services', None, 'web', 'email')

services.web.acis = 'http://data.rcc-acis.org/'
services.web.newa = 'http://newa.nrcc.cornell.edu/newaUtil/'
#services.email.smtp_host = 'virga.nrcc.cornell.edu'
services.email.smtp_host = 'appsmtp.mail.cornell.edu'