-
Notifications
You must be signed in to change notification settings - Fork 45
Optimize point_within_gca by Eliminating Redundant Lat/Lon Conversions
#937
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
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
|
@philipc2 As we discussed in today's meeting, could you please suggest the new function API/signature for point_within_gca? I will then proceed with changing the function bodies :) |
|
This is one of the main sections we'd need to update: Lines 170 to 177 in 82e46b8
We should update the helper functions to take in both the Cartesian and LatLon versions of each point/gca. This may look like the following: point_within_gca(pt_cart, pt_latlon_rad, gca_cart, gca_latlon_rad, is_directed=False)In addition to this PR, I will look into getting #878 finished this week, which will ensure that the coordinates will always be normalized. I'll request a review from you once this is prepared. |
|
I'd like to also mention that we should try to avoid as many conversions between |
…_gca-latlon-conversion
|
@amberchen122 To answer your question uxarray/uxarray/grid/intersections.py Line 13 in 85748f1
|
Thank you for the clarification!
For this PR, would it be ok for me to update the function docstring to reflect what they are currently implementing? I will put a note in the comment about the modified parts(gca dimension, and fma flag) for future reference. |
sounds good! Yeah always keep the docstring updated with the current implementaton |
ASV BenchmarkingBenchmark Comparison ResultsBenchmarks that have improved:
Benchmarks that have stayed the same:
|
|
Closing this because of #1072 |
Closes #936
Overview
This PR addresses a performance issue in the
point_within_gcafunction, which unnecessarily re-converted lat/lon coordinates from Cartesian coordinates. Since Uxarray already stores lat/lon coordinates, they can be passed directly to avoid redundant computation. This change reduces time and space complexity while better aligning with the architecture.Proposed changes:
point_within_gcato accept lat_lon coordinatespoint_within_gca:gca_gca_intersectiongca_constLat_intersection_populate_face_latlon_boundtest files
PR Checklist
General
Testing
Documentation
_) and have been added todocs/internal_api/index.rstdocs/user_api/index.rstExamples
docs/examples/folderdocs/examples.rsttoctreedocs/gallery.ymlwith appropriate thumbnail photo indocs/_static/thumbnails/