From 08ae3f3081d3c3790cbdc3d68b93db84c287dd74 Mon Sep 17 00:00:00 2001 From: Zhang Yunjun Date: Fri, 30 Aug 2024 19:37:06 +0800 Subject: [PATCH] utils0: use more hardwired `EARTH_RADIUS` if needed (#1261) + `utils.utils0`: use more hardwired `EARTH_RADIUS` if needed, to be more tolerant of potential missing metadata + `tests.objects.ionex.py`: add `test_plot_ionex()` to plot an IONEX file easily in the command line, but did not call/test this function in the routine unit test. + `objects.sensor`: add more `Gaofen3` parameters --- src/mintpy/objects/sensor.py | 5 +++++ src/mintpy/utils/utils0.py | 4 ++-- tests/objects/ionex.py | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/mintpy/objects/sensor.py b/src/mintpy/objects/sensor.py index 1be4e7e09..600b8cb76 100644 --- a/src/mintpy/objects/sensor.py +++ b/src/mintpy/objects/sensor.py @@ -368,6 +368,7 @@ def get_unavco_mission_name(meta_dict): # Table 2 & 6 in https://directory.eoportal.org/web/eoportal/satellite-missions/g/gaofen-3 # https://www.eoportal.org/satellite-missions/gaofen-3 # Li et al. (2018, RS) at https://doi.org/10.3390/rs10121929 +# Table I in Yang et al. (2023, IEEE-TGRS) at https://doi.org/10.1109/TGRS.2023.3238707 GF3 = { # orbit 'altitude' : 755e3, # m @@ -377,7 +378,11 @@ def get_unavco_mission_name(meta_dict): 'carrier_frequency' : 5.4e9, # Hz 'antenna_length' : 15, # m 'antenna_width' : 1.5, # m + 'pulse_repetition_frequency' : 1412.18, # Hz + 'chirp_bandwidth' : 60.00e6, # Hz 'sampling_frequency' : 533.33e6, # Hz + 'azimuth_pixel_size' : 4.77, # m, FSII mode + 'range_pixel_size' : 2.25, # m, FSII mode } # Sentinel-1 Interferometric Wide (IW / TOPS) swath mode diff --git a/src/mintpy/utils/utils0.py b/src/mintpy/utils/utils0.py index fd603e8c7..d410a13af 100644 --- a/src/mintpy/utils/utils0.py +++ b/src/mintpy/utils/utils0.py @@ -194,7 +194,7 @@ def incidence_angle2slant_range_distance(atr, inc_angle): if isinstance(inc_angle, str): inc_angle = float(inc_angle) inc_angle = np.array(inc_angle, dtype=np.float32) / 180 * np.pi - r = float(atr['EARTH_RADIUS']) + r = float(atr.get('EARTH_RADIUS', EARTH_RADIUS)) H = float(atr['HEIGHT']) # calculate 2R based on the law of sines @@ -229,7 +229,7 @@ def azimuth_ground_resolution(atr): proc = atr.get('PROCESSOR', 'isce') if proc in ['roipac', 'isce']: - Re = float(atr['EARTH_RADIUS']) + Re = float(atr.get('EARTH_RADIUS', EARTH_RADIUS)) height = float(atr['HEIGHT']) az_step = float(atr['AZIMUTH_PIXEL_SIZE']) * Re / (Re + height) elif proc == 'gamma': diff --git a/tests/objects/ionex.py b/tests/objects/ionex.py index 319ba54fd..d4d272573 100755 --- a/tests/objects/ionex.py +++ b/tests/objects/ionex.py @@ -102,6 +102,19 @@ def test_get_ionex_value(): print(f'Interpolation method ({method:8s}) with rotation ({str(rotate):5s}): Pass.') +def test_plot_ionex(): + """Test mintpy.objects.ionex.plot_ionex()""" + # get IONEX file path + tec_file = ionex.get_ionex_filename( + date_str, + tec_dir=tec_dir, + sol_code=sol_code, + ) + + # plot IONEX file + ionex.plot_ionex(tec_file, save_fig=True) + + if __name__ == '__main__': print('-'*50) @@ -112,3 +125,5 @@ def test_get_ionex_value(): test_read_ionex() test_get_ionex_value() + + #test_plot_ionex()