If you use pint
/cf-xarray
you avoid these sort of situations.
Some examples in the COSIMA recipes demonstrate the use of pint
/cf-xarray
. See:
If you use pint
/cf-xarray
you avoid these sort of situations.
Some examples in the COSIMA recipes demonstrate the use of pint
/cf-xarray
. See:
Your transport example is very nice @navidcy. Very clean. The pint
stuff is so easy that it almost disappears. I had to search to find where it was being used.
Thanks.
But, it’s not my example. It belongs to the COSIMA community.
Often in the COSIMA examples we see things like
variable / (1036 * 1e6) # convert to volume and sverdrups
or other seemingly ad-hoc conversions like that. We should strive to convert either via .pint.to('new unit')
or by dividing with another variable that has units attached to it.