# get the chill data file manger for the target year ... IT MUST ALREADY EXIST


# need to save the indexes where NANs occur
mint_nan_indexes = N.where(N.isnan(mint))

# get a Variety grid manager for the target year
old_manager = \
factory.getVarietyGridManager(target_year, variety_name, 'a', test_run)
models = [name.lower() for name in old_manager.file_chill_models]
gdd_thresholds = old_manager.gddThresholds()

new_manager = \
factory.newVarietyGridManager(target_year, variety_name, models, 
                              gdd_thresholds, old_manager.search_bbox,
                              old_manager.acis_grid, True)

def copyTemp(temp_type, new_manager, old_manager, old_prov_name):
    old_temp_dataset = old_manager.getDataset(temp_type)
    old_prov_dataset = old_manager.getDataset(old_prov_name)

    new_temp_dataset = new_manager.getDataset(temp_type)
    new_temp_dataset.attrs['created'] = old_temp_dataset.attrs['created']
    new_prov_dataset = new_manager.getDataset('%s_provenance' %temp_type)
    new_prov_dataset.attrs['created'] = old_temp_dataset.attrs['created']

    for day in range(old_temp_dataset.shape[0]):
        data = old_temp_dataset[day][:,:]
        dates = old_prov_dataset[day]
        record = [ dates.obs_date, dates.processed
Example #2
0
# need to save the indexes where NANs occur in mint
mint_nan_indexes = N.where(N.isnan(mint))
if verbose:
    print '\n min temp :', mint.shape, ': nans =', len(
        mint_nan_indexes[0]), 'of ', N.prod(mint.shape)

# get a Variety grid manager for the target year
filepath = factory.getVarietyFilePath(target_year, variety, test_file)
if os.path.exists(filepath):
    variety_manager = \
    factory.getVarietyGridManager(target_year, variety, 'a', test_file)
else:  # create a new Variety grid file
    gdd_thresholds = chill_manager.gddThresholds()
    variety_manager = \
    factory.newVarietyGridManager(target_year, variety, models,
               gdd_thresholds, test_file, verbose, data_bbox=data_bbox)

# save the temperature grid to the variety grid file
variety_manager.close()
if debug:
    print 'Min Temp @ in degrees F node[%d,%d] :' % midpoint
    if end_date is None: print mint[y, x]
    else: print mint[:, y, x]

# make sure managers can read their data files
chill_manager.open('r')
variety_manager.open('r')

variety_titled = variety.name.replace('_', ' ').title()
# estimate GDD accumulation, stage and kill probability for this variety
for model_name in models: