-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add support for met_em files #46
Conversation
I think the approach should be to bring these attributes into CF compliance. So, based on using cf_units (a python wrapper of UDUNITS-2, which defines CF compliance for units), all the units except for "Kelvin" in the table above are invalid and should be fixed (or removed if it's actually dimensionless or without real units). from cf_units import Unit
unit_list = ["meters2 MSL", "meter MSL", "fraction", "whoknows", "category", "Kelvin", "none", "0/1 Flag"]
for unit_str in unit_list:
try:
Unit(unit_str)
print(f"VALID: {unit_str}")
except:
print(f"INVALID: {unit_str}")
Yep, CF-appropriate case handling is indeed an upstream issue in MetPy (Unidata/MetPy#1362), and hopefully those same improvements will be brought over to cf-xarray when they eventually happen!
I say go ahead and just add them if they're missing! |
33eb071
to
509c96e
Compare
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Just popping in here to say I think this is looking really cool! |
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.
Looks good to me, just a suggestion to not lose CF compliance just to make Pint happy.
Co-authored-by: jthielen <[email protected]>
Thanks for the review :) |
Thanks 😊 |
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.
Thank you, @lpilz! This looks great!
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.
This looks great, @lpilz! Thanks for putting this together!
If ready, I say go ahead and merge.
Change Summary
We already have a discussion about adding support for
geo_em
files and I wanted to extend this to metgridmet_em
files in general. I have identified a number of specificmet_em
problems and wanted to get some input on how to approach them.My approach was to call
.metpy.quantify()
on all variables in amet_em
dataset I have and work through the problems sequentially. I finally managed to identify some issues with the variables which I wanted to present und discuss here.meters2 MSL
(it's a variance)units
anddescription
in configmeter MSL
units
anddescription
in configfraction
whoknows
category
Kelvin
none
0/1 Flag
_BOOLEAN_UNITS_ATTRS
0/1 Flag
_BOOLEAN_UNITS_ATTRS
Maybe @jthielen can say more to the case (in)-sensitivity but as I understood the issue it should already be upstream??
There are some units missing (like for
PRES
andST
) but I wanted to discuss how to proceed before simply adding those.Related issue number
Towards #36
Checklist