from optparse import OptionParser
parser = OptionParser()

parser.add_option('-v', action='store_true', dest='verbose', default=False)
parser.add_option('-z', action='store_true', dest='debug', default=False)

options, args = parser.parse_args()

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

debug = options.debug
verbose = options.verbose or debug

target_year = datetime.date.today().year

factory = GDDAppProjectFactory()
project = factory.getProjectConfig()

source_key = args[0]
if source_key is None: source_key = project.source
source = factory.getSourceConfig(source_key)
if verbose:
    print 'the source config is :\n', source
    print ' '

region = args[1]
if region is None: region = project.region
if len(region) == 2: region = region.upper()

# get a a source file reader for the target year
reader = factory.getSourceFileReader(source, target_year, region, 'temps')
Exemplo n.º 2
0
                  action='store_true',
                  dest='set_valid_date',
                  default=False)
parser.add_option('-z', action='store_true', dest='debug', default=False)

options, args = parser.parse_args()

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

current_year = datetime.date.today().year

set_fcast_date = options.set_fcast_date
set_obs_date = options.set_obs_date
set_valid_date = options.set_valid_date

factory = GDDAppProjectFactory()

filetype = args[0]

source_key = args[1]
source = factory.getSourceConfig(source_key)

region = args[2]
if len(region) == 2: region = region.upper()

year = int(args[3])
month = int(args[4])
day = int(args[5])
valid_date = datetime.date(year, month, day).strftime('%Y-%m-%d')

if filetype in ('src', 'source'):
parser = OptionParser()

parser.add_option('-r', action='store', dest='region', default=None)
parser.add_option('-s', action='store', dest='source', default=None)
parser.add_option('-v', action='store_true', dest='verbose', default=False)
parser.add_option('-z', action='store_true', dest='debug', default=False)

options, args = parser.parse_args()

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

debug = options.debug
source = options.source
verbose = options.verbose

factory = GDDAppProjectFactory()

coverage = args[0]  # 'daily' or 'accumulated'
gdd_threshold = args[1]  # string version of GDD threshold

# get time spans from config file
if len(args) > 2: target_year = int(args[2])
else: target_year = datetime.date.today().year
days_in_history = daysInYear(target_year)

project = factory.getProjectConfig()
if verbose: print '\nproject :\n', project

region_key = options.region
if region_key is None: region_key = project.region
if len(region_key) == 2: region_key = region_key.upper()
parser.add_option('-s', action='store', dest='source', default=None)
parser.add_option('-v', action='store_true', dest='verbose', default=False)
parser.add_option('-x', action='store_true', dest='replace', default=False)
parser.add_option('-z', action='store_true', dest='debug', default=False)

options, args = parser.parse_args()

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

debug = options.debug
source = options.source
verbose = options.verbose

year = args[0]

factory = GDDAppProjectFactory()
project = factory.getProjectConfig()
if verbose:
    print '\nproject :\n', project

region = options.region
if region is None: region = project.region.name
if len(region) == 2: region = region.upper()
if verbose:
    print '\nregion :\n', region

source_key = options.source
if source is None: source = project.source.name

server = \
BuildProcessServer(year, source, region, factory.gddThresholdsAsStrings())
parser.add_option('-f',
                  action='store_true',
                  dest='update_forecast',
                  default=False)
parser.add_option('-v', action='store_true', dest='verbose', default=False)
parser.add_option('-z', action='store_true', dest='debug', default=False)

options, args = parser.parse_args()

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

debug = options.debug
update_forecast = options.update_forecast
verbose = options.verbose or debug

factory = GDDAppProjectFactory()
project = factory.getProjectConfig()

source_key = args[0]
if source_key is None: source_key = project.source
source = factory.getSourceConfig(source_key)
if verbose:
    print 'the source config is :\n', source
    print ' '

region = args[1]
if region is None: region = project.region
if len(region) == 2: region = region.upper()
bbox = factory.getRegionConfig(region).data

# get the last possible date that data might be available from this source
parser = OptionParser()

parser.add_option('-r', action='store', dest='region', default=None)
parser.add_option('-s', action='store', dest='source', default=None)
parser.add_option('-v', action='store_true', dest='verbose', default=False)
parser.add_option('-z', action='store_true', dest='debug', default=False)

options, args = parser.parse_args()

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

debug = options.debug
source = options.source
verbose = options.verbose

factory = GDDAppProjectFactory()

coverage = args[0] # 'daily' or 'accumulated'
gdd_threshold = args[1] # string version of GDD threshold

# get time spans from config file
if len(args) > 2: year = int(args[2])
else: year = datetime.date.today().year
if year in (365,366): days_in_history = year
else: days_in_history = daysInYear(year)

project = factory.getProjectConfig()
if verbose: print '\nproject :\n', project

region_key = options.region
if region_key is None: region_key = project.region
Exemplo n.º 7
0
parser = OptionParser()

parser.add_option('-r', action='store', dest='region', default=None)
parser.add_option('-s', action='store', dest='source', default=None)
parser.add_option('-v', action='store_true', dest='verbose', default=False)
parser.add_option('-z', action='store_true', dest='debug', default=False)

options, args = parser.parse_args()

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

debug = options.debug
verbose = options.verbose or debug
if debug: print '\refeesh_daily_gdd_grids.py', args

factory = GDDAppProjectFactory()
project = factory.getProjectConfig()

region = options.region
if region is None: region = project.region
if len(region) == 2: region = region.upper()
bbox = factory.getRegionConfig(region).data

source_key = options.source
if source_key is None: source_key = project.source
source = factory.getSourceConfig(source_key)
if verbose:
    print 'the source config is :\n', source
    print ' '
latest_available_date = factory.latestAvailableDate(source)
latest_available_time = \