Example #1
0
# the Penman-Monteith Equation requires temperature, humidity of dewpoint,
# wind speed, and solar radiation, which can be obtained from the processor

processor.download_shapefile(filename, start, end, output, space=0.)

# let's get the daily tmin, tmax, dewpoint, wind speed and solar

tmax = processor.aggregate('GSOD', 'tmax', start, end)
tmin = processor.aggregate('GSOD', 'tmin', start, end)
dewt = processor.aggregate('GSOD', 'dewpoint', start, end)
wind = processor.aggregate('GSOD', 'wind', start, end)
solar = processor.aggregate('NSRDB', 'metstat', start, end)

# use the ETCalculator to estimate the evapotranspiration time series

calculator = ETCalculator()

# some of the parameters in the Penman-Monteith Equation depend on the
# geographic location so get the average longitude, latitude, and elevation

sf = Reader(filename)

# make a list of the fields for each shape

fields = [f[0] for f in sf.fields]

# get the area, centroid and elevation of each shape

areas = [r[fields.index('AreaSqKm') - 1] for r in sf.records()]
xs = [r[fields.index('CenX') - 1] for r in sf.records()]
ys = [r[fields.index('CenY') - 1] for r in sf.records()]
Example #2
0
        # remove datasets with no observations during the requested period

        observations = [v for v in data if v is not None]

        if len(observations) > 0:

            # add the data to the dictionary

            evaporation[v['name']] = data

print('')

# the ETCalculator class uses the Penman-Monteith Equation to estimate
# evapotranspiration time series; let's make an instance to use

calculator = ETCalculator()

# the ETCalculator makes use of hourly and daily time series that must be
# supplied externally as:
#
#   1. time series type (temperature, dewpoint, humidity, wind, solar, etc)
#   2. time step step ("daily", "hourly", or size in minutes, e.g., 60, 1440)
#   3. start time
#   4. list of data values
#
# note these are the same formats used by the PyHSPF HSPFModel class
# so now we can add the daily timeseries from above

calculator.add_timeseries('tmin', 'daily', start, tmin)
calculator.add_timeseries('tmax', 'daily', start, tmax)
calculator.add_timeseries('dewpoint', 'daily', start, dewt)
Example #3
0
            # the pan evaporation data are "backward-looking;" i.e., the value
            # for June 2 represents evaporation between midnight June 1 and
            # midnight June 2; whereas the ETCalculator uses data that are
            # "forward-looking;" i.e., tmin, tmax, dewpoint, wind speed for
            # June 2 represent values between midnight June 2 and midnight
            # June 3; so the pan evaporation data must be shifted forward by
            # a day for comparison.

            evaporation[v['name']] = data[1:] + [None]

print('')

# the ETCalculator class uses the Penman-Monteith Equation to estimate
# evapotranspiration time series; let's make an instance to use

calculator = ETCalculator()

# the ETCalculator makes use of hourly and daily time series that must be
# supplied externally as:
#
#   1. time series type (temperature, dewpoint, humidity, wind, solar, etc)
#   2. time step step ("daily", "hourly", or size in minutes, e.g., 60, 1440)
#   3. start time
#   4. list of data values
#
# note these are the same formats used by the PyHSPF HSPFModel class
# so now we can add the daily timeseries from above

calculator.add_timeseries('tmin', 'daily', start, tmin)
calculator.add_timeseries('tmax', 'daily', start, tmax)
calculator.add_timeseries('dewpoint', 'daily', start, dewt)
Example #4
0
# the Penman-Monteith Equation requires temperature, humidity of dewpoint,
# wind speed, and solar radiation, which can be obtained from the processor

processor.download_shapefile(filename, start, end, output, space=0.)

# let's get the daily tmin, tmax, dewpoint, wind speed and solar

tmax = processor.aggregate('GSOD', 'tmax', start, end)
tmin = processor.aggregate('GSOD', 'tmin', start, end)
dewt = processor.aggregate('GSOD', 'dewpoint', start, end)
wind = processor.aggregate('GSOD', 'wind', start, end)
solar = processor.aggregate('NSRDB', 'metstat', start, end)

# use the ETCalculator to estimate the evapotranspiration time series

calculator = ETCalculator()

# some of the parameters in the Penman-Monteith Equation depend on the
# geographic location so get the average longitude, latitude, and elevation

sf = Reader(filename)

# make a list of the fields for each shape

fields = [f[0] for f in sf.fields]

# get the area, centroid and elevation of each shape

areas = [r[fields.index('AreaSqKm') - 1] for r in sf.records()]
xs = [r[fields.index('CenX') - 1] for r in sf.records()]
ys = [r[fields.index('CenY') - 1] for r in sf.records()]
Example #5
0
            # the pan evaporation data are "backward-looking;" i.e., the value
            # for June 2 represents evaporation between midnight June 1 and
            # midnight June 2; whereas the ETCalculator uses data that are
            # "forward-looking;" i.e., tmin, tmax, dewpoint, wind speed for 
            # June 2 represent values between midnight June 2 and midnight
            # June 3; so the pan evaporation data must be shifted forward by
            # a day for comparison. 

            evaporation[v['name']] = data[1:] + [None]

print('')

# the ETCalculator class uses the Penman-Monteith Equation to estimate 
# evapotranspiration time series; let's make an instance to use

calculator = ETCalculator()

# the ETCalculator makes use of hourly and daily time series that must be
# supplied externally as:
#
#   1. time series type (temperature, dewpoint, humidity, wind, solar, etc)
#   2. time step step ("daily", "hourly", or size in minutes, e.g., 60, 1440)
#   3. start time
#   4. list of data values
#
# note these are the same formats used by the PyHSPF HSPFModel class
# so now we can add the daily timeseries from above

calculator.add_timeseries('tmin',     'daily', start, tmin)
calculator.add_timeseries('tmax',     'daily', start, tmax)
calculator.add_timeseries('dewpoint', 'daily', start, dewt)
Example #6
0
wind = processor.aggregate('GSOD', 'wind', start, end)

# let's use the hourly METSTAT data from the NSRDB for solar radiation

solar = processor.aggregate('NSRDB', 'metstat', start, end)

# aggregate the hourly solar data to daily for plotting

dsolar = [
    sum(solar[i:i + 24]) / 24 for i in range(0, 24 * (end - start).days, 24)
]

# the ETCalculator class uses the Penman-Monteith Equation to estimate
# evapotranspiration time series; make an instance to use

calculator = ETCalculator()

# some of the parameters in the Penman-Monteith Equation depend on the
# geographic location so let's use the information in the shapefile to
# provide the average longitude, latitude, and elevation

sf = Reader(filename)

# make a list of the fields for each shape

fields = [f[0] for f in sf.fields]

# get the area, centroid and elevation of each shape

areas = [r[fields.index('AreaSqKm') - 1] for r in sf.records()]
xs = [r[fields.index('CenX') - 1] for r in sf.records()]
Example #7
0
# the Penman-Monteith Equation requires temperature, humidity of dewpoint,
# wind speed, and solar radiation, which can be obtained from the processor

processor.download_shapefile(filename, start, end, output, space=0.0)

# let's get the daily tmin, tmax, dewpoint, wind speed and solar

tmax = processor.aggregate("GSOD", "tmax", start, end)
tmin = processor.aggregate("GSOD", "tmin", start, end)
dewt = processor.aggregate("GSOD", "dewpoint", start, end)
wind = processor.aggregate("GSOD", "wind", start, end)
solar = processor.aggregate("NSRDB", "metstat", start, end)

# use the ETCalculator to estimate the evapotranspiration time series

calculator = ETCalculator()

# some of the parameters in the Penman-Monteith Equation depend on the
# geographic location so get the average longitude, latitude, and elevation

sf = Reader(filename)

# make a list of the fields for each shape

fields = [f[0] for f in sf.fields]

# get the area, centroid and elevation of each shape

areas = [r[fields.index("AreaSqKm") - 1] for r in sf.records()]
xs = [r[fields.index("CenX") - 1] for r in sf.records()]
ys = [r[fields.index("CenY") - 1] for r in sf.records()]
Example #8
0
        # remove datasets with no observations during the requested period

        observations = [v for v in data if v is not None]

        if len(observations) > 0:

            # add the data to the dictionary

            evaporation[v["name"]] = data

print("")

# the ETCalculator class uses the Penman-Monteith Equation to estimate
# evapotranspiration time series; let's make an instance to use

calculator = ETCalculator()

