geodesymiami / insarmaps

3 stars 0 forks source link

High-res mode hdfeos5_2json_mbtiles.py error because of missing X_STEP #64

Closed falkamelung closed 2 years ago

falkamelung commented 2 years ago

I get this error in high-res mode:

hdfeos5_2json_mbtiles.py $h5file ./JSON; json_mbtiles2insarmaps.py -u insaradmin -p Insar123 --host insarmaps.miami.edu -P rsmastest -U rsmas\@gmail.com --json_folder JSON --mbtiles_file JSON/${h5file%.*}.mbtiles
reading displacement data from file: S1_IW3_048_0081_0082_20191111_20220710_PS.he5 ...
reading mask data from file: S1_IW3_048_0081_0082_20191111_20220710_PS.he5 ...
Masking displacement
columns: 794
rows: 535
converted chunk 1
CENTER_LINE_UTC                    84491.0
LENGTH                             535
WIDTH                              794
atmos_correct_method               None
beam_mode                          IW
beam_swath                         3
first_date                         2019-11-11
first_frame                        81
flight_direction                   A
history                            2022-07-29
last_date                          2022-07-10
last_frame                         82
look_direction                     R
mission                            S1
post_processing_method             MintPy
prf                                1685.817302492702
processing_software                isce
processing_type                    LOS_TIMESERIES
relative_orbit                     48
scene_footprint                    POLYGON((-80.24501825972435 25.40592934967324,-80.38226295120795 26.08827048267932,-79.57237261770533 26.21792266462551,-79.43998442758554 25.536135756992806,-80.24501825972435 25.40592934967324))
wavelength                         0.05546576
Traceback (most recent call last):
  File "/home/centos/operations/rsmas_insar/sources/insarmaps_scripts/hdfeos5_2json_mbtiles.py", line 348, in <module>
    main()
  File "/home/centos/operations/rsmas_insar/sources/insarmaps_scripts/hdfeos5_2json_mbtiles.py", line 334, in main
    high_res_mode = attributes["X_STEP"] is not None and attributes["Y_STEP"] is not None
KeyError: 'X_STEP'

There is an easy fix by inserting

try:                                                                        
  high_res_mode = attributes["X_STEP"] is not None and attributes["Y_STEP"] is not None
except:                                                                     
     high_res_mode = None                                                                                                                                    

I could commit this but you might want to fix this in a different way.

stackTom commented 2 years ago

Fixed, please pull.