From 7546eec366ddef100c3e84e0cdc7d2a1a2d3dacf Mon Sep 17 00:00:00 2001 From: Alexey Pechnikov Date: Sat, 21 Sep 2024 19:20:42 +0700 Subject: [PATCH] Use subswath offsets to define transcoding area in radar coordinates --- pygmtsar/pygmtsar/Stack_align.py | 8 +++++++- pygmtsar/pygmtsar/Stack_topo.py | 13 ++----------- pygmtsar/pygmtsar/Stack_trans.py | 4 +--- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/pygmtsar/pygmtsar/Stack_align.py b/pygmtsar/pygmtsar/Stack_align.py index 24fe662..336c78e 100644 --- a/pygmtsar/pygmtsar/Stack_align.py +++ b/pygmtsar/pygmtsar/Stack_align.py @@ -279,7 +279,13 @@ def subswaths_offsets(self, debug=False): subswaths = ''.join(map(str, subswaths)) if len(subswaths) == 1: - return + prm = self.PRM() + maxx, yvalid, num_patch = prm.get('num_rng_bins', 'num_valid_az', 'num_patches') + maxy = yvalid * num_patch + offsets = {'bottom': 0, 'extent': [maxy, maxx]} + if debug: + print ('offsets', offsets) + return offsets # calculate the offsets to merge subswaths prms = [] diff --git a/pygmtsar/pygmtsar/Stack_topo.py b/pygmtsar/pygmtsar/Stack_topo.py index 9dd318a..933299e 100644 --- a/pygmtsar/pygmtsar/Stack_topo.py +++ b/pygmtsar/pygmtsar/Stack_topo.py @@ -194,17 +194,8 @@ def block_phase_dask(block_topo, y_chunk, x_chunk, prm1, prm2): # immediately prepare PRM # here is some delay on the function call but the actual processing is faster offsets = self.subswaths_offsets(debug=debug) - # reference scene first subswath - prm0 = self.PRM() - if offsets is not None: - # multiple subswaths - maxy, maxx = offsets['extent'] - minh = offsets['bottom'] - else: - # one subswath - maxy, maxx = prm0.get('num_valid_az', 'num_rng_bins') - minh = 0 - del prm0, offsets + maxy, maxx = offsets['extent'] + minh = offsets['bottom'] def prepare_prms(pair, *args): date1, date2 = pair diff --git a/pygmtsar/pygmtsar/Stack_trans.py b/pygmtsar/pygmtsar/Stack_trans.py index e751815..011cc08 100644 --- a/pygmtsar/pygmtsar/Stack_trans.py +++ b/pygmtsar/pygmtsar/Stack_trans.py @@ -17,9 +17,7 @@ def define_trans_grid(self, coarsen): # select radar coordinates extent #rng_max, yvalid, num_patch = self.PRM().get('num_rng_bins', 'num_valid_az', 'num_patches') #azi_max = yvalid * num_patch - data = self.open_data(dates=[self.reference]) - rng_max = float(data.x[-1]) - azi_max = float(data.y[-1]) + azi_max, rng_max = self.subswaths_offsets()['extent'] #print ('azi_max', azi_max, 'rng_max', rng_max) # this grid covers the full interferogram area # common single pixel resolution