You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
raiseKeyError(f"{axis} bounds were not found, they must be added.")
Describe the solution you'd like
There are several reasons for why coord bounds can't be retrieved (#164 (comment)):
I plan on opening a separate PR to improve error messages when attempting to fetch coordinate variables or bounds data variables using cf_xarray and CF-compliant "axis" and/or "standard_name" attributes.
This KeyError is possibly being raised because:
There is no Z coordinate variable
There is a Z coordinate variable, but the "axis" attribute is not set to "Z"
There is a Z coordinate variable and the "axis" attribute is set to "Z", but the "bounds" attribute is not set to the name of the bounds data variable
The bounds data var doesn't exist and need to be added.
We need a clearer error message based on which case is true.
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered:
@tomvothecoder FYI, the upcoming Python 3.11 release (October 2022) plans to include "Fine-Grained Error Locations in Tracebacks" which looks like a great improvement over 3.10 and earlier. The Exception Groups also looks like a great optimization.
Might be useful to ponder as you're working on this feature
Is your feature request related to a problem?
In PR #246, a new method called
_get_coord_var()
was added, which checks if the supplied axis key can be interpreted using theaxis
attribute:xcdat/xcdat/axis.py
Lines 327 to 355 in 350ac8b
However, when attempting to retrieve coord bounds, we raise an ambiguous error message if they aren't found:
xcdat/xcdat/bounds.py
Lines 179 to 183 in 350ac8b
Describe the solution you'd like
There are several reasons for why coord bounds can't be retrieved (#164 (comment)):
We need a clearer error message based on which case is true.
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: