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
In #967, we are implementing a new kind of indices for computing statistical properties of sdba outputs and inputs. In opposition to the conventional indices of the core library, they are unit-independent. The same function is meant to be used with any of the normal variables (tasmin, tasmax, pr, etc). As such, it's not possible to write a proper long name (and other attributes) on the generic indicator. For example, we can't write "Annual cycle amplitude of tasmax", because we don't know the variable name in advance and the formatter function doesn't look into the inputs' attributes.
I'm not sure how to go forward here.
The easiest idea could be to make the variable attributes accessible to the format string. For example, an indicator declared with long_name="Annual cycle amplitude of {da[name]}'. The Indicator.format function would send the attributes dict for each input variables, using the same names as in the indicator's signature. And it could add the variable's name to the dict, defaulting to the signature's name if the DataArray has no name (da.name or key). This way, we can't ensure the "name" field is always present.
However, this is prone to errors because we can't ensure the presence of any attributes (except "name").
Thoughts?
The text was updated successfully, but these errors were encountered:
In #967, we are implementing a new kind of indices for computing statistical properties of sdba outputs and inputs. In opposition to the conventional indices of the core library, they are unit-independent. The same function is meant to be used with any of the normal variables (tasmin, tasmax, pr, etc). As such, it's not possible to write a proper long name (and other attributes) on the generic indicator. For example, we can't write "Annual cycle amplitude of tasmax", because we don't know the variable name in advance and the formatter function doesn't look into the inputs' attributes.
I'm not sure how to go forward here.
The easiest idea could be to make the variable attributes accessible to the format string. For example, an indicator declared with
long_name="Annual cycle amplitude of {da[name]}'
. TheIndicator.format
function would send the attributes dict for each input variables, using the same names as in the indicator's signature. And it could add the variable's name to the dict, defaulting to the signature's name if the DataArray has no name (da.name or key
). This way, we can't ensure the "name" field is always present.However, this is prone to errors because we can't ensure the presence of any attributes (except "name").
Thoughts?
The text was updated successfully, but these errors were encountered: