dataset, None, None, test_file)
filename_template = mapFilename('%s', variety.name, model.name, 'chill',
                                dataset, None, None, test_file)
filepath_template = map_dirpath + os.sep + filename_template

# get the map title template and initialize the map title
title_template = fromConfig('crops.apple.chill.maps.titles.accumulated')
title = title_template % {
    'model': model.description,
}

# get GDD map options
map_options = fromConfig('crops.apple.chill.maps.options.accumulated.attrs')

# get date indepenedent attributes and grids from the stage grid manager
manager = factory.getChillGridManager(target_year, 'r', test_file)
lats = manager.lats
lons = manager.lons

date = start_date
while date < past_date:
    map_options['title'] = title
    # date-specific map options
    map_options['date'] = date
    map_options['outputfile'] = filepath_template % asAcisQueryDate(date)

    # get GDD accumulations for the date and draw the map
    chill_grid = manager.getChill(model.name, dataset, date)
    chill_grid[N.where(chill_grid < 0.0)] = N.nan
    drawFilledContours(chill_grid, lats, lons, **map_options)
Exemplo n.º 2
0
warnings.filterwarnings('ignore', "All-NaN slice encountered")
warnings.filterwarnings('ignore', "invalid value encountered in greater")
warnings.filterwarnings('ignore', "invalid value encountered in less")
# MUST ALSO TURN OFF WARNING FILTERS AT END OF SCRIPT !!!!!

from frost.factory import FrostGridFactory
factory = FrostGridFactory()

if copy_from_apple:
    from frost.apple.factory import AppleGridFactory
    from frost.temperature import FrostTempFileBuilder

    apple_factory = AppleGridFactory()
    start_date, end_date = factory.getTargetDateSpan(target_year)

    apple_manager = apple_factory.getChillGridManager(target_year, 'r')
    lats = apple_manager.lats
    lons = apple_manager.lons
    apple_manager.close()

    manager = FrostTempFileBuilder(start_date,
                                   end_date,
                                   lons,
                                   lats,
                                   bbox=apple_manager.search_bbox,
                                   acis_grid=apple_manager.acis_grid,
                                   verbose=verbose)
    manager.close()

    if copy_temps:
        apple_manager.open(mode='r')