diff --git a/CHANGES.rst b/CHANGES.rst index 65bf2f89f..55f5c5aad 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -15,6 +15,7 @@ New features and enhancements ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ * Added uncertainty partitioning method `lafferty_sriver` from Lafferty and Sriver (2023), which can partition uncertainty related to the downscaling method. (:issue:`1497`, :pull:`1529`). * Validate YAML indicators description before trying to build module. (:issue:`1523`, :pull:`1560`). +* 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. Breaking changes diff --git a/docs/notebooks/example/example.yml b/docs/notebooks/example/example.yml index 8ed2f8b2e..6b5201b5e 100644 --- a/docs/notebooks/example/example.yml +++ b/docs/notebooks/example/example.yml @@ -50,6 +50,12 @@ indicators: freq: default: YS references: ETCCDI + spring_fd: + compute: frost_days + parameters: + freq: AS-DEC + indexer: + month: [ 12, 1, 2 ] R95p: compute: extreme_precip_accumulation_and_days cf_attrs: diff --git a/pyproject.toml b/pyproject.toml index da066981e..04a9f612e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -149,7 +149,6 @@ values = [ "release" ] - [tool.codespell] skip = 'xclim/data/*.json,docs/_build,docs/notebooks/xclim_training/*.ipynb,docs/references.bib,__pycache__,*.nc,*.png,*.gz,*.whl' ignore-words-list = "absolue,astroid,bloc,bui,callendar,degreee,environnement,hanel,inferrable,lond,nam,nd,ressources,vas" diff --git a/xclim/data/schema.yml b/xclim/data/schema.yml index cc3a8f74d..97aed6791 100644 --- a/xclim/data/schema.yml +++ b/xclim/data/schema.yml @@ -19,7 +19,7 @@ indicator: missing_options: map(key=str(), required=False) notes: str(required=False) cf_attrs: any(list(include('cf_attrs')), include('cf_attrs'), required=False) - parameters: map(str(), num(), bool(), null(), include('parameter'), key=str(), required=False) + parameters: map(str(), num(), bool(), null(), include('parameter'), include('indexer'), key=str(), required=False) realm: str(required=False) references: str(required=False) title: str(required=False) @@ -29,10 +29,18 @@ cf_attrs: map(str(), key=str(), required=False) parameter: description: str(required=False) - default: any(str(), num(), bool(), null(), required=False) + default: any(str(), num(), bool(), null(), include('indexer'), required=False) choices: list(str(), required=False) units: str(required=False) +indexer: + drop: bool(required=False) + month: any(int(), list(int()), required=False) + season: any(str(), list(str()), required=False) + doy_bounds: list(int(), required=False, maxItems=2) + date_bounds: list(str(), required=False, maxItems=2) + include_bounds: any(bool(), list(bool(), bool()), required=False, maxItems=2) + variable: canonical_units: str(required=True) cell_methods: str(required=False)