Exemplo n.º 1
0
debug = options.debug
verbose = options.verbose or debug

var_name_map = {'maxt':'Maximum temperature', 'mint':'Minimum temperature'}

source_key = args[0]
region_key = args[1]

if len(args) ==2:
    target_date = datetime.date.today()
else:
    target_date = datetime.date(int(args[2]), int(args[3]), int(args[4]))

ndfd_factory = NDFDProjectFactory()
ndfd = ndfd_factory.sourceConfig('ndfd')

temps_factory = TempextsProjectFactory()
region = temps_factory.regionConfig(region_key)
source = temps_factory.sourceConfig(source_key)
print 'updating % source file with NDFD forecast' % source.tag

# need indexes from static file for source
reader = ndfd_factory.staticFileReader(source, region)
source_shape = reader.datasetShape('ndfd.x_indexes')
ndfd_indexes = [ reader.getData('ndfd.y_indexes').flatten(),
                 reader.getData('ndfd.x_indexes').flatten() ]
reader.close()
del reader

reader = temps_factory.tempextsFileReader(target_date.year, source, region)
Exemplo n.º 2
0
    errmsg += ' for current day or the complete year, month, day to explore.'
    SyntaxError, errmsg

factory = NDFDProjectFactory()
if dev_mode: factory.useDirpathsForMode('dev')
project = factory.getProjectConfig()
ndfd_config = factory.getSourceConfig('ndfd')

if region_key is None:
    region_key = factory.project.region
grid_region = factory.regionConfig(region_key)
print 'region =', grid_region.description

if source_key is None:
    source_key = factory.project.source
grid_source = factory.sourceConfig(source_key)
print 'source =', grid_source.description

reader = factory.staticFileReader(grid_source, grid_region)
grid_shape, grib_indexes = reader.gribSourceIndexes('ndfd')
data_mask = reader.getData('cus_mask')
reader.close()

grid = N.empty((num_hours, ) + grid_shape, dtype=float)
grid.fill(N.nan)

grib_times = []

grib_filepath = factory.forecastGribFilepath(factory.sourceConfig('ndfd'),
                                             fcast_date, timespan, variable)
print '\nreading gribs from', grib_filepath