HydPy-Meteo (base model)

The HydPy-Meteo family supplies methods for calculating different meteorological factors as input to other (hydrological) models.

Method Features

class hydpy.models.meteo.meteo_model.Model[source]

Bases: AdHocModel

HydPy-Meteo (base model).

The following “run methods” are called in the given sequence during each simulation step:
The following interface methods are available to main models using the defined model as a submodel:
The following “additional methods” might be called by one or more of the other methods or are meant to be directly called by the user:
DOCNAME: DocName = ('Meteo', 'base model')
REUSABLE_METHODS: ClassVar[tuple[type[ReusableMethod], ...]] = (<class 'hydpy.models.meteo.meteo_model.Process_Radiation_V1'>,)
class hydpy.models.meteo.meteo_model.Calc_EarthSunDistance_V1[source]

Bases: Method

Calculate the relative inverse distance between the Earth and the sun according to Allen et al. (1998).

Requires the derived parameter:

DOY

Requires the fixed parameter:

Pi

Calculates the factor sequence:

EarthSunDistance

Basic equation (Allen et al. (1998), equation 23):

\(EarthSunDistance = 1 + 0.033 \cdot cos(2 \cdot Pi / 366 \cdot (DOY + 1)\)

Note that this equation differs slightly from the one given by Allen et al. (1998). The following examples show that Calc_EarthSunDistance_V1 calculates the same distance value for a specific “day” (e.g. the 1st March) both for leap years and non-leap years. Hence, there is a tiny “jump” between 28th February and 1st March for non-leap years.

Examples:

We define an initialisation period covering a leap year (2000) and a non-leap year (2001):

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> from hydpy import pub, round_
>>> pub.timegrids = "2000-01-01", "2002-01-01", "1d"
>>> derived.doy.update()

The following convenience function applies method Calc_EarthSunDistance_V1 for the given dates and prints the results:

>>> def test(*dates):
...     for date in dates:
...         model.idx_sim = pub.timegrids.init[date]
...         model.calc_earthsundistance_v1()
...         print(date, end=": ")
...         round_(factors.earthsundistance.value)

The results are identical for both years:

>>> test("2000-01-01", "2000-02-28", "2000-02-29",
...      "2000-03-01", "2000-07-01", "2000-12-31")
2000-01-01: 1.032995
2000-02-28: 1.017471
2000-02-29: 1.016988
2000-03-01: 1.0165
2000-07-01: 0.967
2000-12-31: 1.033
>>> test("2001-01-01", "2001-02-28",
...      "2001-03-01", "2001-07-01", "2001-12-31")
2001-01-01: 1.032995
2001-02-28: 1.017471
2001-03-01: 1.0165
2001-07-01: 0.967
2001-12-31: 1.033

The following calculation agrees with example 8 of Allen et al. (1998):

>>> derived.doy(246)
>>> model.idx_sim = 0
>>> model.calc_earthsundistance_v1()
>>> factors.earthsundistance
earthsundistance(0.984993)
class hydpy.models.meteo.meteo_model.Calc_SolarDeclination_V1[source]

Bases: Method

Calculate the solar declination according to Allen et al. (1998).

Requires the derived parameter:

DOY

Requires the fixed parameter:

Pi

Calculates the factor sequence:

SolarDeclination

Basic equation (Allen et al. (1998), equation 24):

\(SolarDeclination = 0.409 \cdot sin(2 \cdot Pi / 366 \cdot (DOY + 1) - 1.39)\)

Note that this equation differs slightly from the one given by Allen et al. (1998) due to reasons explained in the documentation on method Calc_EarthSunDistance_V1.

Examples:

We define an initialisation period covering both a leap year (2000) and a non-leap year (2001):

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> from hydpy import pub, round_
>>> pub.timegrids = "2000-01-01", "2002-01-01", "1d"
>>> derived.doy.update()

The following convenience function applies method Calc_SolarDeclination_V1 for the given dates and prints the results:

>>> def test(*dates):
...     for date in dates:
...         model.idx_sim = pub.timegrids.init[date]
...         model.calc_solardeclination_v1()
...         print(date, end=": ")
...         round_(factors.solardeclination.value)

The results are identical for both years:

>>> test("2000-01-01", "2000-02-28", "2000-02-29",
...      "2000-03-01", "2000-12-31")
2000-01-01: -0.401012
2000-02-28: -0.150618
2000-02-29: -0.144069
2000-03-01: -0.137476
2000-12-31: -0.402334
>>> test("2001-01-01", "2001-02-28",
...      "2001-03-01", "2001-12-31")
2001-01-01: -0.401012
2001-02-28: -0.150618
2001-03-01: -0.137476
2001-12-31: -0.402334

The following calculation agrees with example 8 of Allen et al. (1998):

>>> derived.doy(246)
>>> model.idx_sim = 0
>>> model.calc_solardeclination_v1()
>>> factors.solardeclination
solardeclination(0.117464)
class hydpy.models.meteo.meteo_model.Calc_SolarDeclination_V2[source]

Bases: Method

Calculate the solar declination according to LEG (2020).

Requires the derived parameter:

DOY

Requires the fixed parameter:

Pi

Calculates the factor sequence:

SolarDeclination

Basic equation:

\(SolarDeclination = 0.41 \cdot cos \left( \frac{2 \cdot Pi \cdot (DOY - 171)}{365} \right)\)

Examples:

We define an initialisation period covering both a leap year (2000) and a non-leap year (2001):

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> from hydpy import pub, round_
>>> pub.timegrids = "2000-01-01", "2002-01-01", "1d"
>>> derived.doy.update()

The following convenience function applies method Calc_SolarDeclination_V2 for the given dates and prints the results:

>>> def test(*dates):
...     for date in dates:
...         model.idx_sim = pub.timegrids.init[date]
...         model.calc_solardeclination_v2()
...         print(date, end=": ")
...         round_(factors.solardeclination.value)

The results are identical for both years:

>>> test("2000-01-01", "2000-02-28", "2000-02-29",
...      "2000-03-01", "2000-12-31")
2000-01-01: -0.401992
2000-02-28: -0.149946
2000-02-29: -0.143355
2000-03-01: -0.136722
2000-12-31: -0.401992
>>> test("2001-01-01", "2001-02-28",
...      "2001-03-01", "2001-12-31")
2001-01-01: -0.401992
2001-02-28: -0.149946
2001-03-01: -0.136722
2001-12-31: -0.401992
class hydpy.models.meteo.meteo_model.Calc_SunsetHourAngle_V1[source]

Bases: Method

Calculate the sunset hour angle according to Allen et al. (1998).

Requires the derived parameter:

LatitudeRad

Requires the factor sequence:

SolarDeclination

Calculates the factor sequence:

SunsetHourAngle

Basic equation (Allen et al. (1998), equation 25):

\(SunsetHourAngle = arccos(-tan(LatitudeRad) \cdot tan(SolarDeclination))\)

Example:

The following calculation agrees with example 8 of Allen et al. (1998):

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> derived.doy.shape = 1
>>> derived.doy(246)
>>> derived.latituderad(-.35)
>>> factors.solardeclination = 0.12
>>> model.calc_sunsethourangle_v1()
>>> factors.sunsethourangle
sunsethourangle(1.526767)
class hydpy.models.meteo.meteo_model.Calc_SolarTimeAngle_V1[source]

Bases: Method

Calculate the solar time angle at the midpoint of the current period according to Allen et al. (1998).

Requires the control parameter:

Longitude

Requires the derived parameters:

DOY SCT UTCLongitude

Requires the fixed parameter:

Pi

Calculates the factor sequence:

SolarTimeAngle

Basic equations (Allen et al. (1998), equations 31 to 33):

\(SolarTimeAngle = Pi / 12 \cdot ((SCT + (Longitude - UTCLongitude) / 15 + S_c) - 12)\)

\(S_c = 0.1645 \cdot sin(2 \cdot b) - 0.1255 \cdot cos(b) - 0.025 \cdot sin(b)\)

\(b = (2 \cdot Pi \cdot (DOY - 80)) / 365\)

Note there are two slight deviations from the equations given by Allen et al. (1998). The first one is that positive numbers correspond to longitudes east of Greenwich and negative numbers to longitudes west of Greenwich. The second one is due to the definition of parameter DOY, as explained in the documentation on method Calc_EarthSunDistance_V1.

Examples:

>>> from hydpy import pub, round_
>>> pub.timegrids = "2000-09-03", "2000-09-04", "1h"
>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> longitude(15)
>>> derived.doy.update()
>>> derived.sct.update()
>>> derived.utclongitude.update()
>>> for hour in range(24):
...     model.idx_sim = hour
...     model.calc_solartimeangle_v1()
...     print(hour, end=": ")
...     round_(factors.solartimeangle.value)  
0: -3.004157
1: -2.742358
...
11: -0.124364
12: 0.137435
...
22: 2.755429
23: 3.017229
class hydpy.models.meteo.meteo_model.Calc_TimeOfSunrise_TimeOfSunset_V1[source]

Bases: Method

Calculate the time of sunrise and sunset of the current day according to LEG (2020), based on Thompson et al. (1981).

Requires the control parameter:

Longitude

Requires the derived parameters:

LatitudeRad UTCLongitude

Requires the fixed parameter:

Pi

Requires the factor sequence:

SolarDeclination

Calculates the factor sequences:

TimeOfSunrise TimeOfSunset

Basic equations:

\(TimeOfSunset^* = \frac{12}{Pi} \cdot acos \left( tan(SolarDeclination) \cdot tan(LatitudeRad) + \frac{0.0145}{cos(SolarDeclination) \cdot cos(LatitudeRad)} \right)\)

\(\delta = \frac{4 \cdot (UTCLongitude - Longitude)}{60}\)

\(TimeOfSunset = TimeOfSunset^* + \delta\)

\(TimeOfSunset = 24 - TimeOfSunset^* + \delta\)

Examples:

We calculate the local time of sunrise and sunset for a latitude of approximately 52°N and a longitude of 10°E, 5° west of the longitude that defines the local time zone:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> longitude(10.0)
>>> derived.utclongitude(15.0)
>>> derived.latituderad(0.9)

The sunshine duration varies between seven hours at the winter solstice and 16 hours at the summer solstice:

>>> factors.solardeclination = -0.41
>>> model.calc_timeofsunrise_timeofsunset_v1()
>>> factors.timeofsunrise
timeofsunrise(8.432308)
>>> factors.timeofsunset
timeofsunset(16.234359)
>>> factors.solardeclination = 0.41
>>> model.calc_timeofsunrise_timeofsunset_v1()
>>> factors.timeofsunrise
timeofsunrise(4.002041)
>>> factors.timeofsunset
timeofsunset(20.664625)
class hydpy.models.meteo.meteo_model.Calc_ExtraterrestrialRadiation_V1[source]

Bases: Method

Calculate the extraterrestrial radiation according to Allen et al. (1998).

Requires the derived parameters:

Days LatitudeRad

Requires the fixed parameters:

Pi SolarConstant

Requires the factor sequences:

SolarTimeAngle EarthSunDistance SolarDeclination SunsetHourAngle

Calculates the flux sequence:

ExtraterrestrialRadiation

Basic equation for daily simulation steps (Allen et al. (1998), equation 21):

\(ExternalTerrestrialRadiation = \frac{SolarConstant}{Pi} \cdot EarthSunDistance \cdot ( SunsetHourAngle \cdot sin(LatitudeRad) \cdot sin(SolarDeclination) + cos(LatitudeRad) \cdot cos(SolarDeclination) \cdot sin(SunsetHourAngle))\)

Basic equation for (sub)hourly steps (Allen et al. (1998), eq. 28 to 30):

\(ExternalTerrestrialRadiation = \frac{12 \cdot SolarConstant}{Pi} \cdot EarthSunDistance \cdot \Big( (\omega_2 - \omega_1) \cdot sin(LatitudeRad) \cdot sin(SolarDeclination) + cos(LatitudeRad) \cdot cos(SolarDeclination) \cdot (sin(\omega_2) - sin(\omega_1)) \Big)\)

\(\omega_1 = SolarTimeAngle - Pi \cdot Days\)

\(\omega_2 = SolarTimeAngle + Pi \cdot Days\)

Examples:

The following calculation agrees with example 8 of Allen et al. (1998) for daily time steps:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> derived.days(1)
>>> derived.latituderad(-0.35)
>>> factors.earthsundistance = 0.985
>>> factors.solardeclination = 0.12
>>> factors.sunsethourangle = 1.527
>>> model.calc_extraterrestrialradiation_v1()
>>> fluxes.extraterrestrialradiation
extraterrestrialradiation(372.473355)

The following calculation repeats the above example for an hourly simulation time step, still covering the whole day:

>>> import numpy
>>> longitude(-20)
>>> derived.utclongitude(-20)
>>> derived.days(1/24)
>>> derived.doy.shape = 24
>>> derived.doy(246)
>>> derived.sct.shape = 24
>>> derived.sct = numpy.linspace(0.5, 23.5, 24)
>>> sum_ = 0.0
>>> from hydpy import round_
>>> for hour in range(24):
...     model.idx_sim = hour
...     model.calc_solartimeangle_v1()
...     model.calc_extraterrestrialradiation_v1()
...     print(hour, end=": ")
...     round_(fluxes.extraterrestrialradiation.value)
...     sum_ += fluxes.extraterrestrialradiation
0: 0.0
1: 0.0
2: 0.0
3: 0.0
4: 0.0
5: 0.0
6: 116.280258
7: 431.467206
8: 713.483659
9: 943.11066
10: 1104.699509
11: 1187.238194
12: 1185.101838
13: 1098.436032
14: 933.146907
15: 700.498642
16: 416.345834
17: 100.053027
18: 0.0
19: 0.0
20: 0.0
21: 0.0
22: 0.0
23: 0.0

Note that, even with identical values of the local longitude (Longitude) and the one of the time zone (UTCLongitude), the calculated radiation values are not symmetrical due to the eccentricity of the Earth”s orbit (see solar time).

There is a slight deviation between the directly calculated daily value and the mean of the hourly values:

>>> round_(sum_/24)
372.077574

For sub-daily simulation time steps, results are most accurate for the shortest step size. On the other hand, they can be (extremely) inaccurate for timesteps between one hour and one day. We demonstrate this by comparing the mean sub-daily values of different step sizes with the directly calculated daily value (note the apparent total fail of method Calc_ExtraterrestrialRadiation_V1 for a step size of 720 minutes):

>>> for minutes in [1, 5, 15, 30, 60, 90, 120, 144, 160,
...                 180, 240, 288, 360, 480, 720, 1440]:
...     derived.days(minutes/60/24)
...     nmb = int(1440/minutes)
...     derived.doy.shape = nmb
...     derived.doy(246)
...     derived.sct.shape = nmb
...     derived.sct = numpy.linspace(minutes/60/2, 24-minutes/60/2, nmb)
...     sum_ = 0.0
...     for idx in range(nmb):
...         model.idx_sim = idx
...         model.calc_solartimeangle_v1()
...         model.calc_extraterrestrialradiation_v1()
...         sum_ += fluxes.extraterrestrialradiation
...     print(minutes, end=": ")
...     round_(sum_/24 - 372.473355)
1: -0.000626
5: -0.008549
15: -0.100092
30: -0.395781
60: -0.395781
90: -0.395781
120: -0.395781
144: -14.43193
160: -9.539017
180: -0.395781
240: -44.735212
288: -25.486399
360: -0.395781
480: -44.735212
720: -372.473355
1440: -356.953632
class hydpy.models.meteo.meteo_model.Calc_ExtraterrestrialRadiation_V2[source]

Bases: Method

Calculate the amount of extraterrestrial radiation according to LEG (2020), based on Thompson et al. (1981).

Requires the derived parameter:

LatitudeRad

Requires the fixed parameters:

Pi SolarConstant

Requires the factor sequences:

SolarDeclination EarthSunDistance TimeOfSunrise TimeOfSunset

Calculates the flux sequence:

ExtraterrestrialRadiation

Basic equation:

\(ExternalTerrestrialRadiation = \frac{SolarConstant \cdot EarthSunDistance \cdot ( SunsetHourAngle \cdot sin(LatitudeRad) \cdot sin(SolarDeclination) + cos(LatitudeRad) \cdot cos(SolarDeclination) \cdot sin(SunsetHourAngle) )}{PI}\)

\(SunsetHourAngle = (TimeOfSunset - TimeOfSunset) \cdot Pi / 24\)

Examples:

First, we calculate the extraterrestrial radiation for a latitude of approximately 52°N:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> derived.latituderad(0.9)

The sunshine duration varies between seven hours at the winter solstice and 16 hours at summer solstice, corresponding to mean daily radiations of 70 and 514 W/m².

>>> factors.solardeclination = -0.41
>>> factors.earthsundistance = 0.97
>>> factors.timeofsunrise = 8.4
>>> factors.timeofsunset = 15.6
>>> model.calc_extraterrestrialradiation_v2()
>>> fluxes.extraterrestrialradiation
extraterrestrialradiation(70.458396)
>>> factors.solardeclination = 0.41
>>> factors.earthsundistance = 1.03
>>> factors.timeofsunrise = 4.0
>>> factors.timeofsunset = 20.0
>>> model.calc_extraterrestrialradiation_v2()
>>> fluxes.extraterrestrialradiation
extraterrestrialradiation(514.367012)
class hydpy.models.meteo.meteo_model.Calc_PossibleSunshineDuration_V1[source]

Bases: Method

Calculate the astronomically possible sunshine duration according to Allen et al. (1998).

Requires the derived parameters:

Days Hours

Requires the fixed parameter:

Pi

Requires the factor sequences:

SolarTimeAngle SunsetHourAngle

Calculates the factor sequence:

PossibleSunshineDuration

Basic equation for daily timesteps Allen et al. (1998) (equation 34):

\(PossibleSunshineDuration = 24 / Pi \cdot SunsetHourAngle\)

Basic equation for (sub)hourly timesteps:

\(PossibleSunshineDuration = min(max(12 / Pi \cdot (SunsetHourAngle - \tau), 0), Hours)\)

\[\begin{split}\tau = \begin{cases} -SolarTimeAngle - Pi \cdot Days &|\ SolarTimeAngle \leq 0 \\ SolarTimeAngle - Pi \cdot Days &|\ SolarTimeAngle > 0 \end{cases}\end{split}\]

Examples:

The following calculation agrees with example 9 of Allen et al. (1998):

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> derived.days(1)
>>> derived.hours(24)
>>> factors.sunsethourangle(1.527)
>>> model.calc_possiblesunshineduration_v1()
>>> factors.possiblesunshineduration
possiblesunshineduration(11.665421)

The following calculation repeats the above example for an hourly simulation time step, still covering the whole day. Therefore the ratio is only calculated during sunrise and sunset and set to 1 at daytime and 0 at nighttime:

>>> from hydpy import round_
>>> import numpy
>>> derived.days(1/24)
>>> derived.hours(1)
>>> solartimeangles = numpy.linspace(-3.004157, 3.017229, 24)
>>> sum_ = 0.
>>> for hour, solartimeangle in enumerate(solartimeangles):
...     factors.solartimeangle = solartimeangle
...     model.calc_possiblesunshineduration_v1()
...     print(hour, end=": ")  
...     round_(factors.possiblesunshineduration.value)
...     sum_ += factors.possiblesunshineduration.value
0: 0.0
...
5: 0.0
6: 0.857676
7: 1.0
...
16: 1.0
17: 0.807745
18: 0.0
...
23: 0.0

The sum of the hourly sunshine durations equals the one-step calculation result:

>>> round_(sum_)
11.665421
class hydpy.models.meteo.meteo_model.Calc_PossibleSunshineDuration_V2[source]

Bases: Method

Calculate the astronomically possible sunshine duration according to LEG (2020).

Requires the derived parameters:

SCT Hours

Requires the factor sequences:

TimeOfSunrise TimeOfSunset

Calculates the factor sequence:

PossibleSunshineDuration

Basic equation:

\(PossibleSunshineDuration = max \bigl( max(SCT-Hours/2, TimeOfSunrise) - min(SCT + Hours / 2, TimeOfSunset), 0 \bigr)\)

Examples:

We focus on winter conditions with a relatively short possible sunshine duration:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> factors.timeofsunrise(8.4)
>>> factors.timeofsunset(15.6)

We start with a daily simulation time step. The possible sunshine duration is, as expected, the span between sunrise and sunset:

>>> from hydpy import pub, round_
>>> pub.timegrids = "2000-01-01", "2000-01-02", "1d"
>>> derived.sct.update()
>>> derived.hours.update()
>>> model.calc_possiblesunshineduration_v2()
>>> factors.possiblesunshineduration
possiblesunshineduration(7.2)

The following example calculates the possible hourly sunshine durations of the same day:

>>> pub.timegrids = "2000-01-01", "2000-01-02", "1h"
>>> derived.sct.update()
>>> derived.hours.update()
>>> sum_ = 0.0
>>> for idx in range(24):
...     model.idx_sim = idx
...     model.calc_possiblesunshineduration_v2()
...     print(idx+1, end=": ")   
...     round_(factors.possiblesunshineduration.value)
...     sum_ += factors.possiblesunshineduration.value
1: 0.0
...
9: 0.6
10: 1.0
...
15: 1.0
16: 0.6
17: 0.0
...
24: 0.0

The sum of the possible hourly sunshine durations equals the daily possible sunshine, of course:

>>> round_(sum_)
7.2
class hydpy.models.meteo.meteo_model.Calc_DailyPossibleSunshineDuration_V1[source]

Bases: Method

Calculate the astronomically possible daily sunshine duration.

Requires the factor sequences:

TimeOfSunrise TimeOfSunset

Calculates the factor sequence:

DailyPossibleSunshineDuration

Basic equation:

\(DailyPossibleSunshineDuration = TimeOfSunset - TimeOfSunrise\)

Examples:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> factors.timeofsunrise(8.4)
>>> factors.timeofsunset(15.6)
>>> model.calc_dailypossiblesunshineduration()
>>> factors.dailypossiblesunshineduration
dailypossiblesunshineduration(7.2)
class hydpy.models.meteo.meteo_model.Update_LoggedSunshineDuration_V1[source]

Bases: Method

Log the sunshine duration values of the last 24 hours.

Requires the derived parameter:

NmbLogEntries

Requires the input sequence:

SunshineDuration

Updates the log sequence:

LoggedSunshineDuration

Example:

The following example shows that each new method call successively moves the three memorised values to the right and stores the respective new value on the most left position:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> derived.nmblogentries(3)
>>> logs.loggedsunshineduration.shape = 3
>>> logs.loggedsunshineduration = 0.0
>>> from hydpy import UnitTest
>>> test = UnitTest(model,
...                 model.update_loggedsunshineduration_v1,
...                 last_example=4,
...                 parseqs=(inputs.sunshineduration,
...                          logs.loggedsunshineduration))
>>> test.nexts.sunshineduration = 1.0, 3.0, 2.0, 4.0
>>> del test.inits.loggedsunshineduration
>>> test()
| ex. | sunshineduration |           loggedsunshineduration |
-------------------------------------------------------------
|   1 |              1.0 | 1.0  0.0                     0.0 |
|   2 |              3.0 | 3.0  1.0                     0.0 |
|   3 |              2.0 | 2.0  3.0                     1.0 |
|   4 |              4.0 | 4.0  2.0                     3.0 |
class hydpy.models.meteo.meteo_model.Update_LoggedGlobalRadiation_V1[source]

Bases: Method

Log the global radiation values of the last 24 hours.

Requires the derived parameter:

NmbLogEntries

Requires the input sequence:

GlobalRadiation

Updates the log sequence:

LoggedGlobalRadiation

Example:

The following example shows that each new method call successively moves the three memorised values to the right and stores the respective new value on the most left position:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> derived.nmblogentries(3)
>>> logs.loggedglobalradiation.shape = 3
>>> logs.loggedglobalradiation = 0.0
>>> from hydpy import UnitTest
>>> test = UnitTest(model,
...                 model.update_loggedglobalradiation_v1,
...                 last_example=4,
...                 parseqs=(inputs.globalradiation,
...                          logs.loggedglobalradiation))
>>> test.nexts.globalradiation = 1.0, 3.0, 2.0, 4.0
>>> del test.inits.loggedglobalradiation
>>> test()
| ex. | globalradiation |           loggedglobalradiation |
-----------------------------------------------------------
|   1 |             1.0 | 1.0  0.0                    0.0 |
|   2 |             3.0 | 3.0  1.0                    0.0 |
|   3 |             2.0 | 2.0  3.0                    1.0 |
|   4 |             4.0 | 4.0  2.0                    3.0 |
class hydpy.models.meteo.meteo_model.Calc_DailySunshineDuration_V1[source]

Bases: Method

Calculate the sunshine duration sum of the last 24 hours.

Requires the derived parameter:

NmbLogEntries

Requires the log sequence:

LoggedSunshineDuration

Updates the factor sequence:

DailySunshineDuration

Example:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> derived.nmblogentries(3)
>>> logs.loggedsunshineduration.shape = 3
>>> logs.loggedsunshineduration = 1.0, 5.0, 3.0
>>> model.calc_dailysunshineduration_v1()
>>> factors.dailysunshineduration
dailysunshineduration(9.0)
class hydpy.models.meteo.meteo_model.Calc_DailyGlobalRadiation_V2[source]

Bases: Method

Calculate the global radiation sum of the last 24 hours.

Requires the derived parameter:

NmbLogEntries

Requires the log sequence:

LoggedGlobalRadiation

Updates the flux sequence:

DailyGlobalRadiation

Example:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> derived.nmblogentries(3)
>>> logs.loggedglobalradiation.shape = 3
>>> logs.loggedglobalradiation = 100.0, 800.0, 600.0
>>> model.calc_dailyglobalradiation_v2()
>>> fluxes.dailyglobalradiation
dailyglobalradiation(500.0)
class hydpy.models.meteo.meteo_model.Calc_PortionDailyRadiation_V1[source]

Bases: Method

Calculate the relative sum of radiation according to LEG (2020).

Requires the derived parameters:

SCT Hours

Requires the fixed parameter:

Pi

Requires the factor sequences:

TimeOfSunrise TimeOfSunset

Calculates the factor sequence:

PortionDailyRadiation

Basic equations:

\[SP = S_P^*(SCT + Hours/2) - S_P^*(SCT - Hours/2)\]
\[\begin{split}S_P^*(t) = \begin{cases} 0 &|\ TL_P(t) \leq 0 \\ 50 - 50 \cdot cos\bigl(1.8 \cdot TL_P(t)\bigr) - 3.4 \cdot sin\bigl(3.6 \cdot TL_P(t)\bigr)^2 &|\ 0 < TL_P(t) \leq 50 \cdot \frac{2 \cdot Pi}{360} \\ 50 - 50 \cdot cos\bigl(1.8 \cdot TL_P(t)\bigr) + 3.4 \cdot sin\bigl(3.6 \cdot TL_P(t)\bigr)^2 &|\ 50 \cdot \frac{2 \cdot Pi}{360} < TL_P(t) < 100 \cdot \frac{2 \cdot Pi}{360} \\ 100 &|\ 100 \cdot \frac{2 \cdot Pi}{360} \leq TL_P(t) \end{cases}\end{split}\]
\[TL_P(t) = 100 \cdot \frac{2 \cdot Pi}{360} \cdot \frac{t - TimeOfSunrise}{TimeOfSunset - TimeOfSunrise}\]

Examples:

We focus on winter conditions with a relatively short possible sunshine duration:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> factors.timeofsunrise(8.4)
>>> factors.timeofsunset(15.6)

We start with an hourly simulation time step. The relative radiation sum is, as expected, zero before sunrise and after sunset. In between, it reaches its maximum around noon:

>>> from hydpy import pub, round_
>>> pub.timegrids = "2000-01-01", "2000-01-02", "1h"
>>> derived.sct.update()
>>> derived.hours.update()
>>> for idx in range(7, 17):
...     model.idx_sim = idx
...     model.calc_portiondailyradiation_v1()
...     print(idx+1, end=": ")
...     round_(factors.portiondailyradiation.value)
8: 0.0
9: 0.853709
10: 7.546592
11: 18.473585
12: 23.126115
13: 23.126115
14: 18.473585
15: 7.546592
16: 0.853709
17: 0.0

The following examples show how method Calc_PortionDailyRadiation_V1 works for time step sizes longer than one hour:

>>> pub.timegrids = "2000-01-01", "2000-01-02", "1d"
>>> derived.sct.update()
>>> derived.hours.update()
>>> model.idx_sim = 0
>>> model.calc_portiondailyradiation_v1()
>>> factors.portiondailyradiation
portiondailyradiation(100.0)
>>> pub.timegrids = "2000-01-01", "2000-01-02", "6h"
>>> derived.sct.update()
>>> derived.hours.update()
>>> for idx in range(4):
...     model.idx_sim = idx
...     model.calc_portiondailyradiation_v1()
...     print((idx+1)*6, end=": ")
...     round_(factors.portiondailyradiation.value)
6: 0.0
12: 50.0
18: 50.0
24: 0.0
>>> pub.timegrids = "2000-01-01", "2000-01-02", "3h"
>>> derived.sct.update()
>>> derived.hours.update()
>>> for idx in range(8):
...     model.idx_sim = idx
...     model.calc_portiondailyradiation_v1()
...     print((idx+1)*3, end=": ")
...     round_(factors.portiondailyradiation.value)
3: 0.0
6: 0.0
9: 0.853709
12: 49.146291
15: 49.146291
18: 0.853709
21: 0.0
24: 0.0

Often, method Calc_PortionDailyRadiation_V1 calculates a small but unrealistic “bump” around noon (for example, the relative radiation is slightly smaller between 11:30 and 12:00 than it is between 11:00 and 11:30):

>>> pub.timegrids = "2000-01-01", "2000-01-02", "30m"
>>> derived.sct.update()
>>> derived.hours.update()
>>> for idx in range(15, 33):
...     model.idx_sim = idx
...     model.calc_portiondailyradiation_v1()
...     print((idx+1)/2, end=": ")
...     round_(factors.portiondailyradiation.value)
8.0: 0.0
8.5: 0.021762
9.0: 0.831947
9.5: 2.514315
10.0: 5.032276
10.5: 7.989385
11.0: 10.4842
11.5: 11.696873
12.0: 11.429242
12.5: 11.429242
13.0: 11.696873
13.5: 10.4842
14.0: 7.989385
14.5: 5.032276
15.0: 2.514315
15.5: 0.831947
16.0: 0.021762
16.5: 0.0
class hydpy.models.meteo.meteo_model.Return_DailyGlobalRadiation_V1[source]

Bases: Method

Calculate and return the daily global radiation according to LEG (2020).

Required by the methods:

Calc_DailyGlobalRadiation_V1 Calc_UnadjustedGlobalRadiation_V1

Requires the control parameters:

AngstromConstant AngstromFactor AngstromAlternative

Requires the derived parameters:

MOY Days

Requires the flux sequence:

ExtraterrestrialRadiation

Additional requirements:

idx_sim

Basic equation:
\[\begin{split}ExtraterrestrialRadiation \cdot \begin{cases} AngstromConstant + AngstromFactor \cdot \frac{sunshineduration}{possiblesunshineduration} &|\ sunshineduration > 0 \;\; \lor \;\; Days < 1 \\ AngstromAlternative &|\ sunshineduration = 0 \;\; \land \;\; Days \geq 1 \end{cases}\end{split}\]

Example:

You can define month-specific Angstrom coefficients to reflect the annual variability in the relationship between sunshine duration and global radiation. First, we demonstrate this on a daily timestep basis:

>>> from hydpy import pub, round_
>>> pub.timegrids = "2000-01-30", "2000-02-03", "1d"
>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> derived.moy.update()
>>> derived.days.update()
>>> angstromconstant.jan = 0.1
>>> angstromfactor.jan = 0.5
>>> angstromalternative.jan = 0.2
>>> angstromconstant.feb = 0.2
>>> angstromfactor.feb = 0.6
>>> angstromalternative.feb = 0.3
>>> fluxes.extraterrestrialradiation = 340.0
>>> model.idx_sim = 1
>>> round_(model.return_dailyglobalradiation_v1(0.6, 1.0))
136.0
>>> model.idx_sim = 2
>>> round_(model.return_dailyglobalradiation_v1(0.6, 1.0))
190.4

If the possible sunshine duration is zero, we generally set global radiation to zero (even if the actual sunshine duration is larger than zero, which might occur as a result of inconsistencies between measured and calculated input data):

>>> round_(model.return_dailyglobalradiation_v1(0.6, 0.0))
0.0

When actual sunshine is zero, the alternative Ångström coefficient applies:

>>> model.idx_sim = 1
>>> round_(model.return_dailyglobalradiation_v1(0.0, 1.0))
68.0
>>> model.idx_sim = 2
>>> round_(model.return_dailyglobalradiation_v1(0.0, 1.0))
102.0

All of the examples and explanations above hold for short simulation timesteps, except that AngstromAlternative never replaces AngstromConstant:

>>> pub.timegrids = "2000-01-30", "2000-02-03", "1h"
>>> derived.moy.update()
>>> derived.days.update()
>>> model.idx_sim = 1
>>> round_(model.return_dailyglobalradiation_v1(0.0, 1.0))
34.0
class hydpy.models.meteo.meteo_model.Calc_ClearSkySolarRadiation_V1[source]

Bases: Method

Calculate the clear sky solar radiation according to Allen et al. (1998).

Requires the control parameters:

AngstromConstant AngstromFactor

Requires the derived parameter:

MOY

Requires the flux sequence:

ExtraterrestrialRadiation

Calculates the flux sequence:

ClearSkySolarRadiation

Basic equation (:cite:t`ref-Allen1998`, eq. 35):

\(ClearSkySolarRadiation = ExtraterrestrialRadiation \cdot (AngstromConstant + AngstromFactor)\)

Example:

We use the Ångström coefficients (a=0.19, b=0.55) recommended for Germany by DVWK-M 504 ATV-DVWK (2002) for January and the default values (a=0.25, b=0.5) for February:

>>> from hydpy import pub
>>> pub.timegrids = "2000-01-30", "2000-02-03", "1d"
>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> angstromconstant.jan = 0.19
>>> angstromfactor.jan = 0.55
>>> angstromconstant.feb = 0.25
>>> angstromfactor.feb = 0.5
>>> derived.moy.update()
>>> fluxes.extraterrestrialradiation = 200.0
>>> model.idx_sim = 1
>>> model.calc_clearskysolarradiation_v1()
>>> fluxes.clearskysolarradiation
clearskysolarradiation(148.0)
>>> model.idx_sim = 2
>>> model.calc_clearskysolarradiation_v1()
>>> fluxes.clearskysolarradiation
clearskysolarradiation(150.0)
class hydpy.models.meteo.meteo_model.Calc_GlobalRadiation_V1[source]

Bases: Method

Calculate the global radiation according to Allen et al. (1998).

Requires the control parameters:

AngstromConstant AngstromFactor

Requires the derived parameter:

MOY

Requires the input sequence:

SunshineDuration

Requires the factor sequence:

PossibleSunshineDuration

Requires the flux sequence:

ExtraterrestrialRadiation

Calculates the flux sequence:

GlobalRadiation

Basic equation (Allen et al. (1998), equation 35):

\(GlobalRadiation = ExtraterrestrialRadiation \cdot (AngstromConstant + AngstromFactor \cdot SunshineDuration / PossibleSunshineDuration)\)

Example:

We use the Ångström coefficients (a=0.19, b=0.55) recommended for Germany by DVWK-M 504 ATV-DVWK (2002) for January and the default values (a=0.25, b=0.5) for February:

>>> from hydpy import pub, round_
>>> pub.timegrids = "2000-01-30", "2000-02-03", "1d"
>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> angstromconstant.jan = 0.19
>>> angstromfactor.jan = 0.55
>>> angstromconstant.feb = 0.25
>>> angstromfactor.feb = 0.5
>>> derived.moy.update()
>>> inputs.sunshineduration = 12.0
>>> factors.possiblesunshineduration = 14.0
>>> fluxes.extraterrestrialradiation = 200.0
>>> model.idx_sim = 1
>>> model.calc_globalradiation_v1()
>>> fluxes.globalradiation
globalradiation(132.285714)
>>> model.idx_sim = 2
>>> model.calc_globalradiation_v1()
>>> fluxes.globalradiation
globalradiation(135.714286)

For zero possible sunshine durations, Calc_GlobalRadiation_V1 sets GlobalRadiation to zero:

>>> factors.possiblesunshineduration = 0.0
>>> model.calc_globalradiation_v1()
>>> fluxes.globalradiation
globalradiation(0.0)
class hydpy.models.meteo.meteo_model.Calc_UnadjustedGlobalRadiation_V1[source]

Bases: Method

Calculate the unadjusted global radiation according to LEG (2020).

Required submethod:

Return_DailyGlobalRadiation_V1

Requires the control parameters:

AngstromConstant AngstromFactor AngstromAlternative

Requires the derived parameters:

NmbLogEntries MOY Days

Requires the input sequence:

SunshineDuration

Requires the factor sequences:

PossibleSunshineDuration DailySunshineDuration DailyPossibleSunshineDuration PortionDailyRadiation

Requires the flux sequence:

ExtraterrestrialRadiation

Calculates the flux sequence:

UnadjustedGlobalRadiation

Additional requirements:

idx_sim

Basic equation:
\[\begin{split}UnadjustedGlobalRadiation = NmbLogEntries \cdot \frac{SP}{100} \cdot \begin{cases} Return\_DailyGlobalRadiation\_V1( SunshineDuration, PossibleSunshineDuration) &|\ PossibleSunshineDuration > 0 \\ Return\_DailyGlobalRadiation\_V1( DailySunshineDuration, DailyPossibleSunshineDuration) &|\ PossibleSunshineDuration = 0 \end{cases}\end{split}\]

Examples:

Method Calc_UnadjustedGlobalRadiation_V1 uses the actual value of PortionDailyRadiation and method Return_DailyGlobalRadiation_V1 to calculate global radiation according to the current values of SunshineDuration and PossibleSunshineDuration:

>>> from hydpy import pub
>>> pub.timegrids = "2000-01-31", "2000-02-02", "6h"
>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> derived.nmblogentries.update()
>>> derived.moy.update()
>>> derived.days.update()
>>> angstromconstant.jan = 0.1
>>> angstromfactor.jan = 0.5
>>> angstromalternative.jan = 0.2
>>> inputs.sunshineduration = 0.6
>>> factors.possiblesunshineduration = 1.0
>>> fluxes.extraterrestrialradiation = 340.0
>>> factors.portiondailyradiation = 50.0
>>> model.idx_sim = 3
>>> model.calc_unadjustedglobalradiation_v1()
>>> fluxes.unadjustedglobalradiation
unadjustedglobalradiation(272.0)

During nighttime periods, the value of PossibleSunshineDuration is zero. Then, Calc_GlobalRadiation_V1 uses the values of DailySunshineDuration and DailyPossibleSunshineDuration as surrogates:

>>> factors.possiblesunshineduration = 0.0
>>> factors.dailysunshineduration = 4.0
>>> factors.dailypossiblesunshineduration = 10.0
>>> model.calc_unadjustedglobalradiation_v1()
>>> fluxes.unadjustedglobalradiation
unadjustedglobalradiation(204.0)
class hydpy.models.meteo.meteo_model.Adjust_ClearSkySolarRadiation_V1[source]

Bases: Method

Use the portion of the daily radiation sum to adjust the clear sky solar radiation’s daily average to the current simulation step.

Requires the derived parameter:

NmbLogEntries

Requires the factor sequence:

PortionDailyRadiation

Updates the flux sequence:

ClearSkySolarRadiation

Basic equation:
\[\begin{split}C_{new} = N \cdot P / 100 \cdot C_{old} \\ \\ C = ClearSkySolarRadiation \\ N = NmbLogEntries \\ P = PortionDailyRadiation\end{split}\]

Example:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> derived.nmblogentries(4)
>>> factors.portiondailyradiation = 10.0
>>> fluxes.clearskysolarradiation = 200.0
>>> model.adjust_clearskysolarradiation_v1()
>>> fluxes.clearskysolarradiation
clearskysolarradiation(80.0)
class hydpy.models.meteo.meteo_model.Update_LoggedUnadjustedGlobalRadiation_V1[source]

Bases: Method

Log the unadjusted global radiation values of the last 24 hours.

Requires the derived parameter:

NmbLogEntries

Requires the flux sequence:

UnadjustedGlobalRadiation

Updates the log sequence:

LoggedUnadjustedGlobalRadiation

Example:

The following example shows that each new method call successively moves the three memorised values to the right and stores the respective new value on the most left position:

>>> from hydpy.models.meteo import *
>>> simulationstep("8h")
>>> parameterstep()
>>> derived.nmblogentries.update()
>>> logs.loggedunadjustedglobalradiation = 0.0
>>> from hydpy import UnitTest
>>> test = UnitTest(model,
...                 model.update_loggedunadjustedglobalradiation_v1,
...                 last_example=4,
...                 parseqs=(fluxes.unadjustedglobalradiation,
...                          logs.loggedunadjustedglobalradiation))
>>> test.nexts.unadjustedglobalradiation = 1.0, 3.0, 2.0, 4.0
>>> del test.inits.loggedunadjustedglobalradiation
>>> test()
| ex. | unadjustedglobalradiation |           loggedunadjustedglobalradiation |
-------------------------------------------------------------------------------
|   1 |                       1.0 | 1.0  0.0                              0.0 |
|   2 |                       3.0 | 3.0  1.0                              0.0 |
|   3 |                       2.0 | 2.0  3.0                              1.0 |
|   4 |                       4.0 | 4.0  2.0                              3.0 |
class hydpy.models.meteo.meteo_model.Calc_DailyGlobalRadiation_V1[source]

Bases: Method

Calculate the daily global radiation.

Required submethod:

Return_DailyGlobalRadiation_V1

Requires the control parameters:

AngstromConstant AngstromFactor AngstromAlternative

Requires the derived parameters:

MOY Days

Requires the factor sequences:

DailySunshineDuration DailyPossibleSunshineDuration

Requires the flux sequence:

ExtraterrestrialRadiation

Updates the flux sequence:

DailyGlobalRadiation

Additional requirements:

idx_sim

Basic equation:

\(DailyGlobalRadiation = Return\_DailyGlobalRadiation\_V1( DailySunshineDuration, DailyPossibleSunshineDuration)\)

Example:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> from hydpy import pub
>>> angstromconstant.jan = 0.1
>>> angstromfactor.jan = 0.5
>>> angstromconstant.feb = 0.2
>>> angstromfactor.feb = 0.6

We set the extraterrestrial radiation to 200 W/m² and the possible sunshine duration to 12 hours:

>>> fluxes.extraterrestrialradiation = 200.0
>>> factors.dailypossiblesunshineduration = 12.0

We define a daily simulation step size and update the relevant derived parameters:

>>> pub.timegrids = "2000-01-30", "2000-02-03", "1d"
>>> derived.moy.update()

Applying the Ångström coefficients for January and February on the defined extraterrestrial radiation and a sunshine duration of 7.2 hours results in a daily global radiation average of 80 and 112 W/m², respectively:

>>> model.idx_sim = 1
>>> factors.dailysunshineduration = 7.2
>>> model.calc_dailyglobalradiation_v1()
>>> fluxes.dailyglobalradiation
dailyglobalradiation(80.0)
>>> model.idx_sim = 2
>>> model.calc_dailyglobalradiation_v1()
>>> fluxes.dailyglobalradiation
dailyglobalradiation(112.0)

Finally, we demonstrate for January that method Calc_DailyGlobalRadiation_V1 calculates the same values for an hourly simulation time step, as long as the daily sum of sunshine duration remains identical:

>>> pub.timegrids = "2000-01-30", "2000-02-03", "1h"
>>> derived.moy.update()

The actual simulation step starts at 11 o’clock and ends at 12 o’clock:

>>> model.idx_sim = pub.timegrids.init["2000-01-31 11:00"]
>>> factors.dailysunshineduration = 7.2
>>> model.calc_dailyglobalradiation_v1()
>>> fluxes.dailyglobalradiation
dailyglobalradiation(80.0)
class hydpy.models.meteo.meteo_model.Return_SunshineDuration_V1[source]

Bases: Method

Calculate the sunshine duration reversely to Return_DailyGlobalRadiation_V1 and return it.

Required by the methods:

Calc_DailySunshineDuration_V2 Calc_UnadjustedSunshineDuration_V1

Requires the control parameters:

AngstromConstant AngstromFactor

Requires the derived parameter:

MOY

Basic equation:

\(\frac{possiblesunshineduration}{AngstromFactor} \cdot \left( \frac{globalradiation}{extraterrestrialradiation} - AngstromConstant \right)\)

Example:

Essentially, Return_SunshineDuration_V1 tries to invert Return_DailyGlobalRadiation_V1 and thus also relies on the Ångström formula. Instead of estimating global radiation from sunshine duration, it estimates sunshine duration from global radiation. We demonstrate this by repeating the first examples of Calc_GlobalRadiation_V1 “backwards”:

>>> from hydpy import pub, round_
>>> pub.timegrids = "2000-01-30", "2000-02-03", "1d"
>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> derived.moy.update()
>>> angstromconstant.jan = 0.1
>>> angstromfactor.jan = 0.5
>>> angstromalternative.jan = 0.2
>>> angstromconstant.feb = 0.2
>>> angstromfactor.feb = 0.6
>>> angstromalternative.feb = 0.3
>>> model.idx_sim = 1
>>> round_(model.return_sunshineduration_v1(136.0, 340.0, 1.0))
0.6
>>> model.idx_sim = 2
>>> round_(model.return_sunshineduration_v1(190.4, 340.0, 1.0))
0.6

In contrast to Return_DailyGlobalRadiation_V1, Return_SunshineDuration_V1 never applies AngstromAlternative instead of AngstromConstant. Hence, as in the following repeated examples, Return_SunshineDuration_V1 might invert Return_DailyGlobalRadiation_V1 only roughly during periods with little sunshine:

>>> model.idx_sim = 1
>>> round_(model.return_sunshineduration_v1(68.0, 340.0, 1.0))
0.2
>>> model.idx_sim = 2
>>> round_(model.return_sunshineduration_v1(102.0, 340.0, 1.0))
0.166667

We must consider additional corner cases. The first one deals with a potential zero division during nighttime. If extraterrestrial radiation is zero, Return_SunshineDuration_V1 takes the astronomically possible sunshine duration (which should ideally also be zero) as the actual sunshine duration:

>>> model.idx_sim = 1
>>> round_(model.return_sunshineduration_v1(136.0, 0.0, 0.00001))
0.00001

Measured global radiation smaller than estimated diffusive radiation would result in negative sunshine durations when following the Ångström formula strictly. Additionally, measured global radiation larger than estimated clear-sky radiation would result in sunshine durations larger than the astronomically possible sunshine duration. The following example shows that method Return_SunshineDuration_V1 prevents such inconsistencies by trimming the estimated sunshine duration when necessary:

>>> for globrad in (0.0, 34.0, 35.0, 136.0, 203.0, 204.0, 340.0):
...     sundur = model.return_sunshineduration_v1(globrad, 340.0, 1.0)
...     round_((globrad, sundur))
0.0, 0.0
34.0, 0.0
35.0, 0.005882
136.0, 0.6
203.0, 0.994118
204.0, 1.0
340.0, 1.0
class hydpy.models.meteo.meteo_model.Calc_UnadjustedSunshineDuration_V1[source]

Bases: Method

Calculate the unadjusted sunshine duration reversely to Calc_UnadjustedGlobalRadiation_V1.

Required submethod:

Return_SunshineDuration_V1

Requires the control parameters:

AngstromConstant AngstromFactor

Requires the derived parameters:

MOY NmbLogEntries

Requires the input sequence:

GlobalRadiation

Requires the factor sequences:

PossibleSunshineDuration PortionDailyRadiation

Requires the flux sequence:

ExtraterrestrialRadiation

Calculates the factor sequence:

UnadjustedSunshineDuration

Additional requirements:

idx_sim

Basic equation:

\(UnadjustedSunshineDuration = Return\_SunshineDuration \left( GlobalRadiation, NmbLogEntries \cdot \frac{PortionDailyRadiation}{100} \cdot ExtraterrestrialRadiation, PossibleSunshineDuration \right)\)

Example:

Method Calc_UnadjustedSunshineDuration_V1 relies on Return_SunshineDuration_V1 and thus has the same limitation regarding periods with little sunshine. See its documentation for further information. Here, we only demonstrate the proper passing of GlobalRadiation, ExtraterrestrialRadiation (eventually reduced by PortionDailyRadiation) and PossibleSunshineDuration:

>>> from hydpy import pub
>>> pub.timegrids = "2000-01-31", "2000-02-02", "6h"
>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> derived.nmblogentries.update()
>>> derived.moy.update()
>>> angstromconstant.jan = 0.1
>>> angstromfactor.jan = 0.5
>>> inputs.globalradiation = 272.0
>>> factors.possiblesunshineduration = 1.0
>>> factors.portiondailyradiation = 50.0
>>> fluxes.extraterrestrialradiation = 340.0
>>> model.idx_sim = 3
>>> model.calc_unadjustedsunshineduration_v1()
>>> factors.unadjustedsunshineduration
unadjustedsunshineduration(0.6)
class hydpy.models.meteo.meteo_model.Calc_GlobalRadiation_V2[source]

Bases: Method

Adjust the current global radiation to the daily global radiation according to

LEG (2020).

Requires the derived parameter:

NmbLogEntries

Requires the flux sequences:

UnadjustedGlobalRadiation DailyGlobalRadiation

Requires the log sequence:

LoggedUnadjustedGlobalRadiation

Calculates the flux sequence:

GlobalRadiation

Additional requirements:

idx_sim

Basic equation:

\(GlobalRadiation = UnadjustedGlobalRadiation \cdot \frac{DailyGlobalRadiation}{\sum LoggedUnadjustedGlobalRadiation / NmbLogEntries}\)

Examples:

The purpose of method Calc_GlobalRadiation_V2 is to adjust hourly global radiation values (or those of other short simulation time steps) so that their mean over the last 24 hours equals the global radiation value directly calculated with the relative sunshine duration over the last 24 hours. We try to explain this somewhat counterintuitive approach by extending the documentation examples on method Calc_DailyGlobalRadiation_V1.

Again, we start with a daily simulation time step:

>>> from hydpy.models.meteo import *
>>> simulationstep("1d")
>>> parameterstep()
>>> derived.nmblogentries.update()

For such a daily simulation time step, the values of the sequences UnadjustedGlobalRadiation, DailyGlobalRadiation, and LoggedUnadjustedGlobalRadiation must be identical:

>>> model.idx_sim = 1
>>> fluxes.unadjustedglobalradiation = 200.0
>>> fluxes.dailyglobalradiation = 200.0
>>> logs.loggedunadjustedglobalradiation = 200.0

After calling Calc_GlobalRadiation_V2, the same holds for the adjusted global radiation sum:

>>> model.calc_globalradiation_v2()
>>> fluxes.globalradiation
globalradiation(200.0)

Intuitively, one would not expect method Calc_GlobalRadiation_V2 to have any effect when applied on daily simulation time steps at all. However, it corrects “wrong” predefined global radiation values:

>>> fluxes.dailyglobalradiation = 280.0
>>> model.calc_globalradiation_v2()
>>> fluxes.globalradiation
globalradiation(280.0)

We now demonstrate how method Calc_GlobalRadiation_V2 works for hourly simulation time steps:

>>> simulationstep("1h")
>>> derived.nmblogentries.update()

The daily global radiation value does not depend on the simulation timestep. We reset it to 200 W/m²:

>>> fluxes.dailyglobalradiation = 200.0

The other global radiation values must be smaller and vary throughout the day. We set them in agreement with the logged sunshine duration specified in the documentation on method Calc_DailyGlobalRadiation_V1:

>>> fluxes.unadjustedglobalradiation = 960.0
>>> logs.loggedunadjustedglobalradiation = (
...     960.0, 960.0, 240.0, 120.0, 120.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
...     0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 120.0, 480.0, 720.0, 840.0, 960.0)

Compared with the total 24 hours, the simulation time steps around noon are relatively sunny, both for the current and the last day (see the first and the last entry of the log sequence for the sunshine duration). Accordingly, the hourly global radiation values’ mean (230 W/m²) is larger than the directly calculated daily mean (200 W/m²). Method Calc_GlobalRadiation_V2 uses the fraction of both sums to calculate the adjusted global radiation (\(960 \cdot 200 / 230\)):

>>> model.calc_globalradiation_v2()
>>> fluxes.globalradiation
globalradiation(834.782609)
class hydpy.models.meteo.meteo_model.Calc_SunshineDuration_V1[source]

Bases: Method

Calculate the sunshine duration according to Allen et al. (1998).

Requires the control parameters:

AngstromConstant AngstromFactor

Requires the derived parameter:

MOY

Requires the input sequence:

GlobalRadiation

Requires the factor sequence:

PossibleSunshineDuration

Requires the flux sequence:

ExtraterrestrialRadiation

Calculates the factor sequence:

SunshineDuration

Basic equation (Allen et al. (1998), equation 35, rearranged):

\(SunshineDuration = \left(\frac{GlobalRadiation}{ExtraterrestrialRadiation}-AngstromConstant \right) \cdot \frac{PossibleSunshineDuration}{AngstromFactor}\)

Example:

Essentially, Calc_SunshineDuration_V1 inverts Calc_GlobalRadiation_V1 and thus also relies on the Ångström formula. Instead of estimating global radiation from sunshine duration, it estimates global radiation from sunshine duration. We demonstrate this by repeating the examples of Calc_GlobalRadiation_V1 “backwards”:

>>> from hydpy import pub, round_
>>> pub.timegrids = "2000-01-30", "2000-02-03", "1d"
>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> angstromconstant.jan = 0.19
>>> angstromfactor.jan = 0.55
>>> angstromconstant.feb = 0.25
>>> angstromfactor.feb = 0.5
>>> derived.moy.update()
>>> factors.possiblesunshineduration = 14.0
>>> fluxes.extraterrestrialradiation = 200.0
>>> model.idx_sim = 1
>>> inputs.globalradiation = 132.285714
>>> model.calc_sunshineduration_v1()
>>> factors.sunshineduration
sunshineduration(12.0)
>>> model.idx_sim = 2
>>> inputs.globalradiation = 135.714286
>>> model.calc_sunshineduration_v1()
>>> factors.sunshineduration
sunshineduration(12.0)

Calc_SunshineDuration_V1 sets SunshineDuration to zero for zero extraterrestrial radiation:

>>> fluxes.extraterrestrialradiation = 0.0
>>> model.calc_sunshineduration_v1()
>>> factors.sunshineduration
sunshineduration(0.0)

Inconsistencies between global radiation measurements and the Ångström formula (and the selected coefficients) can result in unrealistic sunshine duration estimates. Method Calc_SunshineDuration_V1 reduces this problem by lowering too high values to the possible sunshine duration and increasing too low values to zero:

>>> fluxes.extraterrestrialradiation = 200.0
>>> inputs.globalradiation = 210.0
>>> model.calc_sunshineduration_v1()
>>> factors.sunshineduration
sunshineduration(14.0)
>>> inputs.globalradiation = 0.0
>>> model.calc_sunshineduration_v1()
>>> factors.sunshineduration
sunshineduration(0.0)
class hydpy.models.meteo.meteo_model.Update_LoggedUnadjustedSunshineDuration_V1[source]

Bases: Method

Log the unadjusted sunshine duration values of the last 24 hours.

Requires the derived parameter:

NmbLogEntries

Requires the factor sequence:

UnadjustedSunshineDuration

Updates the log sequence:

LoggedUnadjustedSunshineDuration

Example:

The following example shows that each new method call successively moves the three memorised values to the right and stores the respective new value on the most left position:

>>> from hydpy.models.meteo import *
>>> simulationstep("8h")
>>> parameterstep()
>>> derived.nmblogentries.update()
>>> logs.loggedunadjustedsunshineduration = 0.0
>>> from hydpy import UnitTest
>>> test = UnitTest(model,
...                 model.update_loggedunadjustedsunshineduration_v1,
...                 last_example=4,
...                 parseqs=(factors.unadjustedsunshineduration,
...                          logs.loggedunadjustedsunshineduration))
>>> test.nexts.unadjustedsunshineduration = 1.0, 3.0, 2.0, 4.0
>>> del test.inits.loggedunadjustedsunshineduration
>>> test()  
| ex. | unadjustedsunshineduration | ... loggedunadjustedsunshineduration |
-------------------------------------...-----------------------------------
|   1 |                        1.0 | 1.0  0.0           ...           0.0 |
|   2 |                        3.0 | 3.0  1.0           ...           0.0 |
|   3 |                        2.0 | 2.0  3.0           ...           1.0 |
|   4 |                        4.0 | 4.0  2.0           ...           3.0 |
class hydpy.models.meteo.meteo_model.Calc_DailySunshineDuration_V2[source]

Bases: Method

Calculate the daily sunshine duration reversely to Calc_DailyGlobalRadiation_V1.

Required submethod:

Return_SunshineDuration_V1

Requires the control parameters:

AngstromConstant AngstromFactor

Requires the derived parameter:

MOY

Requires the factor sequence:

DailyPossibleSunshineDuration

Requires the flux sequences:

DailyGlobalRadiation ExtraterrestrialRadiation

Calculates the factor sequence:

DailySunshineDuration

Additional requirements:

idx_sim

Basic equation:

\(DailySunshineDuration = Return\_SunshineDuration \left( DailyGlobalRadiation, ExtraterrestrialRadiation, DailyPossibleSunshineDuration \right)\)

Example:

Method Calc_UnadjustedSunshineDuration_V1 relies on Return_SunshineDuration_V1 and thus comes with the same limitation regarding periods with little sunshine. See its documentation for further information. Here, we only demonstrate the proper passing of DailyGlobalRadiation, ExtraterrestrialRadiation, and DailyPossibleSunshineDuration:

>>> from hydpy import pub
>>> pub.timegrids = "2000-01-30", "2000-02-03", "1d"
>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> derived.moy.update()
>>> angstromconstant.jan = 0.1
>>> angstromfactor.jan = 0.5
>>> factors.dailypossiblesunshineduration = 12.0
>>> fluxes.dailyglobalradiation = 80.0
>>> fluxes.extraterrestrialradiation = 200.0
>>> model.idx_sim = 1
>>> model.calc_dailysunshineduration_v2()
>>> factors.dailysunshineduration
dailysunshineduration(7.2)
class hydpy.models.meteo.meteo_model.Calc_SunshineDuration_V2[source]

Bases: Method

Adjust the current sunshine duration to the daily sunshine duration like Calc_GlobalRadiation_V2 adjusts the current global radiation to the daily global radiation.

Requires the derived parameter:

NmbLogEntries

Requires the factor sequences:

UnadjustedSunshineDuration DailySunshineDuration PossibleSunshineDuration

Requires the log sequence:

LoggedUnadjustedSunshineDuration

Calculates the factor sequence:

SunshineDuration

Additional requirements:

idx_sim

Basic equation:

\(SunshineDuration = UnadjustedSunshineDuration \cdot \frac{DailySunshineDuration}{\sum LoggedUnadjustedSunshineDuration}\)

Examples:

Calc_SunshineDuration_V2 implements a standardisation approach following the reasons and strategy explained in the documentation on method Calc_GlobalRadiation_V2. Hence, we first adopt its examples without repeated explanations:

>>> from hydpy.models.meteo import *
>>> simulationstep("1d")
>>> parameterstep()
>>> derived.nmblogentries.update()
>>> model.idx_sim = 1
>>> factors.unadjustedsunshineduration = 4.0
>>> factors.dailysunshineduration = 4.0
>>> logs.loggedunadjustedsunshineduration = 4.0
>>> model.calc_sunshineduration_v2()
>>> factors.sunshineduration
sunshineduration(4.0)
>>> factors.dailysunshineduration = 5.6
>>> model.calc_sunshineduration_v2()
>>> factors.sunshineduration
sunshineduration(5.6)
>>> simulationstep("1h")
>>> derived.nmblogentries.update()
>>> factors.dailysunshineduration = 4.0
>>> factors.unadjustedsunshineduration = 0.8
>>> logs.loggedunadjustedsunshineduration = (
...     0.8, 0.8, 0.2, 0.1, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
...     0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.4, 0.6, 0.7, 0.8)
>>> model.calc_sunshineduration_v2()
>>> factors.sunshineduration
sunshineduration(0.695652)

The global radiation of a day cannot be zero due to diffusive radiations, but the sunshine duration can. Hence, Calc_SunshineDuration_V2 requires a safeguard against zero-divisions not relevant for Calc_GlobalRadiation_V2. We decided to generally set the adjusted sunshine duration to zero if the directly calculated daily sunshine duration or the current unadjusted sunshine duration is zero. (Note the sum of the logged unadjusted sunshine duration can only be zero if the present unadjusted sunshine duration is zero):

>>> factors.unadjustedsunshineduration = 0.0
>>> logs.loggedunadjustedsunshineduration = 0.0
>>> model.calc_sunshineduration_v2()
>>> factors.sunshineduration
sunshineduration(0.0)
class hydpy.models.meteo.meteo_model.Calc_Temperature_V1[source]

Bases: Method

Take the input temperature for each hydrological response unit.

Requires the control parameter:

NmbHRU

Requires the input sequence:

Temperature

Calculates the factor sequence:

Temperature

Basic equation:

\(Temperature_{factors} = Temperature_{inputs}\)

Example:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> nmbhru(2)
>>> inputs.temperature = 2.0
>>> model.calc_temperature_v1()
>>> factors.temperature
temperature(2.0, 2.0)
class hydpy.models.meteo.meteo_model.Adjust_Temperature_V1[source]

Bases: Method

Adjust the previously determined temperature values.

Requires the control parameters:

NmbHRU TemperatureAddend

Updates the factor sequence:

Temperature

Basic equation:

\(Temperature_{new} = TemperatureAddend + Temperature_{old}\)

Example:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> nmbhru(2)
>>> temperatureaddend(-0.6, -1.2)
>>> factors.temperature = 2.0
>>> model.adjust_temperature_v1()
>>> factors.temperature
temperature(1.4, 0.8)
class hydpy.models.meteo.meteo_model.Calc_MeanTemperature_V1[source]

Bases: Method

Calculate the average temperature.

Requires the control parameter:

NmbHRU

Requires the derived parameter:

HRUAreaFraction

Requires the factor sequence:

Temperature

Calculates the factor sequence:

MeanTemperature

Basic equation:

\(MeanTemperature = \sum_{i=1}^{NmbHRU} HRUAreaFraction_i \cdot Temperature_i\)

Example:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> nmbhru(2)
>>> derived.hruareafraction(0.8, 0.2)
>>> factors.temperature = 1.0, 2.0
>>> model.calc_meantemperature_v1()
>>> factors.meantemperature
meantemperature(1.2)
class hydpy.models.meteo.meteo_model.Calc_Precipitation_V1[source]

Bases: Method

Take the input precipitation for each hydrological response unit.

Requires the control parameter:

NmbHRU

Requires the input sequence:

Precipitation

Calculates the flux sequence:

Precipitation

Basic equation:

\(Precipitation_{fluxes} = Precipitation_{inputs}\)

Example:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> nmbhru(2)
>>> inputs.precipitation = 2.0
>>> model.calc_precipitation_v1()
>>> fluxes.precipitation
precipitation(2.0, 2.0)
class hydpy.models.meteo.meteo_model.Adjust_Precipitation_V1[source]

Bases: Method

Adjust the previously determined precipitation values.

Requires the control parameters:

NmbHRU PrecipitationFactor

Updates the flux sequence:

Precipitation

Basic equation:

\(Precipitation_{new} = PrecipitationFactor \cdot Precipitation_{old}\)

Example:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> nmbhru(2)
>>> precipitationfactor(0.5, 2.0)
>>> fluxes.precipitation = 2.0
>>> model.adjust_precipitation_v1()
>>> fluxes.precipitation
precipitation(1.0, 4.0)
class hydpy.models.meteo.meteo_model.Calc_MeanPrecipitation_V1[source]

Bases: Method

Calculate the average precipitation.

Requires the control parameter:

NmbHRU

Requires the derived parameter:

HRUAreaFraction

Requires the flux sequence:

Precipitation

Calculates the flux sequence:

MeanPrecipitation

Basic equation:

\(MeanPrecipitation = \sum_{i=1}^{NmbHRU} HRUAreaFraction_i \cdot Precipitation_i\)

Example:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> nmbhru(2)
>>> derived.hruareafraction(0.8, 0.2)
>>> fluxes.precipitation = 1.0, 2.0
>>> model.calc_meanprecipitation_v1()
>>> fluxes.meanprecipitation
meanprecipitation(1.2)
class hydpy.models.meteo.meteo_model.Determine_Temperature_V1[source]

Bases: Method

Interface method that applies the complete application model by executing all “run methods”.

class hydpy.models.meteo.meteo_model.Get_Temperature_V1[source]

Bases: Method

Get the current temperature from the selected hydrological response unit.

Requires the factor sequence:

Temperature

Example:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> nmbhru(2)
>>> factors.temperature = 2.0, 4.0
>>> from hydpy import round_
>>> round_(model.get_temperature_v1(0))
2.0
>>> round_(model.get_temperature_v1(1))
4.0
class hydpy.models.meteo.meteo_model.Get_MeanTemperature_V1[source]

Bases: Method

Get the mean temperature.

Requires the factor sequence:

MeanTemperature

Example:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> nmbhru(2)
>>> factors.meantemperature = 3.0
>>> model.get_meantemperature_v1()
3.0
class hydpy.models.meteo.meteo_model.Determine_Precipitation_V1[source]

Bases: Method

Interface method that applies the complete application model by executing all “run methods”.

class hydpy.models.meteo.meteo_model.Get_Precipitation_V1[source]

Bases: Method

Get the current precipitation from the selected hydrological response unit.

Requires the flux sequence:

Precipitation

Example:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> nmbhru(2)
>>> fluxes.precipitation = 2.0, 4.0
>>> from hydpy import round_
>>> round_(model.get_precipitation_v1(0))
2.0
>>> round_(model.get_precipitation_v1(1))
4.0
class hydpy.models.meteo.meteo_model.Get_MeanPrecipitation_V1[source]

Bases: Method

Get the mean precipitation.

Requires the flux sequence:

MeanPrecipitation

Example:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> nmbhru(2)
>>> fluxes.meanprecipitation = 3.0
>>> model.get_meanprecipitation_v1()
3.0
class hydpy.models.meteo.meteo_model.Process_Radiation_V1[source]

Bases: ReusableMethod

Interface method for radiation-related submodels that executes all “run methods”.

REUSEMARKER: str = '__hydpy_reuse_process_radiation_v1__'

Name of an additional model attribute for marking if the respective method has already been called and should not be called again for the same simulation step and its results can be reused.

class hydpy.models.meteo.meteo_model.Get_PossibleSunshineDuration_V1[source]

Bases: Method

Get the potential sunshine duration in h.

Requires the factor sequence:

PossibleSunshineDuration

Example:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> factors.possiblesunshineduration = 3.0
>>> model.get_possiblesunshineduration_v1()
3.0
class hydpy.models.meteo.meteo_model.Get_PossibleSunshineDuration_V2[source]

Bases: Method

Get the potential sunshine duration in h.

Requires the input sequence:

PossibleSunshineDuration

Example:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> inputs.possiblesunshineduration = 3.0
>>> model.get_possiblesunshineduration_v2()
3.0
class hydpy.models.meteo.meteo_model.Get_SunshineDuration_V1[source]

Bases: Method

Get the actual sunshine duration in h.

Requires the factor sequence:

SunshineDuration

Example:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> factors.sunshineduration = 3.0
>>> model.get_sunshineduration_v1()
3.0
class hydpy.models.meteo.meteo_model.Get_SunshineDuration_V2[source]

Bases: Method

Get the actual sunshine duration in h.

Requires the input sequence:

SunshineDuration

Example:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> inputs.sunshineduration = 3.0
>>> model.get_sunshineduration_v2()
3.0
class hydpy.models.meteo.meteo_model.Get_ClearSkySolarRadiation_V1[source]

Bases: Method

Get the clear sky solar radiation in W/m².

Requires the flux sequence:

ClearSkySolarRadiation

Example:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> fluxes.clearskysolarradiation = 3.0
>>> model.get_clearskysolarradiation_v1()
3.0
class hydpy.models.meteo.meteo_model.Get_ClearSkySolarRadiation_V2[source]

Bases: Method

Get the clear sky solar radiation in W/m².

Requires the input sequence:

ClearSkySolarRadiation

Example:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> inputs.clearskysolarradiation = 3.0
>>> model.get_clearskysolarradiation_v2()
3.0
class hydpy.models.meteo.meteo_model.Get_GlobalRadiation_V1[source]

Bases: Method

Get the global radiation in W/m².

Requires the flux sequence:

GlobalRadiation

Example:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> fluxes.globalradiation = 3.0
>>> model.get_globalradiation_v1()
3.0
class hydpy.models.meteo.meteo_model.Get_GlobalRadiation_V2[source]

Bases: Method

Get the global radiation in W/m².

Requires the input sequence:

GlobalRadiation

Example:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> inputs.globalradiation = 3.0
>>> model.get_globalradiation_v2()
3.0
class hydpy.models.meteo.meteo_model.Sub_BaseModel[source]

Bases: AdHocModel

Base class for HydPy-Meteo submodels.

static share_configuration(sharable_configuration: SharableConfiguration) Generator[None, None, None][source]

Take the landtype_constants data to adjust all parameters inherited from ZipParameter1D and the refweights parameter instance to adjust the index references of all parameters inherited from ZipParameter1D and all sequences inherited from FluxSequence1D:

>>> from hydpy.core.parametertools import Constants, NameParameter, Parameter
>>> consts = Constants(GRASS=1, TREES=3, WATER=2)
>>> class LandType(NameParameter):
...     __name__ = "temp.py"
...     constants = consts
>>> class Subarea(Parameter):
...     ...
>>> from hydpy.models.meteo.meteo_model import Sub_BaseModel
>>> with Sub_BaseModel.share_configuration(
...         {"landtype_refindices": LandType,
...          "refweights": Subarea}):
...     from hydpy.models.meteo.meteo_parameters import ZipParameter1D
...     ZipParameter1D.constants
...     ZipParameter1D.refindices.__name__
...     ZipParameter1D._refweights.__name__
...     from hydpy.models.meteo.meteo_sequences import FluxSequence1D
...     FluxSequence1D._refweights.__name__
{'GRASS': 1, 'TREES': 3, 'WATER': 2}
'LandType'
'Subarea'
'Subarea'
>>> ZipParameter1D.constants
{}
>>> ZipParameter1D.refindices
>>> ZipParameter1D._refweights
>>> FluxSequence1D._refweights
prepare_nmbzones

Set the number of hydrological response units.

>>> from hydpy.models.meteo_precip_io import *
>>> parameterstep()
>>> model.prepare_nmbzones(2)
>>> nmbhru
nmbhru(2)
prepare_subareas

Set the area of all hydrological response units in km².

>>> from hydpy.models.meteo_precip_io import *
>>> parameterstep()
>>> nmbhru(2)
>>> model.prepare_subareas([1.0, 3.0])
>>> hruarea
hruarea(1.0, 3.0)
REUSABLE_METHODS: ClassVar[tuple[type[ReusableMethod], ...]] = ()

Parameter Features

Parameter tools

class hydpy.models.meteo.meteo_parameters.ZipParameter1D(subvars: SubParameters)[source]

Bases: ZipParameter

Base class for 1-dimensional parameters that provide additional keyword-based zipping functionalities.

constants: dict[str, int] = {}

Mapping of the constants’ names and values.

mask: masktools.IndexMask
name: str = 'zipparameter1d'

Name of the variable in lowercase letters.

unit: str = '?'

Unit of the variable.

Control parameters

class hydpy.models.meteo.ControlParameters(master: Parameters, cls_fastaccess: type[FastAccessParameter] | None = None, cymodel: CyModelProtocol | None = None)

Bases: SubParameters

Control parameters of model meteo.

The following classes are selected:
class hydpy.models.meteo.meteo_control.NmbHRU(subvars: SubParameters)[source]

Bases: Parameter

The number of hydrological response units [-].

Required by the methods:

Adjust_Precipitation_V1 Adjust_Temperature_V1 Calc_MeanPrecipitation_V1 Calc_MeanTemperature_V1 Calc_Precipitation_V1 Calc_Temperature_V1

NmbHRU determines the length of the 1-dimensional parameters and sequences:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> nmbhru(5)
>>> precipitationfactor.shape
(5,)
>>> fluxes.precipitation.shape
(5,)

Changing the value of NmbHRU later reshapes the affected parameters and sequences and makes resetting their values necessary:

>>> precipitationfactor(2.0)
>>> precipitationfactor
precipitationfactor(2.0)
>>> nmbhru(3)
>>> precipitationfactor
precipitationfactor(?)

Re-defining the same value does not delete the already available data:

>>> precipitationfactor(2.0)
>>> nmbhru(3)
>>> precipitationfactor
precipitationfactor(2.0)
NDIM: int = 0
TYPE

alias of int

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (1, None)
name: str = 'nmbhru'

Name of the variable in lowercase letters.

unit: str = '-'

Unit of the variable.

class hydpy.models.meteo.meteo_control.HRUArea(subvars: SubParameters)[source]

Bases: Parameter

The area of each hydrological response unit [km²].

NDIM: int = 1
TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
name: str = 'hruarea'

Name of the variable in lowercase letters.

unit: str = 'km²'

Unit of the variable.

class hydpy.models.meteo.meteo_control.Latitude(subvars: SubParameters)[source]

Bases: Parameter

The latitude [decimal degrees].

NDIM: int = 0
TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (-90.0, 90.0)
name: str = 'latitude'

Name of the variable in lowercase letters.

unit: str = 'decimal degrees'

Unit of the variable.

class hydpy.models.meteo.meteo_control.Longitude(subvars: SubParameters)[source]

Bases: Parameter

The longitude [decimal degrees].

Required by the methods:

Calc_SolarTimeAngle_V1 Calc_TimeOfSunrise_TimeOfSunset_V1

NDIM: int = 0
TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (-180.0, 180.0)
name: str = 'longitude'

Name of the variable in lowercase letters.

unit: str = 'decimal degrees'

Unit of the variable.

class hydpy.models.meteo.meteo_control.AngstromConstant(subvars: SubParameters)[source]

Bases: MonthParameter

The Ångström “a” coefficient for calculating global radiation [-].

Required by the methods:

Calc_ClearSkySolarRadiation_V1 Calc_DailyGlobalRadiation_V1 Calc_DailySunshineDuration_V2 Calc_GlobalRadiation_V1 Calc_SunshineDuration_V1 Calc_UnadjustedGlobalRadiation_V1 Calc_UnadjustedSunshineDuration_V1 Return_DailyGlobalRadiation_V1 Return_SunshineDuration_V1

TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, 1.0)
INIT: int | float | bool | None = 0.25
trim(lower=None, upper=None) bool[source]

Trim values following \(AngstromConstant \leq 1 - AngstromFactor\) or at least following \(AngstromConstant \leq 1\).

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> angstromconstant(1.5)
>>> angstromconstant
angstromconstant(1.0)
>>> angstromfactor.value = 0.6
>>> angstromconstant(0.5)
>>> angstromconstant
angstromconstant(0.4)
name: str = 'angstromconstant'

Name of the variable in lowercase letters.

unit: str = '-'

Unit of the variable.

class hydpy.models.meteo.meteo_control.AngstromFactor(subvars: SubParameters)[source]

Bases: MonthParameter

The Ångström “b” coefficient for calculating global radiation [-].

Required by the methods:

Calc_ClearSkySolarRadiation_V1 Calc_DailyGlobalRadiation_V1 Calc_DailySunshineDuration_V2 Calc_GlobalRadiation_V1 Calc_SunshineDuration_V1 Calc_UnadjustedGlobalRadiation_V1 Calc_UnadjustedSunshineDuration_V1 Return_DailyGlobalRadiation_V1 Return_SunshineDuration_V1

TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, 1.0)
INIT: int | float | bool | None = 0.5
trim(lower=None, upper=None) bool[source]

Trim values in accordance with \(AngstromFactor \leq 1 - AngstromConstant\) or at least in accordance with \(AngstromFactor \leq 1\).

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> angstromfactor(1.5)
>>> angstromfactor
angstromfactor(1.0)
>>> angstromconstant.value = 0.6
>>> angstromfactor(0.5)
>>> angstromfactor
angstromfactor(0.4)
name: str = 'angstromfactor'

