-
Notifications
You must be signed in to change notification settings - Fork 421
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
Decoding per second units #2418
Comments
The unit string |
@jthielen good question. After a bit more investigation, it appears to be in issue with the grib1 format used (on at least the GFS 1 degree analysis files), the files stored using grib2 (i.e., |
Is the workaround here to do: ds.Absolute_vorticity_isobaric.attrs['units'] = '1/s' ? Given this is the first time we've hit that, I'm not sure how prevalent the problem is. Right now, the balance of frequency vs. difficulty of working around slants to me in favor of not putting this in MetPy. |
Yes, that is a work around, but the error that comes out would in no way lead to understanding that this is even a units issue...took me a while to get to that is the error. These are the types of issues that will crop up from time to time as a result of not having full control over the data being used. I'm okay with not putting something into MetPy to cover this, but then how can we better warn the end user to allow them to more easily get to the needed work around of manually changing the units. Part of the issue is that this unit error will prevent even doing smoothing as the move to quantify the object occurs when you are using an xarray Dataarray object. So even when there is not calculation being performed, end users could find themselves flummoxed. |
🤮 |
From a UX point-of-view, given that xarray data structures are most likely where such "unclean" metadata would show up (compared to Pint quantities that users create themselves), would it make sense to intercept Pint errors in the xarray unit handling, and issue a more high-level error like "unit string '/s' on 'Absolute_vorticity_isobaric' cannot be parsed"? |
That's kind of the solution I was bouncing around in my head. |
What went wrong?
When using some old data available through NCEI, the units for
Absolute_vorticity_isobaric
are stored as/s
, which is not able to be correctly parsed by Pint to do any of our operations that require units. The error comes out and is documented in the traceback below. I think we'll be able to do something within theunits.py
to capture this to help our users, similar to dealing with the percent symbol.Operating System
MacOS
Version
1.2
Python Version
3.9
Code to Reproduce
Errors, Traceback, and Logs
The text was updated successfully, but these errors were encountered: