File tree 1 file changed +5
-8
lines changed
mpas_analysis/shared/plot
1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change 20
20
import cartopy
21
21
import cartopy .crs as ccrs
22
22
import numpy
23
+ import shapely
23
24
import shapely .geometry
24
25
25
26
from geometric_features .plot import subdivide_geom
@@ -182,11 +183,7 @@ def _set_circular_boundary(ax):
182
183
183
184
def _get_bounds (fc ):
184
185
"""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
You can’t perform that action at this time.
0 commit comments