Name of the variable in lowercase letters.

unit: str = '-'

Unit of the variable.

class hydpy.models.meteo.meteo_control.AngstromAlternative(subvars: SubParameters)[source]

Bases: MonthParameter

An alternative Ångström coefficient for replacing coefficient “c” (AngstromConstant) on days without any direct sunshine [-].

Required by the methods:

Calc_DailyGlobalRadiation_V1 Calc_UnadjustedGlobalRadiation_V1 Return_DailyGlobalRadiation_V1

TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, 1.0)
INIT: int | float | bool | None = 0.15
name: str = 'angstromalternative'

Name of the variable in lowercase letters.

unit: str = '-'

Unit of the variable.

class hydpy.models.meteo.meteo_control.TemperatureAddend(subvars: SubParameters)[source]

Bases: ZipParameter1D

Temperature shift constant [°C].

Required by the method:

Adjust_Temperature_V1

TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (None, None)
INIT: int | float | bool | None = 0.0
name: str = 'temperatureaddend'

Name of the variable in lowercase letters.

unit: str = '°C'

Unit of the variable.

class hydpy.models.meteo.meteo_control.PrecipitationFactor(subvars: SubParameters)[source]

Bases: ZipParameter1D

Precipitation adjustment factor [-].

Required by the method:

Adjust_Precipitation_V1

TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
INIT: int | float | bool | None = 1.0
name: str = 'precipitationfactor'

Name of the variable in lowercase letters.

unit: str = '-'

Unit of the variable.

Derived parameters

class hydpy.models.meteo.DerivedParameters(master: Parameters, cls_fastaccess: type[FastAccessParameter] | None = None, cymodel: CyModelProtocol | None = None)

Bases: SubParameters

Derived parameters of model meteo.

The following classes are selected:
  • DOY() References the “global” day of the year index array [-].

  • MOY() References the “global” month of the year index array [-].

  • Hours() The length of the actual simulation step size in hours [h].

  • Days() The length of the actual simulation step size in days [d].

  • SCT() References the “global” standard clock time array [h].

  • HRUAreaFraction() The area fraction of each hydrological response unit [-].

  • NmbLogEntries() The number of log entries required for memorising one day’s data [-].

  • UTCLongitude() Longitude of the centre of the local time zone [°].

  • LatitudeRad() The latitude [rad].

class hydpy.models.meteo.meteo_derived.DOY(subvars: SubParameters)[source]

Bases: DOYParameter

References the “global” day of the year index array [-].

Required by the methods:

Calc_EarthSunDistance_V1 Calc_SolarDeclination_V1 Calc_SolarDeclination_V2 Calc_SolarTimeAngle_V1

