From 647dd25189557e83f253df6f03b05d82bbcef45a Mon Sep 17 00:00:00 2001 From: Liang Yu Date: Mon, 21 Nov 2022 15:28:19 -0800 Subject: [PATCH] fix LUT axis vector size check (#87) * correctly check vector size * undo accident checkin --- src/s1reader/s1_burst_slc.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/s1reader/s1_burst_slc.py b/src/s1reader/s1_burst_slc.py index be2ead8f..35a25d1a 100644 --- a/src/s1reader/s1_burst_slc.py +++ b/src/s1reader/s1_burst_slc.py @@ -417,18 +417,22 @@ def _steps_to_vecs(self, range_step, az_step): err_str = f'Following step size(s) <=0: {step_errs}' raise ValueError(err_str) + # container to store names of axis vectors that are invalid: i.e. size 0 + vec_errs = [] + + # compute range vector n_range = np.ceil(self.width * self.range_pixel_spacing / range_step).astype(int) range_vec = self.starting_range + np.arange(0, n_range) * range_step + if range_vec.size == 0: + vec_errs.append('range') + # compute azimuth vector n_az = np.ceil(self.length * self.azimuth_time_interval / az_step).astype(int) rdrgrid = self.as_isce3_radargrid() az_vec = rdrgrid.sensing_start + np.arange(0, n_az) * az_step - - vec_errs = [] - if not range_vec: - vec_errs.append('range') - if not az_vec: + if az_vec.size == 0: vec_errs.append('azimuth') + if vec_errs: vec_errs = ', '.join(vec_errs) err_str = f'Cannot build aranges from following step(s): {vec_errs}'