Skip to content

Commit

Permalink
enable save_kmz for wrapped ifg by fixing `plot.scale_data2disp_uni…
Browse files Browse the repository at this point in the history
…t()` (#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.
  • Loading branch information
tshreve authored Sep 14, 2024
1 parent 08ae3f3 commit 97404ae
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/mintpy/utils/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down

0 comments on commit 97404ae

Please sign in to comment.