Open navidcy opened 1 year ago
Often we see things like:
transport = ty_trans / 1034 / 1e5
to convert, e.g., ty_trans from kg/s to Sverdrup. (E.g. see https://cosima-recipes.readthedocs.io/en/latest/DocumentedExamples/Zonally_Averaged_Global_Meridional_Overturning_Circulation.html) But these conversions are ad hoc and one can easily make a mistake and forget a factor. A usual trick to see if we are missing a factor (e.g., forgot to divide by the depth of the fluid or by density) is to check the units. But if we are converting things like above there are no units attached.
ty_trans
pint and cf-xarray provide a way to attach units on variables.
pint
cf-xarray
Our aim is to have all documented examples use pint/cf-xarray for proper unit handling
The tutorial: https://cosima-recipes.readthedocs.io/en/latest/Tutorials/Model_Agnostic_Analysis.html
and the example: https://cosima-recipes.readthedocs.io/en/latest/DocumentedExamples/Transport_Through_Straits.html
are good starting points.
If during Hackathon v3.0, you wanna tackle updating one of the documented examples to use pint/cf-xarray then:
Often we see things like:
to convert, e.g.,
ty_trans
from kg/s to Sverdrup. (E.g. see https://cosima-recipes.readthedocs.io/en/latest/DocumentedExamples/Zonally_Averaged_Global_Meridional_Overturning_Circulation.html) But these conversions are ad hoc and one can easily make a mistake and forget a factor. A usual trick to see if we are missing a factor (e.g., forgot to divide by the depth of the fluid or by density) is to check the units. But if we are converting things like above there are no units attached.pint
andcf-xarray
provide a way to attach units on variables.Our aim is to have all documented examples use pint/cf-xarray for proper unit handling
The tutorial: https://cosima-recipes.readthedocs.io/en/latest/Tutorials/Model_Agnostic_Analysis.html
and the example: https://cosima-recipes.readthedocs.io/en/latest/DocumentedExamples/Transport_Through_Straits.html
are good starting points.