Skip to content

Commit 67ffe57

Browse files
author
Gen Tolhurst
committed
simplify polygons to 100m resoltuion before plotting to speed up plots (from ~4 minutes to ~20 seconds)
1 parent 31b84a0 commit 67ffe57

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

acs_plotting_maps.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from matplotlib.colors import ListedColormap, BoundaryNorm, LinearSegmentedColormap
2020

2121
from shapely.geometry import box
22+
import shapely
2223

2324
import matplotlib as mpl
2425
mpl.rcParams['hatch.linewidth'] = 0.3
@@ -249,7 +250,7 @@ def __call__(self, name):
249250
# the data under the masked area is still loaded and computed, but not visualised
250251
base_name = name[4:] # Remove 'not_' prefix
251252
base_region = self(base_name).copy()
252-
base_region.crs = crs
253+
base_region = base_region.to_crs(crs = "GDA2020")
253254
# This mask is a rectangular box around the maximum land extent of Australia
254255
# with a buffer of 20 degrees on every side,
255256
# with the Australian land area cut out, only the ocean is hidden.
@@ -311,6 +312,9 @@ def update(self, *args, **kwargs):
311312
# Define the CRS of the shapefile manually
312313
australia = australia.to_crs(crs = "GDA2020")
313314

315+
tolerance = 0.001 # approx 100 m resolution
316+
australia[["geometry"]] =shapely.simplify(australia[["geometry"]], tolerance)
317+
314318
# This mask is a rectangular box around the maximum land extent of Australia
315319
# with a buffer of 10 degrees on every side,
316320
# with the Australian land area cut out so only the ocean is hidden.

0 commit comments

Comments
 (0)