map_options = map_config.options[map_type].attrs
map_options = setupMap(map_options)
map_options['title'] = None
map_options['title2'] = None
map_options['area_template'] = map_config.no_data[map_type].create_with
if 'grid' in map_options: del map_options['grid']

dirpath = os.path.split(output_file)[0]
if dirpath:
    if not os.path.exists(dirpath): os.makedirs(dirpath)
    map_options['outputfile'] = output_file
else:
    dirpath = map_options['shapelocation']
    map_options['outputfile'] = os.path.join(dirpath, output_file)

factory = AppleGridFactory()
target_year = factory.getTargetYear(datetime.now())
reader = factory.getTempGridReader(target_year)

_map_ = hiResMap(reader.getTemp('reported.maxt', reader.start_date),
                 reader.lats, reader.lons, **map_options)
options = _map_[0]
fig1 = fig = _map_[2]
if map_type in ('gdd', 'accumulated'):
    grid = N.empty(reader.lons.shape, dtype=float)
    grid.fill(N.nan)
    drawFilledContours(grid, reader.lats, reader.lons, **map_options)
else:
    finishMap(fig, fig, options)
    month = int(args[6])
    day = int(args[7])
    end_date = datetime(year, month, day)
else:
    end_date = datetime.date.today() - relativedelta(days=1)

# filter annoying numpy warnings
warnings.filterwarnings('ignore', "All-NaN axis encountered")
warnings.filterwarnings('ignore', "All-NaN slice encountered")
warnings.filterwarnings('ignore', "invalid value encountered in greater")
warnings.filterwarnings('ignore', "invalid value encountered in less")
warnings.filterwarnings('ignore', "Mean of empty slice")
# MUST ALSO TURN OFF WARNING FILTERS AT END OF SCRIPT !!!!!

factory = AppleGridFactory()
target_year = factory.getTargetYear(start_date)

plot_options = \
fromConfig('crops.apple.variety.plots.options.hardiness_vs_temp').copy()
plot_options['coords'] = coords
plot_options['location'] = location
plot_options['variety'] = variety.description
temp_units = plot_options.temp_units

# initialize figure and GCA
figure = pyplot.figure(figsize=plot_options.figsize, dpi=100)
axis = figure.gca()

# read the reported mint for the current season
reader = factory.getTempGridReader(target_year)
# turn start/end dates into a list of date indexes
Beispiel #3
0
options, args = parser.parse_args()

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

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

variety = getAppleVariety(args[0])

factory = AppleGridFactory()

year = int(args[1])
month = int(args[2])
day = int(args[3])
date = datetime(year,month,day)
target_year = factory.getTargetYear(date)

# filter annoying numpy warnings
warnings.filterwarnings('ignore',"All-NaN axis encountered")
warnings.filterwarnings('ignore',"All-NaN slice encountered")
warnings.filterwarnings('ignore',"invalid value encountered in greater")
warnings.filterwarnings('ignore',"invalid value encountered in less")
warnings.filterwarnings('ignore',"Mean of empty slice")
# MUST ALSO TURN OFF WARNING FILTERS AT END OF SCRIPT !!!!!

variety_manager = factory.getVarietyGridManager(target_year, variety, 'r')
models = [name.lower() for name in variety_manager.file_chill_models]
variety_manager.close()

# make sure managers can read their data files