Esempio n. 1
0
bbox = -77.2056, 38.2666, -76.4008, 39.3539

# start and end dates (just look at a few months to highlight the concept)

start = datetime.datetime(1980, 1, 1)
end = datetime.datetime(1990, 1, 2)

# make a time series

delta = datetime.timedelta(days=1)
times = [start + i * delta for i in range((end - start).days)]

# path to 7zip if using windows

processor.path_to_7z = r'C:/Program Files/7-Zip/7z.exe'

# download the data; this step will be skipped if this has already been done
# (from the last example) but is necessary to set the metadata

processor.download(bbox, start, end, output, datasets=['GSOD'])

# let's use the processor to aggregate the GSOD data together, including
# tmin, tmax, dewpoint, and wind speed. The GSOD database contains dew point
# and seems to be more complete than GHCND. It doesn't have snow or pan
# evaporation though--this is why they are both included.

tmax = processor.aggregate('GSOD', 'tmax', start, end)
tmin = processor.aggregate('GSOD', 'tmin', start, end)
dewpoint = processor.aggregate('GSOD', 'dewpoint', start, end)
wind = processor.aggregate('GSOD', 'wind', start, end)
Esempio n. 2
0
output = 'HSPF_data'  

if not os.path.isdir(output): os.mkdir(output)

# this is the bounding box of interest from the last example

bbox = -77.2056, 38.2666, -76.4008, 39.3539

# start and end dates (just look at a few months to highlight the concept)

start = datetime.datetime(1980, 4, 1)
end   = datetime.datetime(1980, 10, 2)

# path to 7zip if using windows

processor.path_to_7z = r'C:/Program Files/7-Zip/7z.exe'

# download the data; this step will be skipped if this has already been done
# (from the last example) but is necessary to set the metadata

processor.download(bbox, start, end, output, datasets = ['GHCND'])

# let's use GHCND to work with temperature data. let's use the metadata to 
# find the 10 stations with the longest temperature records and then aggregate 
# the data together to get a mean time series across the period of interest.

n = 10

# make a list of the 
templengths = []