# the ETCalculator makes use of hourly and daily time series that must be
# supplied externally as:
#
#   1. time series type (temperature, dewpoint, humidity, wind, solar, etc)
#   2. time step step ("daily", "hourly", or size in minutes, e.g., 60, 1440)
#   3. start time
#   4. list of data values
#
# note these are the same formats used by the PyHSPF HSPFModel class
# so now we can add the daily timeseries from above

calculator.add_timeseries("tmin", "daily", start, tmin)
calculator.add_timeseries("tmax", "daily", start, tmax)
calculator.add_timeseries("dewpoint", "daily", start, dewt)
Example #9
0
# the Penman-Monteith Equation requires temperature, humidity of dewpoint,
# wind speed, and solar radiation, which can be obtained from the processor

processor.download_shapefile(filename, start, end, output, space = 0.)

# let's get the daily tmin, tmax, dewpoint, wind speed and solar

tmax  = processor.aggregate('GSOD',  'tmax',     start, end)
tmin  = processor.aggregate('GSOD',  'tmin',     start, end)
dewt  = processor.aggregate('GSOD',  'dewpoint', start, end)
wind  = processor.aggregate('GSOD',  'wind',     start, end)
solar = processor.aggregate('NSRDB', 'metstat',  start, end)

# use the ETCalculator to estimate the evapotranspiration time series

calculator = ETCalculator()

# some of the parameters in the Penman-Monteith Equation depend on the 
# geographic location so get the average longitude, latitude, and elevation

sf = Reader(filename)

# make a list of the fields for each shape

fields = [f[0] for f in sf.fields]

# get the area, centroid and elevation of each shape

areas = [r[fields.index('AreaSqKm') - 1] for r in sf.records()]
xs    = [r[fields.index('CenX')     - 1] for r in sf.records()]
ys    = [r[fields.index('CenY')     - 1] for r in sf.records()]
Example #10
0
tmin  = processor.aggregate('GSOD', 'tmin', start, end)
dewt  = processor.aggregate('GSOD', 'dewpoint', start, end)
wind  = processor.aggregate('GSOD', 'wind', start, end)

# let's use the hourly METSTAT data from the NSRDB for solar radiation

solar = processor.aggregate('NSRDB', 'metstat', start, end)

# aggregate the hourly solar data to daily for plotting

dsolar = [sum(solar[i:i+24]) / 24 for i in range(0, 24 * (end-start).days, 24)]

# the ETCalculator class uses the Penman-Monteith Equation to estimate 
# evapotranspiration time series; make an instance to use

calculator = ETCalculator()

# some of the parameters in the Penman-Monteith Equation depend on the 
# geographic location so let's use the information in the shapefile to 
# provide the average longitude, latitude, and elevation

sf = Reader(filename)

# make a list of the fields for each shape

fields = [f[0] for f in sf.fields]

# get the area, centroid and elevation of each shape

areas = [r[fields.index('AreaSqKm') - 1] for r in sf.records()]
xs    = [r[fields.index('CenX')     - 1] for r in sf.records()]
Example #11
0
# the Penman-Monteith Equation requires temperature, humidity or dewpoint,
# wind speed, and solar radiation, which can be obtained from the processor

processor.download_shapefile(filename, start, end, output, space = 0.)

# let's get the daily tmin, tmax, dewpoint, wind speed and solar

tmax  = processor.aggregate('GSOD',  'tmax',     start, end)
tmin  = processor.aggregate('GSOD',  'tmin',     start, end)
dewt  = processor.aggregate('GSOD',  'dewpoint', start, end)
wind  = processor.aggregate('GSOD',  'wind',     start, end)
solar = processor.aggregate('NSRDB', 'metstat',  start, end)

# use the ETCalculator to estimate the evapotranspiration time series

calculator = ETCalculator()

# some of the parameters in the Penman-Monteith Equation depend on the 
# geographic location so get the average longitude, latitude, and elevation

sf = Reader(filename)

# make a list of the fields for each shape

fields = [f[0] for f in sf.fields]

# get the area, centroid and elevation of each shape

areas = [r[fields.index('AreaSqKm') - 1] for r in sf.records()]
xs    = [r[fields.index('CenX')     - 1] for r in sf.records()]
ys    = [r[fields.index('CenY')     - 1] for r in sf.records()]