Ouranosinc / xclim

Library of derived climate variables, ie climate indicators, based on xarray.
https://xclim.readthedocs.io/en/stable/
Apache License 2.0
318 stars 55 forks source link

Use `units_metadata` where appropriate. #1822

Open aulemahal opened 1 month ago

aulemahal commented 1 month ago

Addressing a Problem?

It can sometimes be ambiguous whether a temperature represents a difference or an absolute measure.

Potential Solution

The CF conventions have a special way to distinguish between the two : http://cfconventions.org/Data/cf-conventions/cf-conventions-1.11/cf-conventions.html#temperature-units

Additional context

This would be complementary to #1804. That PR removed the ambiguous case that resulted in errors with pint. However, the new attribute could help in making the distinction more explicit. See discussion on the PR.

Contribution

Code of Conduct

huard commented 1 month ago

One issue is that pint2cfunits returns a string, while here we'd need to return a dict with units and unis_metadata.

One option would be to create pint2cfattrs, which would return a dict. This would not break anything.