Skip to content

Commit

Permalink
Replace unary_union by union_all()
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyPechnikov committed Nov 30, 2024
1 parent 4a527ef commit 7ad2d85
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pygmtsar/pygmtsar/Stack_align.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def compute_align(self, geometry='auto', dates=None, n_jobs=-1, degrees=12.0/360
from tqdm.auto import tqdm
import joblib
import warnings
# supress warnings about unary_union future behaviour to replace None by empty collection
# supress warnings about unary_union/union_all() future behaviour to replace None by empty collection
warnings.filterwarnings('ignore')

if joblib_aligning_backend is not None:
Expand Down Expand Up @@ -396,7 +396,7 @@ def compute_align(self, geometry='auto', dates=None, n_jobs=-1, degrees=12.0/360
'noisepath': lambda p: list(p),
'calibpath': lambda p: list(p),
'orbitpath': 'min',
'geometry': lambda g: g.unary_union
'geometry': lambda g: g.union_all()
})
# update the main object for the merged subswaths
self.df = gpd.GeoDataFrame(df)
Expand Down
4 changes: 2 additions & 2 deletions pygmtsar/pygmtsar/Stack_reframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def _reframe_subswath(self, subswath, date, geometry, debug=False):
# define line covering some bursts to crop them
if isinstance(geometry, (gpd.GeoDataFrame, gpd.GeoSeries)):
# it does not work with numpy 2.0.0 for geometry.minimum_rotated_rectangle
geometry = geometry.unary_union
geometry = geometry.union_all()
assert not geometry is None, f'ERROR: subswath {subswath} is not covered, you need to exclude it.'

# convert to polygon when possible
Expand Down Expand Up @@ -311,7 +311,7 @@ def compute_reframe(self, geometry=None, n_jobs=-1, queue=16, caption='Reframing
dates = self.df.index.unique().values
subswaths = self.get_subswaths()
# approximate subswath geometries from GCP
geometries = {subswath: self.df[self.df.subswath==subswath].geometry.unary_union for subswath in subswaths}
geometries = {subswath: self.df[self.df.subswath==subswath].geometry.union_all() for subswath in subswaths}

records = []
# Applying iterative processing to prevent Dask scheduler deadlocks.
Expand Down
2 changes: 1 addition & 1 deletion pygmtsar/pygmtsar/datagrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def get_bounds(geometry):
elif isinstance(geometry, gpd.GeoDataFrame):
bounds = geometry.dissolve().envelope.item().bounds
elif isinstance(geometry, gpd.GeoSeries):
bounds = geometry.unary_union.envelope.bounds
bounds = geometry.union_all().envelope.bounds
elif isinstance(geometry, tuple):
# geometry is already bounds
bounds = geometry
Expand Down

0 comments on commit 7ad2d85

Please sign in to comment.