Skip to content

Commit

Permalink
Changes from review
Browse files Browse the repository at this point in the history
  • Loading branch information
aulemahal committed Oct 13, 2023
1 parent 972269e commit 641eeb5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 22 deletions.
4 changes: 2 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ New features and enhancements
* The testing suite now offers a means of running tests in "offline" mode (using `pytest-socket <https://github.com/miketheman/pytest-socket>`_ to block external connections). This requires a local copy of `xclim-testdata` to be present in the user's home cache directory and for certain `pytest` options and markers to be set when invoked. For more information, see the contributing documentation section for `Running Tests in Offline Mode`. (:issue:`1468`, :pull:`1473`).
* The `SKIP_NOTEBOOKS` flag to speed up docs builds is now documented. See the contributing documentation section `Get Started!` for details. (:issue:`1470`, :pull:`1476`).
* Refactored the indicators page with the addition of a search bar.
* Indicator ``generic.stats`` now accepts any frequency (previously only daily). (:pull:`1498`).
* Added argument ``out_units`` to ``select_resample_op`` to bypass limitations of ``to_agg_units`` in custom indicators. Add "var" to supported operations in ``to_agg_units``. (:pull:`1498`).

Bug fixes
^^^^^^^^^
Expand All @@ -21,8 +23,6 @@ Bug fixes
* Calling a ``sdba.map_blocks``-wrapped function with data chunked along the reduced dimensions will raise an error. This forbids chunking the trained dataset along the distribution dimensions, for example. (:issue:`1481`, :pull:`1482`).
* 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`).
* Indicator ``generic.stats`` now accepts any frequency (previously only daily). (:pull:`1498`).
* Added argument ``out_units`` to ``select_resample_op`` to bypass limitations of ``to_agg_units`` in custom indicators. Add "var" to supported operations in ``to_agg_units``. (:pull:`1498`).

Breaking changes
^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion xclim/core/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ def to_agg_units(
out.attrs["units"] = pint2cfunits(orig_u * freq_u)
else:
raise ValueError(
f"Unknown aggregation op {op}. Known ops are [min, max, mean, std, var, doymin, doymax, count, integral, sum]."
f"Unknown aggregation op {op}. Known ops are [min, max, amin, amax, mean, std, var, doymin, doymax, count, integral, sum]."
)

return out
Expand Down
23 changes: 7 additions & 16 deletions xclim/data/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@
"std": [
"écart-type"
],
"var": [
"variance"
],
"absamp": [
"amplitude absolue"
],
Expand Down Expand Up @@ -661,24 +664,12 @@
"title": "Valeur de retour",
"abstract": "Analyse fréquentielle selon un mode et une distribution."
},
"DISCHARGE_STATS": {
"long_name": "Statistique des débits quotidiens",
"description": "{op} {freq:f} des débits quotidiens ({indexer}).",
"title": "Calcul de statistiques sur des sous-périodes.",
"abstract": ""
},
"STATS": {
"long_name": "Statistique des valeurs quotidiennes",
"description": "{op} {freq:f} des valeurs quotidiennes ({indexer}).",
"long_name": "{op:nom} de la variable.",
"description": "{op:nom} {freq:f} da la variable ({indexer}).",
"title": "Calcul de statistiques sur des sous-périodes.",
"abstract": ""
},
"DISCHARGE_DISTRIBUTION_FIT": {
"long_name": "Paramètres d'une distribution {dist:f} d'une série de débits",
"description": "Paramètres d'une distribution {dist:f} d'une série de débits.",
"title": "Calcul les paramètres d'une distribution univariée pour une série de débits",
"abstract": ""
},
"FIT": {
"long_name": "Paramètres d'une distribution {dist:f}",
"description": "Paramètres d'une distribution {dist:f}.",
Expand Down Expand Up @@ -931,8 +922,8 @@
"abstract": "Calcule le premier jour d'une période où la température maximale quotidienne est plus élevée qu'un certain seuil durant un nombre de jours donné, limité par une date minimale."
},
"DEGREE_DAYS_EXCEEDANCE_DATE": {
"long_name": "Premier jour de l'année où l'intégral de la température moyenne quotidienne {op} {thresh} est au-dessus de {sum_thresh}, avec la somme cumulative à partir de {after_date}",
"description": "Premier jour de l'année où l'intégral des degrés-jours (ou température moyenne quotidienne {op} {thresh}) est au-dessus de {sum_thresh}, avec la somme cumulative à partir de {after_date}.",
"long_name": "Premier jour de l'année où l'intégrale de la température moyenne quotidienne {op} {thresh} est au-dessus de {sum_thresh}, avec la somme cumulative à partir de {after_date}",
"description": "Premier jour de l'année où l'intégrale des degrés-jours (ou température moyenne quotidienne {op} {thresh}) est au-dessus de {sum_thresh}, avec la somme cumulative à partir de {after_date}.",
"title": "Jour du dépassement des degrés-jours",
"abstract": "Jour de l'année où la somme des degrés-jours est au-dessus d'un seuil donné, survenant après une date donnée. Les degrés-jours sont calculés au-dessus ou en dessous d'un seuil de température donné."
},
Expand Down
4 changes: 2 additions & 2 deletions xclim/indicators/generic/_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ class GenericResampling(ResamplingIndicator):
title="Simple resampled statistic of the values.",
identifier="stats",
var_name="stat_{indexer}{op:r}",
long_name="{op} of variable",
description="{freq} {op} of variable ({indexer}).",
long_name="{op:noun} of variable",
description="{freq} {op:noun} of variable ({indexer}).",
compute=select_resample_op,
parameters=dict(out_units=None),
)
2 changes: 1 addition & 1 deletion xclim/indices/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def select_resample_op(
Reduce operation. Can either be a DataArray method or a function that can be applied to a DataArray.
freq : str
Resampling frequency defining the periods as defined in :ref:`timeseries.resampling`.
out_units : str, optional.
out_units : str, optional
Output units to assign. Only necessary if `op` is function not supported by :py:func:`xclim.core.units.to_agg_units`.
indexer : {dim: indexer, }, optional
Time attribute and values over which to subset the array. For example, use season='DJF' to select winter values,
Expand Down

0 comments on commit 641eeb5

Please sign in to comment.