Skip to content

Commit

Permalink
Option to cap low winds to 0.5 m/s
Browse files Browse the repository at this point in the history
  • Loading branch information
profesorpaiche committed Feb 3, 2024
1 parent 843fe11 commit b211f51
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@
"name": "Braun, Marco",
"affiliation": "Ouranos Consortium, Montréal, Québec, Canada",
"orcid": "0000-0001-5061-3217"
},
{
"name": "Castro, Dante",
"affiliation": "Helmholtz-Zentrum Hereon, Geesthacht, Germany"
}
],
"keywords": [
Expand Down
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ Contributors
* Ag Stephens <[email protected]> `@agstephens <https://github.com/agstephens>`_
* Maliko Tanguy <[email protected]> `@malngu <https://github.com/malngu>`_
* Christopher Whelan `@qwhelan <https://github.com/qwhelan>`_
* Dante Castro <[email protected]> `@profesorpaiche <https://github.com/profesorpaiche>`_
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Changelog

v0.48 (unreleased)
------------------
Contributors to this version: Juliette Lavoie (:user:`juliettelavoie`), Pascal Bourgault (:user:`aulemahal`), Trevor James Smith (:user:`Zeitsperre`), David Huard (:user:`huard`), Éric Dupuis (:user:`coxipi`).
Contributors to this version: Juliette Lavoie (:user:`juliettelavoie`), Pascal Bourgault (:user:`aulemahal`), Trevor James Smith (:user:`Zeitsperre`), David Huard (:user:`huard`), Éric Dupuis (:user:`coxipi`), Dante Castro (:user:`profesorpaiche`).

Announcements
^^^^^^^^^^^^^
Expand All @@ -21,6 +21,7 @@ New features and enhancements
* Support ``indexer`` keyword in YAML indicator description. (:issue:`1522`, :pull:`1561`).
* New ``xclim.core.calendar.stack_periods`` and ``unstack_periods`` for performing ``rolling(time=...).construct(..., stride=...)`` but with non-uniform temporal periods like years or months. They replace ``xclim.sdba.processing.construct_moving_yearly_window`` and ``unpack_moving_yearly_window`` which are deprecated and will be removed in a future release.
* New ``as_dataset`` options for ``xclim.set_options``. When True, indicators will output Datasets instead of DataArrays. (:issue:`1257`, :pull:`1625`).
* Added new option for UTCI calculation to cap low wind velocities to a minimum of 0.5 m/s following Bröde (2012) guidelines.

Breaking changes
^^^^^^^^^^^^^^^^
Expand Down
8 changes: 7 additions & 1 deletion xclim/indices/_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -1781,6 +1781,7 @@ def universal_thermal_climate_index(
rlus: xr.DataArray | None = None,
stat: str = "sunlit",
mask_invalid: bool = True,
wind_cap_min: bool = False,
) -> xr.DataArray:
r"""Universal thermal climate index (UTCI).
Expand Down Expand Up @@ -1818,6 +1819,9 @@ def universal_thermal_climate_index(
If True (default), UTCI values are NaN where any of the inputs are outside
their validity ranges : -50°C < tas < 50°C, -30°C < tas - mrt < 30°C
and 0.5 m/s < sfcWind < 17.0 m/s.
wind_cap_min: bool
If True, low wind velocities are capped to a minimum of 0.5 m/s. This ensures
UTCI calculation for low winds. Default value False.
Returns
-------
Expand All @@ -1842,6 +1846,8 @@ def universal_thermal_climate_index(
e_sat = saturation_vapor_pressure(tas=tas, method="its90")
tas = convert_units_to(tas, "degC")
sfcWind = convert_units_to(sfcWind, "m/s")
if wind_cap_min:
sfcWind = sfcWind.clip(0.5, None)
if mrt is None:
mrt = mean_radiant_temperature(
rsds=rsds, rsus=rsus, rlds=rlds, rlus=rlus, stat=stat
Expand All @@ -1868,7 +1874,7 @@ def universal_thermal_climate_index(
& (tas < 50.0)
& (-30 < delta)
& (delta < 30)
& (0.5 < sfcWind)
& (0.5 <= sfcWind)
& (sfcWind < 17.0)
)
return utci
Expand Down

0 comments on commit b211f51

Please sign in to comment.