Skip to content
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 and other strange unit conversion #54

Closed
mandresm opened this issue Nov 7, 2024 · 3 comments · Fixed by #55
Closed

Dimensionless and other strange unit conversion #54

mandresm opened this issue Nov 7, 2024 · 3 comments · Fixed by #55
Assignees

Comments

@mandresm
Copy link
Contributor

mandresm commented Nov 7, 2024

Problem

Some units in the CMOR tables are listed as 0.001 or 1. At the same time, the model output also have similar units. These units typically correspond to dimensionless units for example for the salinity the unit in the CMOR tables is 0.001 which really means in pyhical terms g/Kg (dimensionless).

The problem is that if we want to achieve an automatic conversion of units we need to tell our tool what these 0.001 unit means physically (g/kg) (i.e. what is it's physical quantity), and that might vary from variable to variable.

Proposed solution

On the model side

Specify the "physical" unit in the rule of the input yaml file:

- rule:
    unit: g/kg

On the CMOR tables side

Yaml file that is part of Pymorize repo, co-develop with the power users

sst:
    "0.001": g/kg

This mapping can then be use to make pymorize and pint "understand" what the CMOR table means by 0.001

TODOS

  • [ ]
@pgierz
Copy link
Member

pgierz commented Nov 8, 2024

Recommendation to keep this easily configurable. In the main user-yaml, add a key/value for dimensionless_mapping_table: <some/path/to/a/file>, e.g. in examples/sample.yaml

general:
    .... metadata relevant for humans
pymorize:
  # parallel: True
  warn_on_no_rule: False
  use_flox: True
  cluster_mode: fixed
  fixed_jobs: 12
  # minimum_jobs: 8
  # maximum_jobs: 30
+ dimensionless_mapping_table: data/pymorize/dimensionless_mappings.yaml

@pgierz pgierz linked a pull request Nov 8, 2024 that will close this issue
@pgierz
Copy link
Member

pgierz commented Nov 8, 2024

Work on implementation in #55

@mandresm
Copy link
Contributor Author

mandresm commented Nov 8, 2024

Work on implementation in #55

Thanks @pgierz!

siligam added a commit that referenced this issue Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants