diff --git a/CHANGES.rst b/CHANGES.rst index b307c4ae0..25c23ebd8 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -6,6 +6,10 @@ v0.46.0 (unreleased) -------------------- Contributors to this version: Éric Dupuis (:user:`coxipi`), Trevor James Smith (:user:`Zeitsperre`), David Huard (:user:`huard`). +Announcements +^^^^^^^^^^^^^ +* The default mechanism for computing the Mean Radiant Temperature, a part of the Universal Thermal Climate Index (UTCI) was broken in xclim 0.44 and 0.45. This has been fixed by changing the default. + New features and enhancements ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ * Add ``wind_power_potential`` to estimate the potential for wind power production given wind speed at the turbine hub height and turbine specifications, along with ``wind_profile`` to estimate the wind speed at different heights based on wind speed at a reference height. (:issue:`1458`, :pull:`1471`) @@ -22,6 +26,7 @@ Bug fixes * Optimization of indicators ``huglin_index`` and ``biologically_effective_degree_days`` when used with dask and flox. As a side effect, the indice functions (i.e. under ``xc.indices``) no longer mask incomplete periods. The indicators' output is unchanged under the default "check_missing" setting (:issue:`1494`, :pull:`1495`). * Fixed ``xclim.indices.run_length.lazy_indexing`` which would sometimes trigger the loading of auxiliary coordinates. (:issue:`1483`, :pull:`1484`). * Fixed a bug in the `pytest` configuration that could prevent testing data caching from occurring in systems where the platform-dependent cache directory is not found in the user's home. (:issue:`1468`, :pull:`1473`). +* Remove nonsensical `stat='average'` option for ``mean_radiant_temperature``. (:issue:`1496`, :pull:`1501`). Breaking changes ^^^^^^^^^^^^^^^^ diff --git a/xclim/indices/_conversion.py b/xclim/indices/_conversion.py index 6e571e082..a964d54b1 100644 --- a/xclim/indices/_conversion.py +++ b/xclim/indices/_conversion.py @@ -1771,7 +1771,7 @@ def universal_thermal_climate_index( rsus: xr.DataArray = None, rlds: xr.DataArray = None, rlus: xr.DataArray = None, - stat: str = "average", + stat: str = "sunlit", mask_invalid: bool = True, ) -> xr.DataArray: r"""Universal thermal climate index (UTCI). @@ -1801,12 +1801,10 @@ def universal_thermal_climate_index( rlus : xr.DataArray, optional Surface Upwelling Longwave Radiation This is necessary if mrt is not None. - stat : {'average', 'instant', 'sunlit'} - Which statistic to apply. If "average", the average of the cosine of the - solar zenith angle is calculated. If "instant", the instantaneous cosine + stat : {'instant', 'sunlit'} + Which statistic to apply. If "instant", the instantaneous cosine of the solar zenith angle is calculated. If "sunlit", the cosine of the solar zenith angle is calculated during the sunlit period of each interval. - If "instant", the instantaneous cosine of the solar zenith angle is calculated. This is necessary if mrt is not None. mask_invalid: bool If True (default), UTCI values are NaN where any of the inputs are outside @@ -1923,7 +1921,7 @@ def mean_radiant_temperature( rsus: xr.DataArray, rlds: xr.DataArray, rlus: xr.DataArray, - stat: str = "average", + stat: str = "sunlit", ) -> xr.DataArray: r"""Mean radiant temperature. @@ -1939,12 +1937,10 @@ def mean_radiant_temperature( Surface Downwelling Longwave Radiation rlus : xr.DataArray Surface Upwelling Longwave Radiation - stat : {'average', 'instant', 'sunlit'} - Which statistic to apply. If "average", the average of the cosine of the - solar zenith angle is calculated. If "instant", the instantaneous cosine + stat : {'instant', 'sunlit'} + Which statistic to apply. If "instant", the instantaneous cosine of the solar zenith angle is calculated. If "sunlit", the cosine of the solar zenith angle is calculated during the sunlit period of each interval. - If "instant", the instantaneous cosine of the solar zenith angle is calculated. Returns ------- @@ -1987,15 +1983,9 @@ def mean_radiant_temperature( ) csza_i = csza.copy() csza_s = csza.copy() - elif stat == "average": - csza = cosine_of_solar_zenith_angle( - dates, dec, lat, stat="average", sunlit=False - ) - csza_i = csza.copy() - csza_s = csza.copy() else: raise NotImplementedError( - "Argument 'stat' must be one of 'average', 'instant' or 'sunlit'." + "Argument 'stat' must be one of 'instant' or 'sunlit'." ) fdir_ratio = _fdir_ratio(dates, csza_i, csza_s, rsds)