name: str = 'doy'

Name of the variable in lowercase letters.

unit: str = '-'

Unit of the variable.

class hydpy.models.meteo.meteo_derived.MOY(subvars: SubParameters)[source]

Bases: MOYParameter

References the “global” month of the year index array [-].

Required by the methods:

Calc_ClearSkySolarRadiation_V1 Calc_DailyGlobalRadiation_V1 Calc_DailySunshineDuration_V2 Calc_GlobalRadiation_V1 Calc_SunshineDuration_V1 Calc_UnadjustedGlobalRadiation_V1 Calc_UnadjustedSunshineDuration_V1 Return_DailyGlobalRadiation_V1 Return_SunshineDuration_V1

name: str = 'moy'

Name of the variable in lowercase letters.

unit: str = '-'

Unit of the variable.

class hydpy.models.meteo.meteo_derived.Seconds(subvars: SubParameters)[source]

Bases: SecondsParameter

The length of the actual simulation step size in seconds [s].

name: str = 'seconds'

Name of the variable in lowercase letters.

unit: str = 's'

Unit of the variable.

class hydpy.models.meteo.meteo_derived.Hours(subvars: SubParameters)[source]

Bases: HoursParameter

The length of the actual simulation step size in hours [h].

Required by the methods:

Calc_PortionDailyRadiation_V1 Calc_PossibleSunshineDuration_V1 Calc_PossibleSunshineDuration_V2

