github Ouranosinc/xclim v0.39.0

latest releases: v0.41.0, v0.40.0
2 years ago

Contributors to this version: Trevor James Smith (@Zeitsperre), Abel Aoun (@bzah), Éric Dupuis (@coxipi), Travis Logan (@tlogan2000), Pascal Bourgault (@aulemahal).

New features and enhancements

  • The general xclim description and ReadMe have been updated to reflect recent enhancements. (GH/1185, PR/1209).
  • Documentation now supports intersphinx mapping references within code examples via sphinx-codeautolink and copying of code blocks via sphinx-copybutton. (PR/1182).
  • Log-logistic distribution added to stats.py for use with standardized_precipitation_index and standardized_precipitation_evapotranspiration_index. (GH/1141, PR/1183).
  • New option in many indices allowing for resampling in given periods after run_length operations. (GH/505, GH/916, GH/917, PR/1161).
  • New base indicator class for sdba: StatisticalPropertyMeasure, those measures that also reduce the time (as a property does). (PR/1198).
  • xclim.core.calendar.common_calendar to find the best calendar to use when uniformizing an heterogeneous collection of data. (PR/1217).
  • xclim.ensembles.create_ensemble now accepts calendar=None, and uses the above function to guess the best one. It also now accepts cal_kwargs to fine tune the calendar conversion. (GH/1190, PR/1217).
  • New data check : xclim.core.datachecks.check_common_time that ensures all inputs of multivariate indicators have the same frequency (and the same time anchoring for daily and hourly data). (GH/1111, PR/1217).

New indicators

  • New indices first_day_temperature_{above | below} and indicators xclim.indices.first_day_{tn | tg | tx}_{above | below}. These indices/indicators accept operator (op) keyword for finer threshold comparison controls. (GH/1175, PR/1186).
  • New generic indice cumulative_difference for calculating difference between values and thresholds across time (e.g. temperature: degree-days, precipitation: moisture deficit), with or without resampling/accumulating by frequency. (PR/1202).
  • New spatial sdba properties and measures : spatial_correlogram, scorr and first_eof. The later needs the optional dependency eofs. (PR/1198).

Breaking changes

  • Indices that accept lat or lon coordinates in their call signatures will now use cf-xarray accessors to gather these variables in the event that they are not explicitly supplied. (PR/1180). This affects the following:
    • huglin_index, biologically_effective_degree_days, cool_night_index, latitude_temperature_index, water_budget, potential_evapotranspiration
  • cool_night_index now optionally accepts lat: str = "north" | "south" for calculating CNI over DataArrays lacking a latitude coordinate. (PR/1180).
  • The offset value in standardized_precipitation_evapotranspiration_index is changed to better reproduce results in the reference library monocongo/climate_indices. (GH/1141, PR/1183).
  • The first_day_below and first_day_above indices are now deprecated in order to clearly communicate the variables they act upon (GH/1175, PR/1186). The suggested migrations are as follows:
    • xclim.indices.first_day_above -> xclim.indices.first_day_temperature_above
    • xclim.indices.first_day_below -> xclim.indices.first_day_temperature_below
  • The first_day_below and first_day_above atmos indicators are now deprecated in order to clearly communicate the variables they act upon (GH/1175, PR/1186). The suggested migrations are as follows:
    • xclim.atmos.first_day_above -> xclim.indices.first_day_{tn | tg | tx}_above
    • xclim.atmos.first_day_below -> xclim.indices.first_day_{tn | tg | tx}_below
  • The degree_days generic indice has been deprecated in favour of cumulative_difference that is not limited only to temperature variables (GH/1200, PR/1202). The indices for atmos.{heating | cooling | growing}_degree_days are now built from generic.cumulative_difference.
  • Running pytest now requires the pytest-xdist distributed testing dependency. This library has been added to the dev requirements and conda environment configuration. (PR/1203).
  • Parameters reducer and window in xclim.indices.rle_statistics are now positional. (PR/1161).
  • The relative_annual_cycle_amplitude and annual_cycle_amplitude have been rewritten to match the version defined in the VALUE project, outputs will change drastically (for the better) (PR/1198).
  • English indicator metadata has been adjusted to remove frequencies from fields in the long_name of indicators. English indicators now have an explicit title and abstract. (GH/936, PR/1123).
  • French indicator metadata translations are now more uniform and more closely follow agreed-upon grammar conventions, while also removing frequency fields in long_name_fr. (GH/936, PR/1123).
  • The freshet_start indice is now deprecated in favour of first_day_temperature_above with thresh='0 degC', window=5. The freshet_start indicator is now based on first_day_temperature_above, but is otherwise unaffected. (GH/1195, PR/1196).
  • Call signatures for several indices/indicators have been modified to optionally accept op for manually setting threshold comparison operators (GH/1194, PR/1197). The affected indices and indicators as follows:
    • hot_spell_max_length, hot_spell_frequency, cold_spell_days, cold_spell_frequency, heat_wave_index, warm_day_frequency (indice only), warm_night_frequency (indice only), dry_days, wetdays, wetdays_prop.
  • Cleaner xclim.core.calendar.parse_offset : fails on invalid frequencies, return implicit anchors (YS -> JAN, Y -> DEC) and implicit is_start_anchored (D -> True). (GH/1213, , PR/1217).

Bug fixes

  • The docstring of cool_night_index suggested that lat was an optional parameter. This has been corrected. (GH/1179, PR/1180).
  • The mean_radiant_temperature indice was accessing hardcoded lat and lon coordinates from passed DataArrays. This now uses cf-xarray accessors. (PR/1180).
  • Adopt (and adapt) unit registry declaration and preprocessors from cf-xarray to circumvent bugs caused by a refactor in pint 0.20. It also cleans the code a little bit. (GH/1211, PR/1212).

Internal changes

  • The documentation build now relies on sphinx-codeautolink and sphinx-copybutton. (PR/1182).
  • Many docstrings did not fully adhere to the numpy docstring format. Fields and entries for many classes and functions have been adjusted to adhere better. (PR/1182).
  • The xdoctest namespace now provides access to session-scoped {variable}_dataset accessors, as well as a path_to_atmos_file object. These can be used for running doctests on all variables made in the pytest atmosds() fixture. (PR/1882).
  • Upgrade CodeQL GitHub Action to v2. (GH/1188, PR/1189).
  • New generic index first_day_threshold_reached is now used to compose all first_day_XYZ indices. (GH/1175, PR/1186).
  • In order to reduce computation footprint, the GitHub CI full testing suite and doctests are now only run once a pull request has been reviewed and approved. The number of simultaneously triggered builds has also been reduced. (GH/1155, PR/1203).
  • ReadTheDocs now only builds full documentation (including running notebooks) when pull requests are merged to the main branch. (GH/1155, PR/1203).
  • xclim now leverages pytest-xdist to distribute tests among Python workers and significantly speed up the testing suite. (PR/1203).
  • show_versions can now accept a list of dependencies so that other libraries can make use of this utility. (PR/1215).
  • Pull Requests now are automatically tagged (CI, docs, indicators, and/or sdba) according to files modified using the GitHub Labeler Action. (PR/1214).

Don't miss a new xclim release

NewReleases is sending notifications on new releases.