Example #1
0
# now add the hourly time series to the calculator

calculator.add_timeseries('temperature', 'hourly', start, hourlytemps)
calculator.add_timeseries('dewpoint', 'hourly', start, hdewt)
calculator.add_timeseries('wind', 'hourly', start, hwind)

# the solar radiation data from NSRDB are already hourly

calculator.add_timeseries('solar', 'hourly', start, solar)

# calculate the reference evapotranspiration (RET) time series from the hourly
# and daily Penman-Monteith Equation

calculator.penman_hourly(start, end)
calculator.penman_daily(start, end)

# create pointers to the time series in the etcalculator's dictionaries

start, RET = calculator.hourly['RET']
start, dRET = calculator.daily['RET']

# aggregate the hourly back to daily

hRET = [sum(RET[i:i + 24]) for i in range(0, len(RET), 24)]

# plot up the results (note that there are no observations over the winter)

from matplotlib import pyplot, dates, ticker

fig = pyplot.figure(figsize=(8, 10))
Example #2
0
# get the areal-weighted averages

lon  = sum([a * x for a, x in zip(areas, xs)]) / sum(areas)
lat  = sum([a * y for a, y in zip(areas, ys)]) / sum(areas)
elev = sum([a * z for a, z in zip(areas, zs)]) / sum(areas)

# add the information to the calculator

calculator.add_location(lon, lat, elev)

# it is pretty trivial to get the corresponding reference evapotranspiration 
# (RET) time series from the Daily Penman-Monteith Equation if the necessary 
# data are available by calling the public "penman_daily" method

calculator.penman_daily(start, end)

# the RET estimates are stored in the calculator's daily timeseries dictionary
# with the start date and data (the timestep is 1440 minutes = 1 day)

start, RET = calculator.daily['RET']

# calculate the linear regression between the Penman-Monteith model and the 
# observed pan evaporation using scipy

from scipy import stats

# plot up the results (note that there are no observations over the winter)

from matplotlib import pyplot, dates, ticker