name: str = 'hours'

Name of the variable in lowercase letters.

unit: str = 'h'

Unit of the variable.

class hydpy.models.meteo.meteo_derived.Days(subvars: SubParameters)[source]

Bases: DaysParameter

The length of the actual simulation step size in days [d].

Required by the methods:

Calc_DailyGlobalRadiation_V1 Calc_ExtraterrestrialRadiation_V1 Calc_PossibleSunshineDuration_V1 Calc_UnadjustedGlobalRadiation_V1 Return_DailyGlobalRadiation_V1

name: str = 'days'

Name of the variable in lowercase letters.

unit: str = 'd'

Unit of the variable.

class hydpy.models.meteo.meteo_derived.SCT(subvars: SubParameters)[source]

Bases: SCTParameter

References the “global” standard clock time array [h].

Required by the methods:

Calc_PortionDailyRadiation_V1 Calc_PossibleSunshineDuration_V2 Calc_SolarTimeAngle_V1

name: str = 'sct'

Name of the variable in lowercase letters.

unit: str = 'h'

Unit of the variable.

class hydpy.models.meteo.meteo_derived.HRUAreaFraction(subvars: SubParameters)[source]

Bases: Parameter

The area fraction of each hydrological response unit [-].

Required by the methods:

Calc_MeanPrecipitation_V1 Calc_MeanTemperature_V1

NDIM: int = 1
TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, 1.0)
update() None[source]

Calculate the fractions based on \(HRUAreaFraction_i = HRUArea_i / \Sigma HRUArea\).

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> nmbhru(5)
>>> hruarea(10.0, 40.0, 20.0, 25.0, 5.0)
>>> derived.hruareafraction.update()
>>> derived.hruareafraction
hruareafraction(0.1, 0.4, 0.2, 0.25, 0.05)
name: str = 'hruareafraction'

Name of the variable in lowercase letters.

unit: str = '-'

Unit of the variable.

class hydpy.models.meteo.meteo_derived.NmbLogEntries(subvars: SubParameters)[source]

Bases: Parameter

The number of log entries required for memorising one day’s data [-].

Required by the methods:

Adjust_ClearSkySolarRadiation_V1 Calc_DailyGlobalRadiation_V2 Calc_DailySunshineDuration_V1 Calc_GlobalRadiation_V2 Calc_SunshineDuration_V2 Calc_UnadjustedGlobalRadiation_V1 Calc_UnadjustedSunshineDuration_V1 Update_LoggedGlobalRadiation_V1 Update_LoggedSunshineDuration_V1 Update_LoggedUnadjustedGlobalRadiation_V1 Update_LoggedUnadjustedSunshineDuration_V1

NDIM: int = 0
TYPE

alias of int

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (1, None)
update()[source]

Calculate the number of entries and adjust the shape of all relevant log sequences.

The aimed memory duration is always one day. Hence, the number of the required log entries depends on the simulation step size:

>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> from hydpy import pub
>>> pub.timegrids = "2000-01-01", "2000-01-02", "1h"
>>> derived.nmblogentries.update()
>>> derived.nmblogentries
nmblogentries(24)
>>> logs  
loggedsunshineduration(nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
                       nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
                       nan, nan, nan, nan)
...

To prevent losing information, updating parameter NmbLogEntries resets the shape of the relevant log sequences only when necessary:

>>> logs.loggedsunshineduration = 1.0
>>> derived.nmblogentries(24)
>>> logs  
loggedsunshineduration(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                       1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
                       1.0, 1.0, 1.0, 1.0)
...

There is an explicit check for inappropriate simulation step sizes:

>>> pub.timegrids = "2000-01-01 00:00", "2000-01-01 10:00", "5h"
>>> derived.nmblogentries.update()
Traceback (most recent call last):
...
ValueError: The value of parameter `nmblogentries` of element `?` cannot be determined for a the current simulation step size.  The fraction of the memory period (1d) and the simulation step size (5h) leaves a remainder.
name: str = 'nmblogentries'

Name of the variable in lowercase letters.

unit: str = '-'

Unit of the variable.

class hydpy.models.meteo.meteo_derived.UTCLongitude(subvars: SubParameters)[source]

Bases: UTCLongitudeParameter

Longitude of the centre of the local time zone [°].

Required by the methods:

Calc_SolarTimeAngle_V1 Calc_TimeOfSunrise_TimeOfSunset_V1

name: str = 'utclongitude'

Name of the variable in lowercase letters.

unit: str = '°'

Unit of the variable.

class hydpy.models.meteo.meteo_derived.LatitudeRad(subvars: SubParameters)[source]

Bases: Parameter

The latitude [rad].

Required by the methods:

Calc_ExtraterrestrialRadiation_V1 Calc_ExtraterrestrialRadiation_V2 Calc_SunsetHourAngle_V1 Calc_TimeOfSunrise_TimeOfSunset_V1

NDIM: int = 0
TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (-1.5708, 1.5708)
update()[source]

Update LatitudeRad based on parameter Latitude.

>>> from hydpy import round_
>>> from hydpy.models.meteo import *
>>> parameterstep()
>>> for value in (-90.0, -45.0, 0.0, 45.0, 90.0):
...     latitude(value)
...     derived.latituderad.update()
...     round_(latitude.value, end=": ")
...     round_(derived.latituderad.value)
-90.0: -1.570796
-45.0: -0.785398
0.0: 0.0
45.0: 0.785398
90.0: 1.570796
name: str = 'latituderad'

Name of the variable in lowercase letters.

unit: str = 'rad'

Unit of the variable.

Fixed parameters

class hydpy.models.meteo.FixedParameters(master: Parameters, cls_fastaccess: type[FastAccessParameter] | None = None, cymodel: CyModelProtocol | None = None)

Bases: SubParameters

Fixed parameters of model meteo.

The following classes are selected:
class hydpy.models.meteo.meteo_fixed.Pi(subvars: SubParameters)[source]

Bases: FixedParameter

π [-].

Required by the methods:

Calc_EarthSunDistance_V1 Calc_ExtraterrestrialRadiation_V1 Calc_ExtraterrestrialRadiation_V2 Calc_PortionDailyRadiation_V1 Calc_PossibleSunshineDuration_V1 Calc_SolarDeclination_V1 Calc_SolarDeclination_V2 Calc_SolarTimeAngle_V1 Calc_TimeOfSunrise_TimeOfSunset_V1

NDIM: int = 0
TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
INIT: int | float | bool = 3.141592653589793
name: str = 'pi'

Name of the variable in lowercase letters.

unit: str = '-'

Unit of the variable.

class hydpy.models.meteo.meteo_fixed.SolarConstant(subvars: SubParameters)[source]

Bases: FixedParameter

Solar constant [W/m²].

Required by the methods:

Calc_ExtraterrestrialRadiation_V1 Calc_ExtraterrestrialRadiation_V2

NDIM: int = 0
TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
INIT: int | float | bool = 1367.0
name: str = 'solarconstant'

Name of the variable in lowercase letters.

unit: str = 'W/m²'

Unit of the variable.

Sequence Features

Sequence tools

