pycequeau.meteo.calculators package¶
- class pycequeau.meteo.calculators.MeteoCalculator[source]¶
Bases:
ABCBase class for explicit meteorological preprocessing calculations.
- classmethod available_derivations() tuple[str, ...][source]¶
Return the derived meteorological variables supported by the registry.
- classmethod create_variable_dataset(inputs: str | list[str] | tuple[str, ...], variable: str, *, source_variable: str | tuple[str, ...] | list[str] | None = None, output_name: str | None = None, **kwargs) Dataset[source]¶
Build a derived-variable dataset from one or more NetCDF inputs.
- classmethod create_variable_file(inputs: str | list[str] | tuple[str, ...], variable: str, output_path: str | None = None, *, source_variable: str | tuple[str, ...] | list[str] | None = None, output_name: str | None = None, **kwargs) str[source]¶
Compute a derived variable and write it to a NetCDF file.
- default_output_name: str | None = None¶
- classmethod get_calculator_class(variable: str) type[MeteoCalculator][source]¶
Resolve the calculator class that is responsible for a derived variable.
- registry: dict[str, type[MeteoCalculator]] = {'vapor_pressure': <class 'pycequeau.meteo.calculators.vapor_pressure.VaporPressureCalculator'>, 'wind_speed': <class 'pycequeau.meteo.calculators.wind_speed.WindSpeedCalculator'>}¶
- source_variable_groups: tuple[tuple[str, ...], ...] = ()¶
- variable_name: str | None = None¶
- class pycequeau.meteo.calculators.VaporPressureCalculator[source]¶
Bases:
MeteoCalculatorCompute saturated vapor pressure from dewpoint temperature.
The saturated vapor pressure is evaluated at the dewpoint temperature. Under that condition, the saturated vapor pressure is equal to the actual vapor pressure.
- default_output_name: str | None = 'vp'¶
- classmethod saturated_vapor_pressure(temperature_celsius: ndarray | DataArray, method: str = 'lowe_1977') ndarray | DataArray[source]¶
Compute saturated vapor pressure from air temperature.
The formulation is selected with
method.lowe_1977uses the polynomial approximation from Lowe (1977), whilemurray_1967uses the exponential form from Murray (1967).For
lowe_1977, the saturated vapor pressure is computed with two sixth-order polynomials, one over liquid water and one over ice:\[\begin{split}\begin{aligned} e_{s,w}(T) &= 100 \left(a_{0} + T\left(a_{1} + T\left(a_{2} + T\left(a_{3} + T\left(a_{4} + T\left(a_{5} + a_{6}T\right)\right)\right)\right)\right)\right) \\ e_{s,i}(T) &= 100 \left(a_{0} + T\left(a_{1} + T\left(a_{2} + T\left(a_{3} + T\left(a_{4} + T\left(a_{5} + a_{6}T\right)\right)\right)\right)\right)\right) \end{aligned}\end{split}\]Here \(T\) is the temperature in \(^\circ C\), \(e_{s,w}\) is the saturated vapor pressure over water in \(Pa\), and \(e_{s,i}\) is the saturated vapor pressure over ice in \(Pa\).
For
murray_1967, Murray gives the convenient exponential form:\[\begin{split}\begin{aligned} e_{s,w}(T_{k}) &= 100 \times 6.1078 \exp\left(17.2693882 \frac{T_{k} - 273.16}{T_{k} - 35.86}\right) \\ e_{s,i}(T_{k}) &= 100 \times 6.1078 \exp\left(21.8745584 \frac{T_{k} - 273.16}{T_{k} - 7.66}\right) \end{aligned}\end{split}\]Here \(T_{k}\) is the temperature in \(K\), \(e_{s,w}\) is the saturated vapor pressure over water in \(Pa\), and \(e_{s,i}\) is the saturated vapor pressure over ice in \(Pa\).
The result is returned in \(Pa\).
- source_variable_groups: tuple[tuple[str, ...], ...] = (('d2m', 'dewpoint_temperature'),)¶
- classmethod vapor_pressure_from_dewpoint_array(dewpoint_temperature: ndarray, method: str = 'lowe_1977') ndarray[source]¶
Compute vapor pressure from a dewpoint-temperature array.
The vapor pressure is obtained by evaluating the saturated vapor pressure at the dewpoint temperature:
\[e_{a} = e_{s}(T_{dew})\]The returned values are expressed in \(mmHg\). The
methodargument selects the saturated-vapor-pressure formulation used bysaturated_vapor_pressure().
- classmethod vapor_pressure_from_dewpoint_dataarray(dewpoint_temperature: DataArray, method: str = 'lowe_1977') DataArray[source]¶
Compute vapor pressure from a dewpoint-temperature data array.
This method first converts the dewpoint temperature to degrees Celsius, then computes the saturated vapor pressure in \(Pa\), and finally converts the result to \(mmHg\).
The resulting vapor pressure is:
\[e_{a} = e_{s}(T_{dew})\]Here \(e_{a}\) is the actual vapor pressure, \(e_{s}\) is the saturated vapor pressure function, and \(T_{dew}\) is the dewpoint temperature.
The
methodargument selects the saturated-vapor-pressure formulation used bysaturated_vapor_pressure().
- variable_name: str | None = 'vapor_pressure'¶
- class pycequeau.meteo.calculators.WindSpeedCalculator[source]¶
Bases:
MeteoCalculatorCompose daily wind speed from daily mean u10 and v10 components.
- default_output_name: str | None = 'wind'¶
- source_variable_groups: tuple[tuple[str, ...], ...] = (('u10', '10m_u_component_of_wind'), ('v10', '10m_v_component_of_wind'))¶
- variable_name: str | None = 'wind_speed'¶
Submodules¶
- pycequeau.meteo.calculators.base module
- pycequeau.meteo.calculators.vapor_pressure module
VaporPressureCalculatorVaporPressureCalculator.default_output_nameVaporPressureCalculator.saturated_vapor_pressure()VaporPressureCalculator.source_variable_groupsVaporPressureCalculator.vapor_pressure_from_dewpoint_array()VaporPressureCalculator.vapor_pressure_from_dewpoint_dataarray()VaporPressureCalculator.variable_name
- pycequeau.meteo.calculators.wind_speed module