Skip to content

Performance Issue: Unnecessary Re-conversion of Coordinates in point_within_gca #936

Closed

Description

@amberchen122

Proposed new feature or change:

The current implementation of point_within_gca unnecessarily re-converts lat/lon coordinates from Cartesian coordinates, which negatively impacts performance.

The following lines re-compute lat/lon from Cartesian coordinates:

python

GCRv0_lonlat = np.array(
        _xyz_to_lonlat_rad_no_norm(gca_cart[0][0], gca_cart[0][1], gca_cart[0][2])
    )
GCRv1_lonlat = np.array(
    _xyz_to_lonlat_rad_no_norm(gca_cart[1][0], gca_cart[1][1], gca_cart[1][2])
)

However, Uxarray already stores lat/lon coordinates, which can be passed directly to avoid redundant computation. This approach reduces both time and space complexity while aligning better with the overall architecture.

Proposed Solution:

  • Pass the existing lat/lon coordinates directly to eliminate the unnecessary conversion.
  • Update upstream function calls to point_within_gca

Activity

  1. added
    improvement
    on Sep 4, 2024
  2. self-assigned this
    on Sep 4, 2024
  3. moved this from 📚 Backlog to 🏗 In progress in UXarray Developmenton Sep 4, 2024
  4. moved this from 🏗 In progress to ✅ Done in UXarray Developmenton Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

improvement

Type

No type

Fields

Priority

None yet

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions