Draft
Conversation
banesullivan
commented
Jul 2, 2022
Comment on lines
+9
to
+11
| x = axes.get("X", [None])[0] | ||
| y = axes.get("Y", [None])[0] | ||
| z = axes.get("Z", [None])[0] |
Member
Author
There was a problem hiding this comment.
This just feels wrong
There was a problem hiding this comment.
I agree that is quite ugly.
Alternatives are
x = da.axes["X"][0] if "X" in da.cf else None
or in _get_array:
# if cf_xarray exists
return da.cf[key] # this falls back to usually xarray stuff if "key" is not interpretable using cf conventions
Member
Author
There was a problem hiding this comment.
Great! thank you for the suggestions
Codecov Report
@@ Coverage Diff @@
## main #31 +/- ##
==========================================
+ Coverage 90.73% 91.36% +0.63%
==========================================
Files 8 9 +1
Lines 205 220 +15
==========================================
+ Hits 186 201 +15
Misses 19 19
Continue to review full report at Codecov.
|
Collaborator
|
cc'ing @dcherian as a cf-xarray pro |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #15
I feel this should be double-checked by someone more familiar with CF conventions and how that accessor works.
Also, this should be tested against more datasets
cc @rabernat, any feedback here? The premise is that the new function added here can attempt to use
cf_xarrayto get the XYZ coordinate array names when the user does not specify names.In future work, this can be used to address #19