Skip to content

Commit 0930d0c

Browse files
authored
Merge pull request #1072 from xylar/fix-inset-bounds
Fix inset bounds
2 parents 402df25 + 80c69bb commit 0930d0c

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

mpas_analysis/shared/plot/inset.py

+5-8
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import cartopy
2121
import cartopy.crs as ccrs
2222
import numpy
23+
import shapely
2324
import shapely.geometry
2425

2526
from geometric_features.plot import subdivide_geom
@@ -182,11 +183,7 @@ def _set_circular_boundary(ax):
182183

183184
def _get_bounds(fc):
184185
"""Compute the lon/lat bounding box for all transects and regions"""
185-
186-
bounds = shapely.geometry.GeometryCollection()
187-
for feature in fc.features:
188-
shape = shapely.geometry.shape(feature['geometry'])
189-
shape_bounds = shapely.geometry.box(*shape.bounds)
190-
bounds = shapely.geometry.box(*bounds.union(shape_bounds).bounds)
191-
192-
return bounds.bounds
186+
geometries = [shapely.geometry.shape(feature['geometry']) for feature
187+
in fc.features]
188+
unified_geometry = shapely.union_all(geometries)
189+
return unified_geometry.bounds

0 commit comments

Comments
 (0)