def __init__(self, name, parent, description=None, cultivar=None, phenology=None, hardiness=None, ecodormancy_threshold=None, acclimation_rate=None, deacclimation_rate=None, stage_thresholds=None, theta=None): ConfigObject.__init__(self, name, parent) self.__dict__['proper_name'] = description if description is not None: self.set(description=description) if phenology is not None: self.set(phenology=Phenology(self, cultivar, phenology)) if ecodormancy_threshold is not None: self.set(ecodormancy_threshold=ecodormancy_threshold) if hardiness is not None: self.set(hardiness=hardiness) if acclimation_rate is not None: self.set(acclimation_rate=acclimation_rate) if deacclimation_rate is not None: self.set(deacclimation_rate=deacclimation_rate) if stage_thresholds is not None: self.set(stage_thresholds=stage_thresholds) if theta is not None: self.set(theta=theta)
def _initDataProcessors_(self, **kwargs): # special processing rules for datasets self.processors = ConfigObject('processors', None) # humidity data input processor def processRhum(data): rhum = N.around(data, 2) rhum[N.where(rhum > 100)] = 100. rhum[N.where(rhum < 0)] = 0. return rhum self.processors.RHUM = processRhum # temperature data input processor def processTemp(data): return N.around(data, 2) self.processors.DPT = processTemp self.processors.TMP = processTemp # precip data input processor def processPcpn(data): data[N.where(data < 0.01)] = 0. return N.around(data, 2) self.processors.PCPN = processPcpn processors = kwargs.get('processors', None) if processors is not None: if isinstance(processors, dict): for key, function in processors.items(): self.processors[key] = function elif isinstance(processors, (tuple, dict)): for key, function in processors: self.processors[key] = function else: errmsg = '"processors" kwarg must be dict, tuple or list : NOT ' TypeError, errmsg + str(type(processors))
def _preInitProject_(self, registry=None, **kwargs): if registry is None: from atmosci.utils.config import ConfigObject self.registry = ConfigObject('registry', None) else: self.registry = registry.copy() self._dataset_names = [] self._datasets_ = {} self._unpackers = {}
def _initNdfdFactory_(self, config_object, **kwargs): self.ndfd = config_object.sources.ndfd self.grib_size_tolerance = self.ndfd.grib.size_tolerance timezone = kwargs.get('local_timezone', self.project.local_timezone) self.setLocalTimezone(timezone) if not hasattr(self, 'AccessRegistrars'): self.AccessRegistrars = ConfigObject('AccessRegistrars', None) # static file reader must be registered on init because code in # StaticFileAccessorMethods doesn't support just-in-time registration _registerStaticFileReader(self)
def __init__(self, name, parent=None, phenology=None, kill_temps=None, kill_levels=None, stage_name_map=None, min_chill_units=None, description=None): ConfigObject.__init__(self, name, parent) if phenology is not None: self.set(phenology=Phenology(self, phenology)) if kill_temps is not None: self.set(kill_temps=OrderedDict(kill_temps)) if kill_levels is not None: self.set(kill_levels=kill_levels) if stage_name_map is not None: self.set(stage_name_map=OrderedDict(stage_name_map)) if min_chill_units is not None: self.set(min_chill_units=min_chill_units) if description is not None: self.set(description=description)
'download': { 'attempts': 3, 'wait_times': (15, 30, 40) }, 'fcast_days': 6, 'local_timezone': 'US/Eastern', 'obs_days': 30, 'shared_grib_dir': True, 'shared_grid_dir': True, 'source_priority': ('urma', 'rtma'), 'tag': 'reanalysis', 'target_hour': 7, }) # add reanalysis as a source REANALYSIS = ConfigObject('reanalysis', None) REANALYSIS.source_priority = ('rtma', 'urma') # higher index = higher priority REANALYSIS.tag = 'Reanalysis' REANALYSIS.grib = { 'bbox': { 'conus': '-125.25,23.749,-65.791,50.208', 'NE': '-83.125,36.75,-66.455,48.075' }, 'bbox_offset': { 'lat': 0.375, 'lon': 0.375 }, 'data_chunks': 1024000, 'dimensions': { 'conus': {
import os, sys import numpy as N from scipy import stats as scipy_stats try: nanmedian = N.nanmedian except: nanmedian = scipy_stats.nanmedian from atmosci.utils.config import ConfigObject from atmosci.utils.timeutils import asAcisQueryDate # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # REGBASE = ConfigObject('registry', None) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # dataset function registry # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # FUNCBASE = ConfigObject('functions', REGBASE) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # dataset creators # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ConfigObject('creators', FUNCBASE) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # provenance generators # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ConfigObject('generators', FUNCBASE)
def _initFileManagerClasses_(self): # create a dictionary for registration of file access classes if not hasattr(self, 'AccessClasses'): self.AccessClasses = ConfigObject('AccessClasses', None) # register the factory-specific accessors self._registerAccessClasses()
from collections import OrderedDict from datetime import datetime from atmosci.utils.config import ConfigObject # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # PROVENANCE_RECORD_TYPE = ( ('obs_date', '|S10'), ('processed', '|S20'), ) GDD_PROVENANCE_STATS = (('min', '<i2'), ('max', '<i2'), ('avg', '<i2')) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # APPLE = ConfigObject('apple', None, 'animation.start') APPLE.end_day = (6, 30) APPLE.start_day = (9, 1) APPLE.gdd_thresholds = ((43, 86), ) APPLE.gdd_provenance_empty = ('', '', -32768, -32768, -32768) APPLE.gdd_provenance_type = PROVENANCE_RECORD_TYPE + GDD_PROVENANCE_STATS APPLE.animation.start.chill = (9, 15) APPLE.animation.start.gdd = (2, 1) APPLE.animation.start.stage = (2, 1) APPLE.animation.start.kill = (2, 1) from frost.apple.chill.config import CHILL APPLE.addChild(CHILL)
import os, sys from atmosci.utils.config import ConfigObject # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ATMOSCFG = ConfigObject('atmosci', None) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # directory paths # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - default = { 'data': '/data2/web-app-data', 'shared': '/data2/weather-data/shared', 'static': '/data2/weather-data/shared/grid/static', 'weather': '/data2/weather-data/shared', 'working': '/data2/web-app-data' } # SET THE CONFIGURED dirpath TO THE default DIRECTORY PATHS ATMOSCFG.dirpaths = default # only set the following configuration parameter when multiple apps are # using the same data source file - set it in each application's config # file - NEVER set it in the default (global) config file. # CONFIG.dirpaths.source = CONFIG.dirpaths.shared # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # MODES ALLOW FOR DIFFERENT DIRECTORY PATHS FOR DIFFERENT PURPOSES ATMOSCFG.modes = { 'default': {
# Copyright (c) 2007-2018 Rick Moore and Cornell University Atmospheric # Sciences # All Rights Reserved # Principal Author : Rick Moore # # ndfd is part of atmosci - Scientific Software for Atmosphic Science # # see copyright.txt file in this directory for details import numpy as N from atmosci.utils.config import ConfigObject # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # PROVENANCE = ConfigObject('provenance', None, 'generators', 'types') #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # provenance record generator for pcpn/pop #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - def pcpnpopProvenanceGenerator(fcast_time, timestamp, pcpn, pop, source): return (fcast_time.strftime('%Y%m%d:%H'), N.nanmin(pcpn), N.nanmax(pcpn), N.nanmedian(pcpn, axis=None), N.nanmin(pop), N.nanmax(pop), N.nanmedian(pop, axis=None), timestamp, source) PROVENANCE.generators.pcpnpop = pcpnpopProvenanceGenerator #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # provenance record type definition for pcpn/pop
# Sciences # All Rights Reserved # Principal Author : Rick Moore # # ndfd is part of atmosci - Scientific Software for Atmosphic Science # # see copyright.txt file in this directory for details import numpy as N from atmosci.utils import tzutils from atmosci.utils.config import ConfigObject # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # PROVENANCE = ConfigObject('provenance', None, 'generators', 'types', 'views') #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # provenance record generators #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - def timeAccumStatsProvenanceGenerator(source, hour, timestamp, hourly, accumulated): return (tzutils.hourAsString(hour), N.nanmin(hourly), N.nanmax(hourly), N.nanmean(hourly), N.nanmedian(hourly, axis=None), N.nanmin(accumulated), N.nanmax(accumulated), N.nanmean(accumulated), N.nanmedian(accumulated, axis=None), timestamp, source) PROVENANCE.generators.timeaccum = timeAccumStatsProvenanceGenerator
# import mode-dependent defaults ATMOSCFG.modes.copy('modes', COMMON) CFGBASE.link(COMMON.modes) del ATMOSCFG # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # provenance dataset configurations # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - from atmosci.seasonal.prov_config import PROVENANCE CFGBASE.link(PROVENANCE) COMMON.link(PROVENANCE) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # default project configuration # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ConfigObject('project', COMMON) COMMON.project.bbox = { 'NE': COMMON.regions.NE.data, 'conus': COMMON.regions.conus.data } COMMON.project.compression = 'gzip' COMMON.project.dst_glitch = (3, 10) COMMON.project.forecast = 'ndfd' COMMON.project.region = 'conus' COMMON.project.source = 'acis' COMMON.project.shared_forecast = True COMMON.project.shared_source = True COMMON.project.subproject_by_region = True COMMON.project.copy('project', CFGBASE) CFGBASE.project.end_day = (12, 31)
# NOTE: NOT necessarily the same day as the current day in USA # NOTE: UTC time lags 4 to 5 hours behind US/Eastern depending # Standard Time or Daylight Savings Time # e.g. 4:00 US/Eastern is 23:00 UTC on the previous day # in winter and Midnight UTC the same day in summer. # NOTE: URMA lags about 6 hours behind current UTC time # %(utc_hour)s = UTC hour as 2 digit int str) # NOTE: NOT the same hour as the current hour in USA # NOTE: UTC lags 4 or 5 hours behind in US Eastern time zone # NOTE: URMA lags about 6 hours behind current UTC time # # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # hourly files from NDGD via NWS # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RTMA_SOURCES = ConfigObject('rtma', None) RTMA_SOURCES.nws = { # lag_hours = number of hours that data availability lags behind # current UTC/GMT time # num_days = number of days avaiable from this site 'ftp': { 'lag_hours': 1, 'num_days': 1, 'timeunit': 'hour', 'subdir': 'AR.%(region)s/RT.%(utc_hour)s', 'url': 'ftp://tgftp.nws.noaa.gov/SL.us008001/ST.opnl/DF.gr2/DC.ndgd/GT.rtma',
'tag':'URMA', } ) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # URMA DATA SOURCES # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # # Daily files from NWS and NDGD # # subdir templates need : # %(region)s = NWS URMA region str # %(utc_hour)s = UTC hour as 2 digit int str) # NOTE: NOT necessarily the same as the current day in USA # NOTE: GMT lags ~7 hours behind in US Eastern time zone # URMA_SOURCES = ConfigObject('urma',None) URMA_SOURCES.nws = { # interval = time interval between files 'interval':1, # lag_hours = number of hours that file availability lags # behind current UTC time # num_days = number of days avaiable from this site 'ftp':{ 'lag_hours':7, 'num_days':1, 'timeunit':'hour', 'subdir':'AR.%(region)s/RT.%(utc_hour)s', 'url':'ftp://tgftp.nws.noaa.gov/SL.us008001/ST.opnl/DF.gr2/DC.ndgd/GT.urma', }, 'http':{ 'lag_hours':7, 'num_days':1, 'timeunit':'hour', 'subdir':'AR.%(region)s/RT.%(utc_hour)s', 'url':'http://tgftp.nws.noaa.gov/SL.us008001/ST.opnl/DF.gr2/DC.ndgd/GT.urma', }, 'num_days':2,
import os from atmosci.utils.config import ConfigObject # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # MAP_CONFIG = ConfigObject('maps', None, 'groups') # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # MAP_CONFIG.animate_command = '/opt/local/bin/convert -delay %d %s -loop 0 %s' MAP_CONFIG.subdirs = { 'anim': ('%(region)s', '%(year)s', 'animations'), 'map': ('%(region)s', '%(year)s', 'maps'), 'thumb': ('%(region)s', '%(year)s', 'thumbs'), } MAP_CONFIG.thumbnail_shape = (125, 125) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # config for map generation # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MAP_CONFIG.default = { 'map_options': { 'map_type': 'risk', 'area': 'northeast', 'area_template': 'NortheastEmpty_template.png', 'cbarfontweight': 'bold', 'cbarlabelsize': 8, # cbar @ [left, bottom, width, height] 'cbarsettings': [0.13, 0.08, .76, 0.04],
CFGBASE.dirpaths = { 'shared': 'C:\\Work\\app_data\\shared', 'static': 'C:\\Work\\app_data\\shared\\static', 'working': 'C:\\Work\\app_data' } else: CFGBASE.dirpaths = { 'shared': '/Volumes/data/app_data/shared', 'static': '/Volumes/data/app_data/shared/static', 'working': '/Volumes/data/app_data' } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # regional coordinate bounding boxes for data and maps # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ConfigObject('regions', CFGBASE) CFGBASE.regions.conus = { 'description': 'Continental United States', 'data': '-125.00001,23.99999,-66.04165,49.95834', 'maps': '-125.,24.,-66.25,50.' } CFGBASE.regions.NE = { 'description': 'NOAA Northeast Region (U.S.)', 'data': '-82.75,37.125,-66.83,47.70', 'maps': '-82.70,37.20,-66.90,47.60' } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # default project configuration # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ConfigObject('project', CFGBASE)
from collections import OrderedDict import json from atmosci.utils.config import ConfigObject # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # kills 10%, 50%, 90% of buds at temp KILL_TEMPS = ( (-25,-25,-25), (11,5,0), (19,10,4), (22,17,11), (25,21,18), (27,26,24), (28,26,25), (29,27.1,26.6) ) # stage data dictionary keys STAGES = ('dormant','stip','gtip','ghalf','cluster','pink','bloom','petalfall') # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # APPLES = ConfigObject('apples', None) APPLES.stages = copy(STAGES) APPLES.kill_temps = OrderedDict(zip(STAGES, KILL_TEMPS)) del KILL_TEMPS # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - APPLES.varieties = { 'empire':{ 'description':'Empire Apple', 'min_chill_units':1100, 'phenology':OrderedDict(zip(STAGES,(0,91,107,170,224,288,384,492))) }, 'mac_geneva':{ 'description':'Macintosh Apple', 'min_chill_units':1100,
def _registerAccessClasses(self): if not hasattr(self, 'AccessClasses'): self.AccessClasses = ConfigObject('AccessClasses', None) if not hasattr(self, 'AccessRegistrars'): self.AccessRegistrars = ConfigObject('AccessRegistrars', None)
('gtip', 'Green Tip'), ('ghalf', '1/2 inch Green'), ('cluster', 'Tight Cluster'), ('pink', 'Pink Bud'), ('bloom', 'Bloom'), ('petalfall', 'Petal Fall'), ('fruit', 'Fruit Set')) APPLE_STAGES = tuple([stage[0] for stage in APPLE_STAGE_NAMES]) APPLE_STAGE_LABELS = ('Dormant', 'Silver\nTip', 'Green\nTip', '1/2"\nGreen', 'Tight\nCluster', 'Pink Bud', 'Bloom', 'Petal\nFall') PROVENANCE_EMPTY_BASE = ('', '') PROVENANCE_FORMATS_BASE = ['|S10', '|S20'] PROVENANCE_NAMES_BASE = ['obs_date', 'processed'] # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # VARIETY = ConfigObject('variety', None) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # provenance record configuration # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ConfigObject('provenance', VARIETY, 'empty', 'formats', 'names') # KILL empty = [-32768 for n in range(len(APPLE_KILL_PROBS) + 1)] empty.insert(0, '') # obs date empty.append('') # processed date VARIETY.provenance.empty.kill = tuple(empty) # one additional format for no kill (not in APPLE_KILL_PROBS) formats = ['<i8' for prob in range(len(APPLE_KILL_PROBS) + 1)] formats.insert(0, '|S10') # obs date formats.append('|S20') # processed time
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # PROVENANCE_RECORD_TYPE = ( ('obs_date', '|S10'), ('processed', '|S20'), ) PROVENANCE_STATS = (('daily min', '<i2'), ('daily max', '<i2'), ('daily avg', '<i2'), ('accum min', '<i2'), ('accum max', '<i2'), ('accum avg', '<i2')) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # CHILL options configuration # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # CHILL = ConfigObject('chill', None, 'carolina.accumulators', 'dynamic.accumulators', 'threshold.accumulators', 'utah.accumulators') CHILL.models = ('carolina', 'utah') # config.chill.listChildren() # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # provenance record configuration # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CHILL.provenance_empty = ('', '', -32768, -32768, -32768, -32768, -32768, -32768) CHILL.provenance_type = PROVENANCE_RECORD_TYPE + PROVENANCE_STATS # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # CHILL model acummulators # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
import numpy as N from atmosci.utils.config import ConfigObject # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # TOOLCFG = ConfigObject('tool', None, 'dirpaths', 'filenames') TOOLCFG.dirpaths = { 'root': { 'dev': '/Volumes/Transport/data/app_data', 'tool': '/Volumes/data/app_data' }, 'data': { 'frost': 'frost/grid/%(year)d/%(subdir)s', 'shared': 'shared/grid/%(region)s/%(source)s/%(subdir)s', 'tool': 'frapple/build/%(region)s/%(source)s/%(subdir)s' }, } TOOLCFG.filenames = { 'frost': { 'chill': '%(year)d-Frost-Apple-Chill.h5', 'tempext': '%(year)d_temperatures.h5', 'variety': '%(year)d-Frost-Apple-%(variety)s.h5', }, 'shared': { 'tempext': '%(year)d-%(source)s-%(region)s-Daily.h5', }, 'tool': { 'chill': '%(year)d-Frost-Apple-Chill.h5',
if '.' in filetype_key: filetype, other_key = filetype_key.split('.') return self[filetype][other_key] else: return self.filetypes[filetype_key] # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # CONFIG = ToolConfigObject('config', None) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # mode-specific configurations # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CONFIG.build = ConfigObject('build', CONFIG) CONFIG.build.dirpaths = { 'tooldata': '/Volumes/data/app_data/gddtool', 'project': '/Volumes/data/app_data/gdd', 'shared': '/Volumes/data/app_data/shared', 'static': '/Volumes/data/app_data/shared/grid/static', 'working': '/Volumes/data/app_data' } CONFIG.prod = ConfigObject('prod', CONFIG) CONFIG.prod.dirpaths = { 'project': '/app_data/gdd', 'resources': '/opt/tool_pkg/gddtool/resources', 'shared': '/app_data/shared', 'static': '/app_data/shared/static', 'tooldata': '/app_data/gddtool',
('break', '#FFD700'), ('leaf1', '#90EE90'), ('leaf2', '#3CB371'), ('leaf4', '#008000'), ('fruit', '#9932CC')) GRAPE_STAGE_NAMES = (('dormant', 'Dormant'), ('woolly', 'Wooly Bud'), ('break', 'Bud Break'), ('leaf1', '1st Leaf'), ('leaf2', '2nd Leaf'), ('leaf4', '4th Leaf'), ('fruit', 'Fruit Set')) GRAPE_KILL_LEVELS = (('(diff >= 0) & (diff <= 0.5)', 'Low', '#1E90FF'), ('(diff > 0.5) & (diff < 2)', 'Medium', '#FFD700'), ('diff >= 2', 'High', '#FF0000')) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # GRAPE = ConfigObject('grape', None, 'chill', 'datasets', 'descriptons', 'dormancy', 'groups', 'packers', 'unpackers', 'variety') GRAPE.end_day = (5, 15) GRAPE.start_day = (9, 15) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # chill group configuration # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - def chillThresholdString(group_name, variety): if group_name == 'common': return ('threshold', 10.) elif group_name == 'dormancy': endo = variety.stage_thresholds.endo eco = variety.stage_thresholds.eco thresholds = 'endodormancy=%-4.2f, ecodormancy=%-4.2f' % (endo, eco) return 'thresholds', thresholds
import os, sys import numpy as N from scipy import stats as SS from atmosci.utils.config import ConfigObject, OrderedConfigObject from atmosci.utils.timeutils import asAcisQueryDate # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # CONFIG = ConfigObject('config', None, 'crops', 'packers', 'unpackers') CONFIG.animate_cmd_path = '/opt/ImageMagick/bin/convert' # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PROVENANCE = ConfigObject('provenance', CONFIG, 'empty', 'formats', 'generators', 'names') if 'win32' in sys.platform: CONFIG.webapps_dir = 'C:\\Work\\Frost\\web_apps\\frost' CONFIG.working_dir = 'C:\\Work\\Frost\\app_data\\frost' else: CONFIG.webapps_dir = '/Volumes/data/web_apps/frost' CONFIG.working_dir = '/Volumes/data/app_data/frost' # global defaults DEFAULT = ConfigObject('default', CONFIG, 'bbox', 'grid', 'missing', 'source') CONFIG.default.bbox.data = "-82.75,37.125,-66.83,47.70" CONFIG.default.bbox.maps = "-82.70,37.20,-66.90,47.60" CONFIG.default.bbox.test = "-72.5,41.5,-71.5,42.5" CONFIG.default.compression = 'gzip' CONFIG.default.end_day = (6, 30)
import os from atmosci.utils.config import ConfigObject, ConfigMap # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # SERVER_DIRPATH = os.path.split(os.path.abspath(__file__))[0] PKG_DIRPATH = SERVER_DIRPATH[:SERVER_DIRPATH.rfind(os.sep)] RESOURCE_PATH = os.path.join(SERVER_DIRPATH, 'resources') # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # CONFIG = ConfigObject('config', None) # tool name - used in request/response uri CONFIG.tool = { 'toolname': 'csftool', } CONFIG.demo = ConfigObject('demo', CONFIG) CONFIG.demo.csftool_url = 'http://tools.climatesmartfarming.org/csftool' CONFIG.demo.server_address = 'http://tools.climatesmartfarming.org' CONFIG.demo.server_port = 20003 CONFIG.demo.server_url = 'http://tools.climatesmartfarming.org' CONFIG.dev = CONFIG.demo.copy("dev") CONFIG.dev.csftool_url = 'http://localhost:8081/csftool' CONFIG.dev.server_address = 'http://localhost' CONFIG.dev.server_port = 8081 CONFIG.dev.server_url = 'http://localhost:8081' CONFIG.prod = CONFIG.demo.copy("prod")
import numpy as N from atmosci.utils.config import ConfigObject # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # from turf.config import CONFIG as CFGBASE CONFIG = CFGBASE.copy('config', None) del CFGBASE # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # COMMON = ConfigObject('common', None) COMMON.project = { 'fcast_days': 6, # number of days in file for forecast risk 'obs_days': 7, # number of days in file for observed risk # a day begins at 8AM and ends at 7AM the next day 'target_hour': 7, 'diseases': ('anthrac', 'bpatch', 'dspot', 'pblight'), } CONFIG.merge(COMMON.project) CONFIG.datasets.risk = { 'description': '%(threat)s risk level', 'dtype': int, 'dtype_packed': '<i2', 'compression': 'gzip', 'chunks': ('num_days', 1, 1), 'missing_data': -999, 'missing_packed': -999, 'period': 'date',