Example #1
0
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)

# since we don't have hourly data for temperature, wind, or dew point, some
# assumptions are needed (if anyone can suggest hourly databases for these
# parameters that would be pretty awesome BTW); the ETCalculator has a public
# method to interpolate temperatures to hourly values assuming the minimum
# temperature occurs at 6 am and the max at 4 pm and then interpolating using
# sin function for each day

hourlytemps = calculator.interpolate_temperatures(start, end)

# for wind speed and dewpoint, just assume the values are constant throughout
# the day

hdewt = [v for v in dewt for i in range(24)]
hwind = [v for v in wind for i in range(24)]

# 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
Example #2
0
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)

# use the daily tmin and tmax time series to the calculator to get hourly temps

calculator.add_timeseries("tmin", "daily", start, tmin)
calculator.add_timeseries("tmax", "daily", start, tmax)

# calculate the hourly temperature time series

hourlytemps = calculator.interpolate_temperatures(start, end)

# assume the values for wind speed and dewpoint are constant throughout the day

hdewt = [v for v in dewt for i in range(24)]
hwind = [v for v in wind for i in range(24)]

# 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)
calculator.add_timeseries("solar", "hourly", start, solar)

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