speed-up the function to add country borders and coastlines#1073
Merged
timschmi95 merged 3 commits intodevelopfrom Jul 11, 2025
Merged
speed-up the function to add country borders and coastlines#1073timschmi95 merged 3 commits intodevelopfrom
timschmi95 merged 3 commits intodevelopfrom
Conversation
Collaborator
Author
peanutfun
requested changes
Jul 10, 2025
Member
peanutfun
left a comment
There was a problem hiding this comment.
Thank you for the quick PR! 🙌
Please add two entries into the changelog, one for the change to add_shapes and the speedup of the plotting, and one for the change in mask_distance. Also, please make sure the pre-commit hooks run through. The code is not properly formatted by black, see the failing test.
@ValentinGebhart, please check if you concur with the changes to mask_distance.
Collaborator
|
Thanks @timschmi95! Very much agree with the new default value of |
Collaborator
Author
|
Changelog is updated and tests passing. Is it ready to merge then @peanutfun ? |
peanutfun
approved these changes
Jul 11, 2025
Member
peanutfun
left a comment
There was a problem hiding this comment.
Huh? I must have been confusing by you closing the issue already, @timschmi95. I thought it was already merged. Good to go! 🚀
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Changes proposed in this PR:
u_plot.add_shapesfunction. I've tested the new function in multiple tutorials and my own data (both with standard and projected coordinates) and the plots look equivalent.This PR fixes #1071
Substantially speeds up hazard.plot_intensity (and other functions that use
u_plot.add_shapes). Before the update, adding the country borders took up to 75% of the overall time, which is reduced to <1%, significantly speeding up the overall function.The change of the default mask_distance is somewhat independent. While testing many plots in the tutorial, we noticed in multiple instances the haz.plot_intensity() with the recently updated raster plotting functionality (PR #1047) showed small white gaps within gridded data, if there are fewer than ~80 regularly spaced gridpoints in one direction. Changing the default from 0.01 to 0.03 allows smooth plots for data with fewer (down to ~30) gridpoints per side, while keeping the default interpolation distance for data with gaps reasonably small.
Of course, users can always adjust the parameter depending on their data, but increasing the default will lead to fewer user seeing gaps in their gridded hazard data plot and needing to dig into the keyword arguments of the haz.plot_intensity() function.
PR Author Checklist
develop)PR Reviewer Checklist