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

Handling of writing files with degree units #82

Open
znichollscr opened this issue Nov 6, 2024 · 0 comments
Open

Handling of writing files with degree units #82

znichollscr opened this issue Nov 6, 2024 · 0 comments
Labels
feature Related to a (new) feature

Comments

@znichollscr
Copy link
Contributor

The motivation

If you want to write files which have "degrees" units, input4mips-validation doesn't work in all cases. Specifically, any units like "degrees_north", "degrees_n", "degrees_east" will end up as "degrees" in the written file. The underlying cause is iris' units' sanitisation (SciTools/iris#6216), which makes sense for iris but isn't what we want here. The reason we hit this is that we go via iris to write netCDF files.

The proposed solution

One of two options:

Option 1: an automatic workaround, which puts the units back to what they were before writing the netCDF file to disk. Iris seems to be ok with updating units directly (via e.g. cube.units = "string"), even if the units aren't officially supported by udunits (like "degrees_south").

Option 2: raise a warning if we notice that the units have changed. The warning could suggest to users to either a) change their units or b) use the pattern of getting the cubes, then updating the cubes themselves, then writing (which is what I did for the MAC files, see

# Fix up some bugs from iris' conversion
).

Alternatives

Additional context

Re-riting of MAC files: https://github.com/climate-resource/input4mips_validation/blob/9f3462c77ebce974e2df02fbe5e45cf4f064c07a/scripts/add-input4mips-info-to-mac.py

@znichollscr znichollscr added the feature Related to a (new) feature label Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Related to a (new) feature
Projects
None yet
Development

No branches or pull requests

1 participant