diff --git a/pygmtsar/pygmtsar/SBAS_geocode.py b/pygmtsar/pygmtsar/SBAS_geocode.py index 9a02009f..7620944f 100644 --- a/pygmtsar/pygmtsar/SBAS_geocode.py +++ b/pygmtsar/pygmtsar/SBAS_geocode.py @@ -12,7 +12,7 @@ class SBAS_geocode(SBAS_sbas): - def geocode_parallel(self, pairs=None, chunksize=None): + def geocode_parallel(self, pairs=None, coarsen=4, chunksize=None): """ Perform parallel geocoding of the interferograms. @@ -31,7 +31,7 @@ def geocode_parallel(self, pairs=None, chunksize=None): # build trans_dat, trans_ dat_inv and topo_ra grids for merged subswaths # for single-digit subswath the grids already created for interferogram processing if len(str(self.get_subswath())) > 1: - self.topo_ra_parallel() + self.topo_ra_parallel(coarsen=coarsen) # build geographic coordinates transformation matrix for landmask and other grids self.intf_ll2ra_matrix_parallel(pairs=pairs, chunksize=chunksize) diff --git a/pygmtsar/pygmtsar/SBAS_topo_ra.py b/pygmtsar/pygmtsar/SBAS_topo_ra.py index b423bf5e..22658178 100644 --- a/pygmtsar/pygmtsar/SBAS_topo_ra.py +++ b/pygmtsar/pygmtsar/SBAS_topo_ra.py @@ -100,7 +100,7 @@ def topo_ra_parallel(self, coarsen=4, interactive=False, **kwargs): # cleanup - sometimes writing NetCDF handlers are not closed immediately and block reading access import gc; gc.collect() - def get_topo_ra(self): + def get_topo_ra(self, chunksize=None): """ Get the radar topography grid. @@ -123,6 +123,9 @@ def get_topo_ra(self): import xarray as xr import dask.array + if chunksize is None: + chunksize = self.chunksize + def func(topo): # flip vertically for GMTSAR compatibility reasons topo = xr.DataArray(dask.array.flipud(topo), coords=topo.coords, attrs=topo.attrs, name=topo.name) @@ -131,6 +134,6 @@ def func(topo): return topo.rename({'a': 'y', 'r': 'x'}) return topo - topos = self.open_grids(None, 'topo_ra', func=func) + topos = self.open_grids(None, 'topo_ra', chunksize=chunksize, func=func) return topos[0] if len(topos)==1 else topos