Skip to content

Commit

Permalink
utils0: use more hardwired EARTH_RADIUS if needed (insarlab#1261)
Browse files Browse the repository at this point in the history
+ `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
  • Loading branch information
yunjunz authored Aug 30, 2024
1 parent f5fc900 commit 08ae3f3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/mintpy/objects/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/mintpy/utils/utils0.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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':
Expand Down
15 changes: 15 additions & 0 deletions tests/objects/ionex.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -112,3 +125,5 @@ def test_get_ionex_value():
test_read_ionex()

test_get_ionex_value()

#test_plot_ionex()

0 comments on commit 08ae3f3

Please sign in to comment.