コード例 #1
0
    def __init__(self, target_year, variety, test_file=False, **kwargs):
        filepath = kwargs.get('filepath',
                              varietyFilepath(target_year, variety, test_file))
        AppleGridFileReader.__init__(self, target_year, filepath)

        if isinstance(variety, basestring):
            self.variety = getAppleVariety(variety)
        else:
            self.variety = variety
コード例 #2
0
    def __init__(self,
                 target_year,
                 variety,
                 mode='r',
                 test_file=False,
                 **kwargs):
        if 'filepath' in kwargs: filepath = kwargs['filepath']
        else: filepath = varietyFilepath(target_year, variety, test_file)

        AppleGridFileManager.__init__(self, target_year, filepath, mode)

        if isinstance(variety, basestring):
            self.variety = getAppleVariety(variety)
        else:
            self.variety = variety

        self._loadProvenanceDependencies_()
        self.provenance.update(fromConfig('crops.apple.variety.provenance'))
コード例 #3
0
options, args = parser.parse_args()

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

temp_source = options.temp_source
test_file = options.test_file
# coordinates
ll = options.coords.split(',')
lon = float(ll[0].strip())
lat = float(ll[1].strip())
coords = (lon, lat)
location = options.location

# apple variety config
variety = getAppleVariety(args[0])
# chill model
model = fromConfig('crops.apple.chill.%s.self' % args[1])

# get the date span
year = int(args[2])
month = int(args[3])
day = int(args[4])
start_date = datetime(year, month, day)
if len(args) >= 8:
    year = int(args[5])
    month = int(args[6])
    day = int(args[7])
    end_date = datetime(year, month, day)
else:
    end_date = datetime.date.today() - relativedelta(days=1)
コード例 #4
0
# station search criteria
parser.add_option('-v', action='store_true', dest='verbose', default=False)
parser.add_option('-y', action='store_true', dest='test_file', default=False)
parser.add_option('-z', action='store_true', dest='debug', default=False)

options, args = parser.parse_args()

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

debug = options.debug
test_file = options.test_file
verbose = options.verbose

# apple variety and chill model
if not args[0].isdigit():
    varieties = (getAppleVariety(args[0]), )
    if not args[1].isdigit():
        models = (fromConfig('crops.apple.chill.%s.self' % args[1]), )
        date_indx = 2
    else:
        models = fromConfig('crops.apple.chill.getActiveModels()')
        date_indx = 1
else:
    varieties = fromConfig('crops.apple.varieties.children')
    models = fromConfig('crops.apple.chill.getActiveModels()')
    date_indx = 0

# get the date
date_args = args[date_indx:]
num_date_args = len(date_args)
if num_date_args >= 3:
コード例 #5
0
parser.add_option('-s', action='store_false', dest='stage', default=True)
parser.add_option('-u', action='store_false', dest='utah', default=True)
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()

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

repair_carolina = options.carolina
repair_utah = options.utah
test_file = options.test_file
verbose = options.verbose

target_year = int(args[0])
variety = getAppleVariety(args[1])

manager = AppleVarietyGridRepair(target_year, variety, 'a')

if repair_carolina:
    repairModel(manager, 'carolina', options)
    manager.close()
if repair_utah:
    manager.open(mode='a')
    repairModel(manager, 'utah', options)
    manager.close()

attrs = {
    'grid_type': DEFAULTS.grid_type,
    'node_spacing': DEFAULTS.node_spacing
}