Skip to content

Speed up landice gridded_flood_fill with scipy.ndimage#948

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

Speed up landice gridded_flood_fill with scipy.ndimage#948
trhille wants to merge 1 commit intoMPAS-Dev:mainfrom
trhille:landice/speed_up_gridded_flood_fill

Conversation

@trhille
Copy link
Copy Markdown
Collaborator

@trhille trhille commented Mar 26, 2026

Speed up gridded_flood_fill with scipy.ndimage instead of nested loops. For the antarctica_8km_2024_01_29.nc, this reduced the time from about 7s to 0.005s. This could make it much more manageable to use high-resolution gridded data sets to determine cell spacing for large meshes.

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

Speed up gridded_flood_fill with scipy.ndimage instead of nested
loops. For the antarctica_8km_2024_01_29.nc, this reduced the time from
about 7s to 0.005s. This could make it much more manageable to use
high-resolution gridded data sets to determine cell spacing for
large meshes.
@trhille
Copy link
Copy Markdown
Collaborator Author

trhille commented Mar 26, 2026

Testing

When using the antarctica_1km_2024_01_29.nc source file, the current implementation of landice.mesh.gridded_flood_fill in main takes 495.47 seconds. With these changes, it takes 0.32 seconds.
@xylar @matthewhoffman, I think you'll like this :)

I still need to confirm that these result in similar masks.

@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:45
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