From 97404aef0d3e622de118b70fc35c14015048aa93 Mon Sep 17 00:00:00 2001 From: Tara Date: Sat, 14 Sep 2024 04:03:03 -0600 Subject: [PATCH] enable `save_kmz` for wrapped ifg by fixing `plot.scale_data2disp_unit()` (#1269) enable `save_kmz.py` for the wrapped interferograms from isce2, by not grabbing the `WAVELENGTH` metadata in the `utils.plot.scale_data2disp_unit()` when unnecessary. --- src/mintpy/utils/plot.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/mintpy/utils/plot.py b/src/mintpy/utils/plot.py index 816ec9211..3ef5c5db0 100644 --- a/src/mintpy/utils/plot.py +++ b/src/mintpy/utils/plot.py @@ -1683,21 +1683,23 @@ def scale_data2disp_unit(data=None, metadata=dict(), disp_unit=None): elif data_unit[0] == 'km': scale *= 1000. elif data_unit[0] == 'radian': - phase2range = -float(metadata['WAVELENGTH']) / (4*np.pi) - if disp_unit[0] == 'mm': scale *= phase2range * 1000.0 - elif disp_unit[0] == 'cm': scale *= phase2range * 100.0 - elif disp_unit[0] == 'dm': scale *= phase2range * 10.0 - elif disp_unit[0] == 'm' : scale *= phase2range * 1.0 - elif disp_unit[0] == 'km': scale *= phase2range * 1/1000.0 - elif disp_unit[0] in ['in','inch']: scale *= phase2range * 39.3701 - elif disp_unit[0] in ['ft','foot']: scale *= phase2range * 3.28084 - elif disp_unit[0] in ['yd','yard']: scale *= phase2range * 1.09361 - elif disp_unit[0] in ['mi','mile']: scale *= phase2range * 0.000621371 - elif disp_unit[0] in ['radians','radian','rad','r']: + if disp_unit[0] in ['radians','radian','rad','r']: pass else: - print('Unrecognized phase/length unit:', disp_unit[0]) - pass + # grab WAVELENGTH only if disp_unit[0] is not radian + phase2range = -float(metadata['WAVELENGTH']) / (4*np.pi) + if disp_unit[0] == 'mm': scale *= phase2range * 1000.0 + elif disp_unit[0] == 'cm': scale *= phase2range * 100.0 + elif disp_unit[0] == 'dm': scale *= phase2range * 10.0 + elif disp_unit[0] == 'm' : scale *= phase2range * 1.0 + elif disp_unit[0] == 'km': scale *= phase2range * 1/1000.0 + elif disp_unit[0] in ['in','inch']: scale *= phase2range * 39.3701 + elif disp_unit[0] in ['ft','foot']: scale *= phase2range * 3.28084 + elif disp_unit[0] in ['yd','yard']: scale *= phase2range * 1.09361 + elif disp_unit[0] in ['mi','mile']: scale *= phase2range * 0.000621371 + else: + print('Unrecognized phase/length unit:', disp_unit[0]) + pass # amplitude/coherence unit - 1 elif data_unit[0] == '1':