コード例 #1
0
ONE_DAY = relativedelta(days=1)

import numpy as N

from atmosci.utils.options import stringToTuple
from atmosci.utils.timeutils import daysInYear, lastDayOfMonth

from frost.apple.factory import AppleGridFactory

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

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='test_file', default=False)

options, args = parser.parse_args()

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

test_file = options.test_file
verbose = options.verbose

target_year = int(args[0])

factory = AppleGridFactory()
factory.newChillGridManager(target_year, None, test_file)
コード例 #2
0
# get a chill data file manger
filepath = factory.getChillFilePath(target_year, test_file)
if not os.path.exists(filepath):
    if models in (None, 'all'):
        models = fromConfig('crops.apple.chill.models')
    elif ',' in models:
        models = models.split(',')
    else:
        models = [
            models,
        ]
    gdd_thresholds = getGddThresholds(options, None)
    manager = factory.newChillGridManager(target_year,
                                          models,
                                          gdd_thresholds,
                                          test_file,
                                          acis_grid=acis_grid,
                                          data_bbox=data_bbox)
else:
    manager = factory.getChillGridManager(target_year, 'r', test_file)
    if data_bbox != manager.data_bbox:
        errmsg = "'%d' bbox option does not match '%s' bbox already in Chill file %s"
        raise ValueError, errmsg % (data_bbox, manager.data_bbox, filepath)
    if models in (None, 'all'):
        models = [name.lower() for name in manager.file_chill_models]
    elif ',' in models:
        models = models.split(',')
    else:
        models = [
            models,
        ]