You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating a new indicator in a "virtual" module, and pointing the "base" indicator to one of the "xclim.generic.*" indicators, constructing the module fails with:
ValueError: Requested base class stats is neither in the indicators registry nor in base classes registry.
Steps To Reproduce
The following yaml module specification builds "QMOY" from xclim.generic.stats.
realm: landindicators:
JQ1MAXHP:
base: doy_qmaxinput:
da: dischargeparameters:
indexer: {month: [12, 1, 2, 3, 4, 5]}QMOY:
base: statsinput:
da: dischargeparameters:
op: mean
into test.yml.
import xclim as xc
xc.build_indicator_module_from_yaml('test.yml')
, where "generic" is absent. Moreover, all "generic" indicators are declared by instantiation of base classes imported from xclim.core.indicator. Which means the module assigned by the interpreter will be xclim.core.indicators, which will fail the test linked above anyway.
The way we decide which indicator is "core" and which isn't should be changed. For reference, the only difference between both is that "core" indicator are referred to in the registry by their identifier, while the others have a module name prepended (ex: "cf.TMMEAN", "anuclim.P1_ANNMEANTEMP" vs "TG_MEAN"). The registry key is what must be written in the "base:" field of a virtual module.
The short-term solution is to write "xclim.core.indicator.STATS" to use the generic "stats" indicator.
Contribution
I would be willing/able to open a Pull Request to address this bug.
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
Setup Information
Description
When creating a new indicator in a "virtual" module, and pointing the "base" indicator to one of the "xclim.generic.*" indicators, constructing the module fails with:
ValueError: Requested base class stats is neither in the indicators registry nor in base classes registry.
Steps To Reproduce
The following yaml module specification builds "QMOY" from
xclim.generic.stats
.into
test.yml
.Additional context
This is because of
xclim/xclim/core/indicator.py
Line 245 in b96daa2
xclim.core.indicator
. Which means the module assigned by the interpreter will bexclim.core.indicators
, which will fail the test linked above anyway.The way we decide which indicator is "core" and which isn't should be changed. For reference, the only difference between both is that "core" indicator are referred to in the registry by their identifier, while the others have a module name prepended (ex: "cf.TMMEAN", "anuclim.P1_ANNMEANTEMP" vs "TG_MEAN"). The registry key is what must be written in the "base:" field of a virtual module.
The short-term solution is to write "xclim.core.indicator.STATS" to use the generic "stats" indicator.
Contribution
Code of Conduct
The text was updated successfully, but these errors were encountered: