-
Notifications
You must be signed in to change notification settings - Fork 41
Add Sampled Cross-Sections #1321
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
base: main
Are you sure you want to change the base?
Conversation
… line of intersection
Sampling along a transect is very similar in concept to the work I put together in #1271, however instead of sampling onto pixels in an Image, we sample points along the transect. |
Oh, if possible can you create a PR or changes directly to my PR. Are we planning to close it in favor of this? |
Let's keep the API changes in this PR and use #1317 for applications to vertical cross sections (i.e. the updates to the notebooks, etc.) Does that work? I'm happy to hop on sometime this week to pair program too. |
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
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.
Pull Request Overview
This PR adds comprehensive cross-section functionality for sampling data along constant latitude/longitude lines and arbitrary great circle arcs. The changes consolidate cross-section methods under the subset
namespace while deprecating existing methods and introduce a new sampled cross-section interface for data extraction.
- Adds new
UxDataArray.cross_section()
method for sampling along arbitrary great circle arcs and constant lat/lon lines - Moves existing cross-section methods from
cross_section
tosubset
namespace with deprecation warnings - Implements constrained latitude/longitude range support for subset operations
Reviewed Changes
Copilot reviewed 8 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
uxarray/subset/grid_accessor.py | Added new constant_latitude/longitude methods and interval methods with enhanced error handling |
uxarray/subset/dataarray_accessor.py | Added new constant_latitude/longitude methods with lon/lat range constraints |
uxarray/cross_sections/sample.py | New file implementing sampling functions for geodesic, constant latitude, and constant longitude cross-sections |
uxarray/cross_sections/grid_accessor.py | Deprecated existing methods with warnings and redirects to subset accessor |
uxarray/cross_sections/dataarray_accessor.py | Replaced with new callable cross-section interface and deprecated old methods |
test/test_cross_sections.py | Updated tests to use subset namespace and added new cross-section functionality tests |
docs/user-guide/cross-sections.ipynb | Updated documentation to showcase new cross-section sampling functionality |
docs/api.rst | Updated API documentation to reflect new structure |
Comments suppressed due to low confidence (1)
|
||
return self.uxda.isel(n_face=faces, inverse_indices=inverse_indices) | ||
|
||
def constant_longitude_interval( |
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.
The docstring contains a grammatical error: 'selecting all faces are within' should be 'selecting all faces that are within'
Copilot uses AI. Check for mistakes.
__doc__ = __call__.__doc__ | ||
|
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.
Setting __doc__
to __call__.__doc__
creates a circular reference since __call__
doesn't have its own docstring. This should either be removed or set to the actual docstring content.
__doc__ = __call__.__doc__ |
Copilot uses AI. Check for mistakes.
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 go, minor fixes. in comments.
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 to me except a small comment I've put into the cross-sections notebook (can you see it?)
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.
call still assumes 'n_face' exists, raise error here itself if not face-centered. Test for great clrcle case..
@njit(parallel=True) | ||
def _fill_numba(flat_orig, face_idx, n_face, n_steps): | ||
M = flat_orig.shape[0] | ||
out = np.full((M, n_steps), np.nan, flat_orig.dtype) |
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.
np.nan cannot be represented in integer dtype; this might raise or produce invalid values.
95e4532
to
4d90463
Compare
Closes #1318 #1319 #1320 #1296
Overview
UxDataArray.cross_section()
method, which can be used to sample along lines of constant lat/lon or arbitrary GCAscross_section
methods under thesubset
namespace and begins deprecation