start_month, day = fromConfig('default.start_day')
target_start_date = datetime(start_year, start_month, day)
month, day = fromConfig('default.end_day')
target_end_date = datetime(target_year, month, day)

# download several days at a time
start_date = target_start_date
end_date = start_date + days_per_loop

while start_date <= target_end_date:
    if end_date > target_end_date: end_date = target_end_date
    print 'downloading', asAcisQueryDate(start_date), asAcisQueryDate(end_date)

    # download historical temperatures for the time span
    data = factory.getAcisGridData('mint,maxt',
                                   start_date,
                                   end_date,
                                   None,
                                   data_bbox,
                                   acis_grid,
                                   debug=debug)
    # update the file's temperature grid
    manager.open('a')
    manager.updateTemp('reported.maxt', data['maxt'], start_date)
    manager.updateTemp('reported.mint', data['mint'], start_date)
    manager.close()

    # next month
    start_date = end_date + ONE_DAY
    end_date = start_date + days_per_loop
Beispiel #2
0
print manager._hdf5_filepath
manager.close()

if download_temps:
    current_date = datetime.datetime.now()
    if target_year <= current_date.year:
        if target_year == current_date.year:
            if current_date >= start_date and current_date <= end_date:
                end_date = current_date

    date = start_date
    while date <= end_date:
        if verbose: print '\ndownloading', date
        manager.open('a')
        acis_grid = manager.getDatasetAttribute('reported.maxt', 'acis_grid')
        data = factory.getAcisGridData('mint,maxt',
                                       date,
                                       None,
                                       None,
                                       manager.data_bbox,
                                       int(acis_grid),
                                       debug=debug)
        manager.updateTemp('reported.maxt', data['maxt'], date)
        manager.updateTemp('reported.mint', data['mint'], date)
        manager.close()
        date += ONE_DAY
        if sleep > 0 and date < end_date: time.sleep(sleep)

# turn annoying numpy warnings back on
warnings.resetwarnings()