예제 #1
0
    fcast_date = datetime.date(int(args[0]), int(args[1]), int(args[2]))
else:
    errmsg = 'Invalid number of command line arguments. Either pass None'
    errmsg += ' for current day or the complete year, month, day to explore.'
    SyntaxError, errmsg

factory = NDFDProjectFactory()
project = factory.getProjectConfig()

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

region_bbox = list(stringToBbox(region.data))
print 'project region bounding box', region_bbox

ndfd_config = factory.getSourceConfig('ndfd')
offset = options.offset
if offset is None:
    offset = ndfd_config.bbox_offset
    if isinstance(offset, (ndfd_config.__class__, dict)):
        lat_offset = offset.lat
        lon_offset = offset.lon
    elif isinstance(offset, (tuple, list)):
        if offset[0] < 0:
            lon_offset, lat_offset = offset
        else:
            lat_offset, lon_offset = offset
    else:
예제 #2
0
fcast_date = datetime.date(int(args[0]), int(args[1]), int(args[2]))
print '\nIndexing forecast for', fcast_date

factory = NDFDProjectFactory()
project = factory.getProjectConfig()

csv_filepath = options.csv_filepath
if csv_filepath is not None:
    csv_filepath = os.path.abspath(csv_filepath)

region_key = options.region
if region_key is None:
    region_key = factory.project.region
region = factory.getRegionConfig(region_key)
print 'region =', region.description
region_bbox = list(stringToBbox(region.data))
print 'project region bounding box', region_bbox

source_key = options.source
if source_key is None:
    source_key = factory.project.source
source = factory.getSourceConfig(source_key)

ndfd_config = factory.getSourceConfig('ndfd')

# all regions other than conus need a subset of the forecast area
if source_key != 'conus':
    ndfd_bbox = ndfd_config.get('bbox.%s' % region_key, None)
    if ndfd_bbox is not None:
        ndfd_bbox = stringToBbox(ndfd_bbox)
    else: