-
Notifications
You must be signed in to change notification settings - Fork 16
Fix indexing on axis keys using generic map (related to spatial averaging) #172
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
Conversation
Hi @pochedls, this PR is ready for review. It fixes #163, My solution is to use a map of CF long and short keys to their generic versions for a more robust retrieval of coordinates. For example, |
Codecov Report
@@ Coverage Diff @@
## main #172 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 7 8 +1
Lines 369 381 +12
=========================================
+ Hits 369 381 +12
Continue to review full report at Codecov.
|
xcdat/bounds.py
Outdated
@@ -40,7 +40,7 @@ class BoundsAccessor: | |||
>>> lon_bounds = ds.bounds.get_bounds("lon") # or pass "longitude" | |||
>>> time_bounds = ds.bounds.get_bounds("time") | |||
|
|||
Add coordinate bounds for a specific axis if they don't exist: | |||
Add coordinate bounds for a specific axes if they don't exist: |
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.
Should this be "axis" (singular)?
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.
Hi Tom - this works and looks good to me. I didn't understand why you swapped axis / axes - it seemed like it may have made more sense before (looping over each axis (singular) in axes (plural)).
Thanks Steve, I think I got carried away with my find and replace and forgot the definition of axis/axes again for the 10th time. I pushed a fix, but I'll search again just in case. |
d2e5d37
to
722a014
Compare
- Add GENERIC_AXIS_MAP for mapping CF compliant keys to their generic representations - Add `_get_generic_axis_keys()` for proper indexing in spatial averaging methods - Update bounds methods to use `GENERIC_AXIS_MAP`
ecb78f9
to
1a33507
Compare
Description
Summary of Changes
GENERIC_AXES_MAP
for mapping CF compliant keys to their generic representations_get_generic_axis_keys()
for proper indexing in spatial averaging methodsGENERIC_AXES_MAP
Checklist
If applicable: