Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inset bounds #1072

Merged
merged 1 commit into from
Mar 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions mpas_analysis/shared/plot/inset.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import cartopy
import cartopy.crs as ccrs
import numpy
import shapely
import shapely.geometry

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

def _get_bounds(fc):
"""Compute the lon/lat bounding box for all transects and regions"""

bounds = shapely.geometry.GeometryCollection()
for feature in fc.features:
shape = shapely.geometry.shape(feature['geometry'])
shape_bounds = shapely.geometry.box(*shape.bounds)
bounds = shapely.geometry.box(*bounds.union(shape_bounds).bounds)

return bounds.bounds
geometries = [shapely.geometry.shape(feature['geometry']) for feature
in fc.features]
unified_geometry = shapely.union_all(geometries)
return unified_geometry.bounds
Loading