speed-up the function to add country borders and coastlines #1073
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