Skip to content

Use scipy distance_transform_edt to replace slow loop#947

Draft
trhille wants to merge 1 commit intoMPAS-Dev:mainfrom
trhille:landice/speed_up_distance_calculation
Draft

Use scipy distance_transform_edt to replace slow loop#947
trhille wants to merge 1 commit intoMPAS-Dev:mainfrom
trhille:landice/speed_up_distance_calculation

Conversation

@trhille
Copy link
Copy Markdown
Collaborator

@trhille trhille commented Mar 25, 2026

Use scipy distance_transform_edt to replace slow loop, speeding up get_dist_to_edge_and_gl by orders of magnitude.

Checklist

  • User's Guide has been updated
  • Developer's Guide has been updated
  • API documentation in the Developer's Guide (api.rst) has any new or modified class, method and/or functions listed
  • Documentation has been built locally and changes look as expected
  • The E3SM-Project submodule has been updated with relevant E3SM changes
  • The MALI-Dev submodule has been updated with relevant MALI changes
  • Document (in a comment titled Testing in this PR) any testing that was used to verify the changes
  • New tests have been added to a test suite

Use scipy distance_transform_edt to replace slow loop, speeding up
get_dist_to_edge_and_gl by about five orders of magnitude.
@trhille
Copy link
Copy Markdown
Collaborator Author

trhille commented Mar 25, 2026

Testing

Testing on 8–30km Antarctica mesh.
With these changes: compass.landice.mesh.get_dist_to_edge_and_gl() took 0.05 seconds
With previous: compass.landice.mesh.get_dist_to_edge_and_gl() took 57.52 seconds

@matthewhoffman matthewhoffman added land ice in progress This PR is not ready for review or merging labels Mar 29, 2026
@matthewhoffman matthewhoffman marked this pull request as draft March 29, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in progress This PR is not ready for review or merging land ice

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants