-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dimensionless Units #55
Conversation
For developers: the unitless mapping table is read when the CMORizer object gets initialised (either directly, this is uncommon) or via the |
@pgierz , nice to see the |
Correct. At the end of the CMOR process, we need to have metadata attributes as defined in the CMOR Tables. |
Hi guys, just so I make sure I am following, this are the steps and tooling needed correct?
Any step missing? I'd suggest we start writing the dimensionless_unit_mappings yaml with just one variable to test, for example one of the salinities that @siligam have shown from his tables. |
Partially. The mappings are read and all are assigned to each |
Probably it would be a good idea to turn that into a unit test so it is run automatically. |
I will implement the tastcase for salinity using the dimensionless_unit_mappings feature. Just for reference, model-table unit listing https://notes.desy.de/CXe0axlgSbStWgOLjaXnlQ?view |
I'm not understanding something: don't the rules belong to the model side of things? Why would we need to append it to the rule and not to the CMOR object? The mapping is for the CMOR unit, not the model unit. Please guys, let me know if I need to reread the documentation or the code, I might be saying bullshit here |
This is badly documented, so read the code ;-) I am talking about the At the moment, it looks like this: >>> user_config_file = pathlib.Path("/some/file.yaml")
>>> f = yaml.safe_load(user_config_file)
>>> cmorizer = CMORizer.from_dict(f)
>>> type(cmorizer.rules)
list
>>> first_rule = cmorizer.rules[0]
>>> first_rule.model_variable
"sst"
>>> first_rule.cmor_variable
"sos"
>>> first_rule.dimensionless_unit_mappings
{"sst": {"0.001": "g/kg"}, "other_key": {"1": "µmol mol^-1"}, ...} Of course this example is nonsense, sst isn't a concentration, but just for illustrative purposes of what sorts of things are where in the objects. |
Yes, the units in the tables are the target, they are the convention. |
Better example in the example. SST isn't meaningful for this use case, we instead will test with salinity of the ocean (variable `so`) Co-authored-by: Miguel <63242832+mandresm@users.noreply.github.com>
…d a test for checking missing mapping in the dimensionless mapping (not yet working as the checker has not yet been implemented)
…ls/pymorize into feat/dimensionless-units
…er, and restructure handle_unit_conversion to have a better overview of the different steps on that function
…ls/pymorize into feat/dimensionless-units
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The unit tests are failing because of this:
FAILED tests/unit/test_units.py::test_units_with_g_kg_to_0001_g_kg - FileNotFoundError: [Errno 2] No such file or directory: '/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/data/dimensionless_mappings.yaml'
Somehow data is not included as resources in the pip package. I will take care of that tomorrow.
Blocked by #66 |
Tests are failing, I'll look into that on Monday |
…teps test (cherry picked from commit d5842c8)
Work for dimensionless units. Will close #54