Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

English and French metadata overhaul #1123

Merged
merged 141 commits into from
Nov 1, 2022
Merged
Show file tree
Hide file tree
Changes from 140 commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
0f06070
update HISTORY.rst
Zeitsperre Jul 7, 2022
a81d65b
English indicator metadata cleanup
Zeitsperre Jul 7, 2022
1391f65
update HISTORY.rst
Zeitsperre Jul 7, 2022
d627398
update HISTORY.rst
Zeitsperre Jul 7, 2022
b3acc28
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Jul 18, 2022
e0148c4
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Jul 21, 2022
ab5ee46
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Aug 2, 2022
c33055b
update english indicator metadata and associated tests
Zeitsperre Aug 2, 2022
6693128
synchronize conversion indicator metadata in English and French
Zeitsperre Aug 2, 2022
fecaae9
make fixme note about the shifting of lowercase in description fields…
Zeitsperre Aug 2, 2022
0ed6000
fix CHU test
Zeitsperre Aug 2, 2022
fdd23c0
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Aug 2, 2022
e60ce9c
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Aug 3, 2022
e5998ce
test fixes
Zeitsperre Aug 3, 2022
664fd33
journalière to quotidienne
Zeitsperre Aug 8, 2022
6d16368
Température quotidienne min/max → Température minimale/maximale quoti…
Zeitsperre Aug 8, 2022
a876bde
percentile -> centile
Zeitsperre Aug 8, 2022
27fa913
pluvieux -> avec précipitation, less use of plural form of "temperature"
Zeitsperre Aug 8, 2022
2b6f136
Update expected translation
Zeitsperre Aug 8, 2022
e1687b7
some precipitation indicator metadata fixes, update test
Zeitsperre Aug 8, 2022
f62d864
precipitation indicators
Zeitsperre Aug 9, 2022
b2df48a
Adjust metadata of dry_spell indicators
Zeitsperre Aug 9, 2022
c09e143
Remove mention of old argument in DC and FWI attrs
aulemahal Aug 9, 2022
49e9833
add missing titles
Zeitsperre Aug 9, 2022
87b09ef
Fixes for seaIce, wind, snow, and precipitation indicators
Zeitsperre Aug 9, 2022
554ac91
Fixes for streamflow and synoptic indicators
Zeitsperre Aug 9, 2022
8c3449d
fix FWI title
Zeitsperre Aug 9, 2022
547977a
fix failing test and update test failure message
Zeitsperre Aug 9, 2022
6ee7682
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Aug 11, 2022
f0cca55
synchronize temperature indicators, part 1
Zeitsperre Aug 11, 2022
6fe2ed9
basic temperature indicators and daily temperature range
Zeitsperre Aug 12, 2022
582e72c
fix formatting errors
Zeitsperre Aug 12, 2022
834d906
fix heat wave index thresh reference
Zeitsperre Aug 12, 2022
31f26ba
typo fixes
Zeitsperre Aug 12, 2022
290a0af
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Aug 17, 2022
3125450
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 17, 2022
3e8b76c
synchronize temperature indicators, part 2
Zeitsperre Aug 17, 2022
4e6c9f9
synchronize temperature indicators, part 3
Zeitsperre Aug 18, 2022
fa6d22a
add a relevant reference
Zeitsperre Aug 18, 2022
88a3f12
Adjust tests for new indicator descriptions
Zeitsperre Aug 18, 2022
6af62f7
Add missing indicator formatter params, correct "unkown" to "unknown"
Zeitsperre Aug 18, 2022
2654631
fix test that used unkown
Zeitsperre Aug 18, 2022
e4178ae
update HISTORY.rst
Zeitsperre Aug 19, 2022
9e43984
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Aug 19, 2022
f499d53
Apply suggestions from code review
Zeitsperre Aug 22, 2022
0fe28c0
Update xclim/data/fr.json
Zeitsperre Aug 22, 2022
4e72097
Address comments from @dompaq
Zeitsperre Aug 22, 2022
64c0ea8
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Aug 22, 2022
092a44d
Apply suggestions from code review
Zeitsperre Aug 22, 2022
dd62c25
temperatures should be singular
Zeitsperre Aug 24, 2022
3db4224
calendar date
Zeitsperre Aug 24, 2022
a64e736
typo fix
Zeitsperre Aug 24, 2022
7c5874a
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Aug 24, 2022
018618a
Apply suggestions from code review
Zeitsperre Aug 24, 2022
5bd03d0
Apply suggestions from code review
Zeitsperre Aug 24, 2022
721b807
fix GROWING_SEASON_END description, missing accents and punctuation, …
Zeitsperre Aug 24, 2022
d11ad68
réfrigérés -> climatisés
Zeitsperre Aug 24, 2022
9ad3dff
Update xclim/data/fr.json
Zeitsperre Aug 24, 2022
6464d59
CONSECUTIVE_FROST_DAYS fixes, add croissance to EFFECTIVE_GROWING_DEG…
Zeitsperre Aug 24, 2022
9632bff
Update xclim/data/fr.json
Zeitsperre Aug 24, 2022
1fc05da
Apply suggestions from code review
Zeitsperre Aug 24, 2022
c7887b6
Update xclim/data/fr.json
Zeitsperre Aug 24, 2022
ffa7095
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Aug 24, 2022
bce98fb
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Aug 29, 2022
f89e14a
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Aug 30, 2022
ee0a61a
Addressed French indicator translation comments
Zeitsperre Aug 30, 2022
4dcc370
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Aug 30, 2022
25c351d
fix test
Zeitsperre Aug 30, 2022
cab1692
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Aug 30, 2022
8ebcd9a
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Aug 30, 2022
2fb1b46
Remove deprecated types import
Zeitsperre Aug 31, 2022
ddefbc4
Address first round of comments from EmilieBresson
Zeitsperre Aug 31, 2022
16d6554
fix {freq} typos
Zeitsperre Aug 31, 2022
7a15f2f
Comments addressed, some English metadata adjustments, some notes add…
Zeitsperre Aug 31, 2022
7f66ac1
add warning to last_spring_frost about default options
Zeitsperre Aug 31, 2022
86e224a
mark parameters for many indicators as default (parametrizable)
Zeitsperre Aug 31, 2022
c4c7a98
2nd round of comments from EmilieBresson
Zeitsperre Aug 31, 2022
0da0f57
fix wrong parameter passed to indicator
Zeitsperre Aug 31, 2022
f3c1ec8
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Sep 1, 2022
741db93
address comments relevant to snow indices, given thresholds
Zeitsperre Sep 1, 2022
6c3a284
fix growing season indices docstring and metadata, numpy docstring de…
Zeitsperre Sep 1, 2022
c9e42cc
Apply suggestions from code review
tlogan2000 Sep 1, 2022
ccf13fa
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Sep 6, 2022
865e231
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Sep 6, 2022
ce91b30
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Sep 7, 2022
2465006
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Sep 12, 2022
2119a32
Address comments received through personal communication
Zeitsperre Sep 12, 2022
fd640a6
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Sep 15, 2022
cea4594
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Sep 30, 2022
e3ecd7a
oops
Zeitsperre Sep 30, 2022
35bae40
add huglin index translation, minor typo fixes
Zeitsperre Oct 3, 2022
d3dcd07
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Oct 4, 2022
39046db
fix freezethaw indicator metadata and translations
Zeitsperre Oct 5, 2022
eaacaaa
Address review comments and fix typos
Zeitsperre Oct 5, 2022
f714178
Address final review comments
Zeitsperre Oct 6, 2022
0490ad2
Adjust freezethaw spell expected descriptions, adjust test structure
Zeitsperre Oct 6, 2022
8fe3d8b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 6, 2022
a9f2c54
typo fix
Zeitsperre Oct 6, 2022
6139ab6
Apply suggestions from code review
Zeitsperre Oct 6, 2022
20106ac
d' -> des
Zeitsperre Oct 6, 2022
575ebc2
deprecate freshet_start indice, wrap freshet_start indicator using fi…
Zeitsperre Oct 7, 2022
eae8e5b
Integrate operators into hot_spell_max_length, hot_spell_frequency, c…
Zeitsperre Oct 7, 2022
80f5249
typo fixes
Zeitsperre Oct 7, 2022
2a121ea
update HISTORY.rst
Zeitsperre Oct 7, 2022
3d032a0
revert unnecessary default parameters
Zeitsperre Oct 7, 2022
7f0fdc9
update HISTORY.rst
Zeitsperre Oct 7, 2022
8f7756a
update tests
Zeitsperre Oct 7, 2022
0639563
Deprecate `freshet_start` indice (#1196)
Zeitsperre Oct 7, 2022
32647b9
Merge branch 'french_metadata_overhaul' into fix_1194
Zeitsperre Oct 7, 2022
8995ba2
Adopt operators in warm/cold spell, dry, and wet days indices (#1197)
Zeitsperre Oct 7, 2022
deced3a
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Oct 13, 2022
b093a97
remove now-unnecessary fields from params_formatter
Zeitsperre Oct 13, 2022
2b34625
synchronize csdi and wsdi
Zeitsperre Oct 13, 2022
67f0d47
conversion with long_name keys
Zeitsperre Oct 24, 2022
3ec2d5f
rainfrzgr with long_name keys
Zeitsperre Oct 24, 2022
3ff9c93
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Oct 25, 2022
865104a
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Oct 25, 2022
b27808e
precipitation indicators with long_name keys
Zeitsperre Oct 28, 2022
4c4000e
wind indicators with long_name keys
Zeitsperre Oct 28, 2022
5ae4117
sea_ice indicators with long_name keys
Zeitsperre Oct 28, 2022
b3c934d
streamflow indicators with long_name keys
Zeitsperre Oct 28, 2022
b6e0031
temperature indicators with long_name keys - part 1
Zeitsperre Oct 28, 2022
199e53a
temperature indicators with long_name keys - part 2
Zeitsperre Oct 28, 2022
271aa81
field order, minor typos, degree-days indicators
Zeitsperre Oct 31, 2022
f614ac2
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Oct 31, 2022
86cd62e
docstring consistency
Zeitsperre Oct 31, 2022
9dd6930
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Oct 31, 2022
87320ff
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Oct 31, 2022
44bcc1d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 31, 2022
646ef24
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Oct 31, 2022
6b31e42
wsdi
Zeitsperre Oct 31, 2022
c091768
agroclimate indices
Zeitsperre Oct 31, 2022
5ffaad4
fix tests
Zeitsperre Oct 31, 2022
3a982e2
more test fixes
Zeitsperre Oct 31, 2022
9600901
fix heat_wave_index docstring, fix after_date values
Zeitsperre Oct 31, 2022
8dc59df
Merge branch 'master' into french_metadata_overhaul
Zeitsperre Nov 1, 2022
a60c7f1
temporarily disable dded
Zeitsperre Nov 1, 2022
71945c3
fix bad kwarg
Zeitsperre Nov 1, 2022
407ab12
Revert "temporarily disable dded"
Zeitsperre Nov 1, 2022
af1ae71
remove lambda from long_name
Zeitsperre Nov 1, 2022
a17413a
more accurate HISTORY.rst
Zeitsperre Nov 1, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ New indicators

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. (:pull:`1180`). This affects the following
* 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. (:pull:`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. (:pull:`1180`).
* The offset value in ``standardized_precipitation_evapotranspiration_index`` is changed to better reproduce results in the reference library ``monocongo/climate_indices``.
* The offset value in ``standardized_precipitation_evapotranspiration_index`` is changed to better reproduce results in the reference library ``monocongo/climate_indices``. (:issue:`1141`, :pull:`1183`).
* The ``first_day_below`` and ``first_day_above`` indices are now deprecated in order to clearly communicate the variables they act upon (:issue:`1175`, :pull:`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``
Expand All @@ -36,6 +36,11 @@ Breaking changes
* Running `pytest` now requires the `pytest-dist` distributed testing dependency. This library has been added to the `dev` requirements and conda environment configuration. (:pull:`1203`).
* Parameters ``reducer`` and ``window`` in ``xclim.indices.rle_statistics`` are now positional. (:pull:`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) (:pull:`1198`).
* English indicator metadata has been adjusted to remove frequencies and other variable-sourced fields in the `long_name` of indicators. English indicators now have an explicit `title` and `abstract`. (:issue:`936`, :pull:`1123`).
* French indicator metadata translations are now more uniform and follow agreed-upon grammar conventions, removing variable-sourced fields in `long_name_fr`. (:issue:`936`, :pull:`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. (:issue:`1195`, :pull:`1196`).
* Call signatures for several indices/indicators have been modified to optionally accept `op` for manually setting threshold comparison operators (:issue:`1194`, :pull:`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``.

Bug fixes
^^^^^^^^^
Expand Down Expand Up @@ -111,7 +116,7 @@ Bug fixes
* Fixed some ``extlink`` warnings found in `sphinx` and configured ReadTheDocs to use `mamba` as the dependency solver. (:issue:`1139`, :pull:`1140`).
* Fixed some broken hyperlinks to articles, users, and external documentation throughout the code base and jupyter notebooks. (:pull:`1160`).
* Addressed a bug that was causing `pylint` to stackoverflow by removing it from the tox configuration. `pylint` should only be called from an active environment. (:pull:`1163`)
* Fixed kmeans_reduce_ensemble breaking when using dask arrays (:pull:`1170`)
* Fixed an issue with ``xclim.ensembles.kmeans_reduce_ensemble`` which caused it to fail when using dask arrays. (:pull:`1170`).
* Addressed a bug that was causing `pylint` to stackoverflow by removing it from the tox configuration. `pylint` should only be called from an active environment. (:pull:`1163`)

Internal changes
Expand Down
30 changes: 15 additions & 15 deletions xclim/core/formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@
from xclim.core.utils import InputKind, PercentileDataArray

DEFAULT_FORMAT_PARAMS = {
"tasmin_per_thresh": "{unkown}",
"tasmin_per_window": "{unkown}",
"tasmin_per_period": "{unkown}",
"tas_per_thresh": "{unkown}",
"tas_per_window": "{unkown}",
"tas_per_period": "{unkown}",
"tasmax_per_thresh": "{unkown}",
"tasmax_per_window": "{unkown}",
"tasmax_per_period": "{unkown}",
"pr_per_thresh": "{unkown}",
"pr_per_window": "{unkown}",
"pr_per_period": "{unkown}",
"tasmin_per_thresh": "{unknown}",
"tasmin_per_window": "{unknown}",
"tasmin_per_period": "{unknown}",
"tas_per_thresh": "{unknown}",
"tas_per_window": "{unknown}",
"tas_per_period": "{unknown}",
"tasmax_per_thresh": "{unknown}",
"tasmax_per_window": "{unknown}",
"tasmax_per_period": "{unknown}",
"pr_per_thresh": "{unknown}",
"pr_per_window": "{unknown}",
"pr_per_period": "{unknown}",
}


Expand All @@ -53,7 +53,8 @@ def __init__(
mapping : Mapping[str, Sequence[str]]
A mapping from values to their possible variations.
modifiers : Sequence[str]
The list of modifiers, must be the as long as the longest value of `mapping`. Cannot include reserved modifier 'r'.
The list of modifiers, must be the as long as the longest value of `mapping`.
Cannot include reserved modifier 'r'.
"""
super().__init__()
if "r" in modifiers:
Expand Down Expand Up @@ -431,8 +432,7 @@ def _call_and_add_history(*args, **kwargs):
def gen_call_string(funcname: str, *args, **kwargs):
"""Generate a signature string for use in the history attribute.

DataArrays and Dataset are replaced with their name, while Nones, floats,
ints and strings are printed directly.
DataArrays and Dataset are replaced with their name, while Nones, floats, ints and strings are printed directly.
All other objects have their type printed between < >.

Arguments given through positional arguments are printed positionnally and those
Expand Down
11 changes: 4 additions & 7 deletions xclim/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from inspect import Parameter, _empty # noqa
from io import StringIO
from pathlib import Path
from types import FunctionType
from typing import Callable, Mapping, NewType, Sequence

import numpy as np
Expand Down Expand Up @@ -47,14 +46,12 @@
}


def wrapped_partial(
func: FunctionType, suggested: dict | None = None, **fixed
) -> Callable:
def wrapped_partial(func: Callable, suggested: dict | None = None, **fixed) -> Callable:
"""Wrap a function, updating its signature but keeping its docstring.

Parameters
----------
func : FunctionType
func : Callable
The function to be wrapped
suggested : dict, optional
Keyword arguments that should have new default values but still appear in the signature.
Expand Down Expand Up @@ -97,14 +94,14 @@ def wrapped_partial(


# TODO Reconsider the utility of this
def walk_map(d: dict, func: FunctionType) -> dict:
def walk_map(d: dict, func: Callable) -> dict:
"""Apply a function recursively to values of dictionary.

Parameters
----------
d : dict
Input dictionary, possibly nested.
func : FunctionType
func : Callable
Function to apply to dictionary values.

Returns
Expand Down
Loading