class hydpy.models.meteo.meteo_sequences.FactorSequence1D(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FactorSequence

Base class for 1-dimensional flux sequences.

NDIM: int = 1
NUMERIC: bool = False
mask
name: str = 'factorsequence1d'

Name of the variable in lowercase letters.

unit: str = '?'

Unit of the variable.

class hydpy.models.meteo.meteo_sequences.FluxSequence1D(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FluxSequence

Base class for 1-dimensional flux sequences.

NDIM: int = 1
NUMERIC: bool = False
mask
name: str = 'fluxsequence1d'

Name of the variable in lowercase letters.

unit: str = '?'

Unit of the variable.

Input sequences

class hydpy.models.meteo.InputSequences(master: Sequences, cls_fastaccess: type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)

Bases: InputSequences

Input sequences of model meteo.

The following classes are selected:
class hydpy.models.meteo.meteo_inputs.PossibleSunshineDuration(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: InputSequence

Possible sunshine duration [h].

Required by the method:

Get_PossibleSunshineDuration_V2

NDIM: int = 0
NUMERIC: bool = False
STANDARD_NAME: ClassVar[StandardInputNames] = 'possible_sunshine_duration'
name: str = 'possiblesunshineduration'

Name of the variable in lowercase letters.

unit: str = 'h'

Unit of the variable.

class hydpy.models.meteo.meteo_inputs.SunshineDuration(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: InputSequence

Sunshine duration [h].

Required by the methods:

Calc_GlobalRadiation_V1 Calc_UnadjustedGlobalRadiation_V1 Get_SunshineDuration_V2 Update_LoggedSunshineDuration_V1

NDIM: int = 0
NUMERIC: bool = False
STANDARD_NAME: ClassVar[StandardInputNames] = 'sunshine_duration'
name: str = 'sunshineduration'

Name of the variable in lowercase letters.

unit: str = 'h'

Unit of the variable.

class hydpy.models.meteo.meteo_inputs.ClearSkySolarRadiation(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: InputSequence

Clear sky solar radiation [W/m²].

Required by the method:

Get_ClearSkySolarRadiation_V2

NDIM: int = 0
NUMERIC: bool = False
STANDARD_NAME: ClassVar[StandardInputNames] = 'clear_sky_solar_radiation'
name: str = 'clearskysolarradiation'

Name of the variable in lowercase letters.

unit: str = 'W/m²'

Unit of the variable.

class hydpy.models.meteo.meteo_inputs.GlobalRadiation(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: InputSequence

Global radiation [W/m²].

Required by the methods:

Calc_SunshineDuration_V1 Calc_UnadjustedSunshineDuration_V1 Get_GlobalRadiation_V2 Update_LoggedGlobalRadiation_V1

NDIM: int = 0
NUMERIC: bool = False
STANDARD_NAME: ClassVar[StandardInputNames] = 'global_radiation'
name: str = 'globalradiation'

Name of the variable in lowercase letters.

unit: str = 'W/m²'

Unit of the variable.

class hydpy.models.meteo.meteo_inputs.Temperature(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: InputSequence

Temperature [°C].

Required by the method:

Calc_Temperature_V1

NDIM: int = 0
NUMERIC: bool = False
STANDARD_NAME: ClassVar[StandardInputNames] = 'air_temperature'
name: str = 'temperature'

Name of the variable in lowercase letters.

unit: str = '°C'

Unit of the variable.

class hydpy.models.meteo.meteo_inputs.Precipitation(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: InputSequence

Precipitation [mm/T].

Required by the method:

Calc_Precipitation_V1

NDIM: int = 0
NUMERIC: bool = False
STANDARD_NAME: ClassVar[StandardInputNames] = 'precipitation'
name: str = 'precipitation'

Name of the variable in lowercase letters.

unit: str = 'mm/T'

Unit of the variable.

Factor sequences

class hydpy.models.meteo.FactorSequences(master: Sequences, cls_fastaccess: type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)

Bases: FactorSequences

Factor sequences of model meteo.

The following classes are selected:
class hydpy.models.meteo.meteo_factors.EarthSunDistance(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FactorSequence

The relative inverse distance between the Earth and the sun [-].

Calculated by the method:

Calc_EarthSunDistance_V1

Required by the methods:

Calc_ExtraterrestrialRadiation_V1 Calc_ExtraterrestrialRadiation_V2

NDIM: int = 0
NUMERIC: bool = False
name: str = 'earthsundistance'

Name of the variable in lowercase letters.

unit: str = '-'

Unit of the variable.

class hydpy.models.meteo.meteo_factors.SolarDeclination(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FactorSequence

Solar declination [-].

Calculated by the methods:

Calc_SolarDeclination_V1 Calc_SolarDeclination_V2

Required by the methods:

Calc_ExtraterrestrialRadiation_V1 Calc_ExtraterrestrialRadiation_V2 Calc_SunsetHourAngle_V1 Calc_TimeOfSunrise_TimeOfSunset_V1

NDIM: int = 0
NUMERIC: bool = False
name: str = 'solardeclination'

Name of the variable in lowercase letters.

unit: str = '-'

Unit of the variable.

class hydpy.models.meteo.meteo_factors.SunsetHourAngle(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FactorSequence

Sunset hour angle [rad].

Calculated by the method:

Calc_SunsetHourAngle_V1

Required by the methods:

Calc_ExtraterrestrialRadiation_V1 Calc_PossibleSunshineDuration_V1

NDIM: int = 0
NUMERIC: bool = False
name: str = 'sunsethourangle'

Name of the variable in lowercase letters.

unit: str = 'rad'

Unit of the variable.

class hydpy.models.meteo.meteo_factors.SolarTimeAngle(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FactorSequence

Solar time angle [rad].

Calculated by the method:

Calc_SolarTimeAngle_V1

Required by the methods:

Calc_ExtraterrestrialRadiation_V1 Calc_PossibleSunshineDuration_V1

NDIM: int = 0
NUMERIC: bool = False
name: str = 'solartimeangle'

Name of the variable in lowercase letters.

unit: str = 'rad'

Unit of the variable.

class hydpy.models.meteo.meteo_factors.TimeOfSunrise(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FactorSequence

Time of sunrise [h].

Calculated by the method:

Calc_TimeOfSunrise_TimeOfSunset_V1

Required by the methods:

Calc_DailyPossibleSunshineDuration_V1 Calc_ExtraterrestrialRadiation_V2 Calc_PortionDailyRadiation_V1 Calc_PossibleSunshineDuration_V2

NDIM: int = 0
NUMERIC: bool = False
name: str = 'timeofsunrise'

Name of the variable in lowercase letters.

unit: str = 'h'

Unit of the variable.

class hydpy.models.meteo.meteo_factors.TimeOfSunset(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FactorSequence

Time of sunset [h].

Calculated by the method:

Calc_TimeOfSunrise_TimeOfSunset_V1

Required by the methods:

Calc_DailyPossibleSunshineDuration_V1 Calc_ExtraterrestrialRadiation_V2 Calc_PortionDailyRadiation_V1 Calc_PossibleSunshineDuration_V2

NDIM: int = 0
NUMERIC: bool = False
name: str = 'timeofsunset'

Name of the variable in lowercase letters.

unit: str = 'h'

Unit of the variable.

class hydpy.models.meteo.meteo_factors.PossibleSunshineDuration(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FactorSequence

Astronomically possible sunshine duration [h].

Calculated by the methods:

Calc_PossibleSunshineDuration_V1 Calc_PossibleSunshineDuration_V2

Required by the methods:

Calc_GlobalRadiation_V1 Calc_SunshineDuration_V1 Calc_SunshineDuration_V2 Calc_UnadjustedGlobalRadiation_V1 Calc_UnadjustedSunshineDuration_V1 Get_PossibleSunshineDuration_V1

NDIM: int = 0
NUMERIC: bool = False
name: str = 'possiblesunshineduration'

Name of the variable in lowercase letters.

unit: str = 'h'

Unit of the variable.

class hydpy.models.meteo.meteo_factors.DailyPossibleSunshineDuration(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FactorSequence

Astronomically possible daily sunshine duration [h/d].

Calculated by the method:

Calc_DailyPossibleSunshineDuration_V1

Required by the methods:

Calc_DailyGlobalRadiation_V1 Calc_DailySunshineDuration_V2 Calc_UnadjustedGlobalRadiation_V1

NDIM: int = 0
NUMERIC: bool = False
name: str = 'dailypossiblesunshineduration'

Name of the variable in lowercase letters.

unit: str = 'h/d'

Unit of the variable.

class hydpy.models.meteo.meteo_factors.UnadjustedSunshineDuration(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FactorSequence

Unadjusted sunshine duration [h].

Calculated by the method:

Calc_UnadjustedSunshineDuration_V1

Required by the methods:

Calc_SunshineDuration_V2 Update_LoggedUnadjustedSunshineDuration_V1

NDIM: int = 0
NUMERIC: bool = False
name: str = 'unadjustedsunshineduration'

Name of the variable in lowercase letters.

unit: str = 'h'

Unit of the variable.

class hydpy.models.meteo.meteo_factors.SunshineDuration(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FactorSequence

Actual sunshine duration [h].

Calculated by the methods:

Calc_SunshineDuration_V1 Calc_SunshineDuration_V2

Required by the method:

Get_SunshineDuration_V1

NDIM: int = 0
NUMERIC: bool = False
name: str = 'sunshineduration'

Name of the variable in lowercase letters.

unit: str = 'h'

Unit of the variable.

class hydpy.models.meteo.meteo_factors.DailySunshineDuration(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FactorSequence

Actual daily sunshine duration [h/d].

Calculated by the method:

Calc_DailySunshineDuration_V2

Updated by the method:

Calc_DailySunshineDuration_V1

Required by the methods:

Calc_DailyGlobalRadiation_V1 Calc_SunshineDuration_V2 Calc_UnadjustedGlobalRadiation_V1

NDIM: int = 0
NUMERIC: bool = False
name: str = 'dailysunshineduration'

Name of the variable in lowercase letters.

unit: str = 'h/d'

Unit of the variable.

class hydpy.models.meteo.meteo_factors.PortionDailyRadiation(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FactorSequence

Portion of the daily radiation sum [%].

Calculated by the method:

Calc_PortionDailyRadiation_V1

Required by the methods:

Adjust_ClearSkySolarRadiation_V1 Calc_UnadjustedGlobalRadiation_V1 Calc_UnadjustedSunshineDuration_V1

NDIM: int = 0
NUMERIC: bool = False
name: str = 'portiondailyradiation'

Name of the variable in lowercase letters.

unit: str = '%'

Unit of the variable.

class hydpy.models.meteo.meteo_factors.Temperature(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FactorSequence1D

Temperature [°C].

Calculated by the method:

Calc_Temperature_V1

Updated by the method:

Adjust_Temperature_V1

Required by the methods:

Calc_MeanTemperature_V1 Get_Temperature_V1

name: str = 'temperature'

Name of the variable in lowercase letters.

unit: str = '°C'

Unit of the variable.

class hydpy.models.meteo.meteo_factors.MeanTemperature(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FactorSequence

Mean temperature [°C].

Calculated by the method:

Calc_MeanTemperature_V1

Required by the method:

Get_MeanTemperature_V1

NDIM: int = 0
NUMERIC: bool = False
name: str = 'meantemperature'

Name of the variable in lowercase letters.

unit: str = '°C'

Unit of the variable.

Flux sequences

class hydpy.models.meteo.FluxSequences(master: Sequences, cls_fastaccess: type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)

Bases: FluxSequences

Flux sequences of model meteo.

The following classes are selected:
class hydpy.models.meteo.meteo_fluxes.ExtraterrestrialRadiation(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FluxSequence

Extraterrestial radiation [W/m²].

Calculated by the methods:

Calc_ExtraterrestrialRadiation_V1 Calc_ExtraterrestrialRadiation_V2

Required by the methods:

Calc_ClearSkySolarRadiation_V1 Calc_DailyGlobalRadiation_V1 Calc_DailySunshineDuration_V2 Calc_GlobalRadiation_V1 Calc_SunshineDuration_V1 Calc_UnadjustedGlobalRadiation_V1 Calc_UnadjustedSunshineDuration_V1 Return_DailyGlobalRadiation_V1

NDIM: int = 0
NUMERIC: bool = False
name: str = 'extraterrestrialradiation'

Name of the variable in lowercase letters.

unit: str = 'W/m²'

Unit of the variable.

class hydpy.models.meteo.meteo_fluxes.ClearSkySolarRadiation(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FluxSequence

Clear sky solar radiation [W/m²].

Calculated by the method:

Calc_ClearSkySolarRadiation_V1

Updated by the method:

Adjust_ClearSkySolarRadiation_V1

Required by the method:

Get_ClearSkySolarRadiation_V1

NDIM: int = 0
NUMERIC: bool = False
name: str = 'clearskysolarradiation'

Name of the variable in lowercase letters.

unit: str = 'W/m²'

Unit of the variable.

class hydpy.models.meteo.meteo_fluxes.UnadjustedGlobalRadiation(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FluxSequence

Unadjusted global radiation [W/m²].

Calculated by the method:

Calc_UnadjustedGlobalRadiation_V1

Required by the methods:

Calc_GlobalRadiation_V2 Update_LoggedUnadjustedGlobalRadiation_V1

NDIM: int = 0
NUMERIC: bool = False
name: str = 'unadjustedglobalradiation'

Name of the variable in lowercase letters.

unit: str = 'W/m²'

Unit of the variable.

class hydpy.models.meteo.meteo_fluxes.DailyGlobalRadiation(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FluxSequence

Daily sum of global radiation [W/m²].

Updated by the methods:

Calc_DailyGlobalRadiation_V1 Calc_DailyGlobalRadiation_V2

Required by the methods:

Calc_DailySunshineDuration_V2 Calc_GlobalRadiation_V2

NDIM: int = 0
NUMERIC: bool = False
name: str = 'dailyglobalradiation'

Name of the variable in lowercase letters.

unit: str = 'W/m²'

Unit of the variable.

class hydpy.models.meteo.meteo_fluxes.GlobalRadiation(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FluxSequence

Global radiation [W/m²].

Calculated by the methods:

Calc_GlobalRadiation_V1 Calc_GlobalRadiation_V2

Required by the method:

Get_GlobalRadiation_V1

NDIM: int = 0
NUMERIC: bool = False
name: str = 'globalradiation'

Name of the variable in lowercase letters.

unit: str = 'W/m²'

Unit of the variable.

class hydpy.models.meteo.meteo_fluxes.Precipitation(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FluxSequence1D

Precipitation [mm/T].

Calculated by the method:

Calc_Precipitation_V1

Updated by the method:

Adjust_Precipitation_V1

Required by the methods:

Calc_MeanPrecipitation_V1 Get_Precipitation_V1

name: str = 'precipitation'

Name of the variable in lowercase letters.

unit: str = 'mm/T'

Unit of the variable.

class hydpy.models.meteo.meteo_fluxes.MeanPrecipitation(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FluxSequence

Mean precipitation [mm/T].

Calculated by the method:

Calc_MeanPrecipitation_V1

Required by the method:

Get_MeanPrecipitation_V1

NDIM: int = 0
NUMERIC: bool = False
name: str = 'meanprecipitation'

Name of the variable in lowercase letters.

unit: str = 'mm/T'

Unit of the variable.

Log sequences

class hydpy.models.meteo.LogSequences(master: Sequences, cls_fastaccess: type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)

Bases: LogSequences

Log sequences of model meteo.

The following classes are selected:
class hydpy.models.meteo.meteo_logs.LoggedSunshineDuration(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: LogSequence

Logged sunshine duration [h].

Updated by the method:

Update_LoggedSunshineDuration_V1

Required by the method:

Calc_DailySunshineDuration_V1

NDIM: int = 1
NUMERIC: bool = False
name: str = 'loggedsunshineduration'

Name of the variable in lowercase letters.

unit: str = 'h'

Unit of the variable.

class hydpy.models.meteo.meteo_logs.LoggedGlobalRadiation(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: LogSequence

Logged global radiation [W/m²].

Updated by the method:

Update_LoggedGlobalRadiation_V1

Required by the method:

Calc_DailyGlobalRadiation_V2

NDIM: int = 1
NUMERIC: bool = False
name: str = 'loggedglobalradiation'

Name of the variable in lowercase letters.

unit: str = 'W/m²'

Unit of the variable.

class hydpy.models.meteo.meteo_logs.LoggedUnadjustedSunshineDuration(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: LogSequence

Logged unadjusted sunshine duration [h].

Updated by the method:

Update_LoggedUnadjustedSunshineDuration_V1

Required by the method:

Calc_SunshineDuration_V2

NDIM: int = 1
NUMERIC: bool = False
name: str = 'loggedunadjustedsunshineduration'

Name of the variable in lowercase letters.

unit: str = 'h'

Unit of the variable.

class hydpy.models.meteo.meteo_logs.LoggedUnadjustedGlobalRadiation(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: LogSequence

Logged unadjusted global radiation [W/m²].

Updated by the method:

Update_LoggedUnadjustedGlobalRadiation_V1

Required by the method:

Calc_GlobalRadiation_V2

NDIM: int = 1
NUMERIC: bool = False
name: str = 'loggedunadjustedglobalradiation'

Name of the variable in lowercase letters.

unit: str = 'W/m²'

Unit of the variable.

class hydpy.models.meteo.ControlParameters(master: Parameters, cls_fastaccess: type[FastAccessParameter] | None = None, cymodel: CyModelProtocol | None = None)

Bases: SubParameters

Control parameters of model meteo.

The following classes are selected:
class hydpy.models.meteo.DerivedParameters(master: Parameters, cls_fastaccess: type[FastAccessParameter] | None = None, cymodel: CyModelProtocol | None = None)

Bases: SubParameters

Derived parameters of model meteo.

The following classes are selected:
  • DOY() References the “global” day of the year index array [-].

  • MOY() References the “global” month of the year index array [-].

  • Hours() The length of the actual simulation step size in hours [h].

  • Days() The length of the actual simulation step size in days [d].

  • SCT() References the “global” standard clock time array [h].

  • HRUAreaFraction() The area fraction of each hydrological response unit [-].

  • NmbLogEntries() The number of log entries required for memorising one day’s data [-].

  • UTCLongitude() Longitude of the centre of the local time zone [°].

  • LatitudeRad() The latitude [rad].

class hydpy.models.meteo.FactorSequences(master: Sequences, cls_fastaccess: type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)

Bases: FactorSequences

Factor sequences of model meteo.

The following classes are selected:
class hydpy.models.meteo.FixedParameters(master: Parameters, cls_fastaccess: type[FastAccessParameter] | None = None, cymodel: CyModelProtocol | None = None)

Bases: SubParameters

Fixed parameters of model meteo.

The following classes are selected:
class hydpy.models.meteo.FluxSequences(master: Sequences, cls_fastaccess: type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)

Bases: FluxSequences

Flux sequences of model meteo.

The following classes are selected:
class hydpy.models.meteo.InputSequences(master: Sequences, cls_fastaccess: type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)

Bases: InputSequences

Input sequences of model meteo.

The following classes are selected:
class hydpy.models.meteo.LogSequences(master: Sequences, cls_fastaccess: type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)

Bases: LogSequences

Log sequences of model meteo.

The following classes are selected: