geodesymiami / insarmaps

3 stars 0 forks source link

hdfeos5_2json_mbtiles.py #87

Open fukun364202818 opened 12 months ago

fukun364202818 commented 12 months ago

Description of the problem Hello! I generated KeyError when converting the .he5 file generated by save_hdfeos5.py using hdfeos5_2json_mbtiles.py: "Unable to synchronously open object (object 'latitude' doesn't exist)", then I looked at the .he5 file and found that there was indeed no latitude, longitude. Why is that? How do I fix this? thank you

Full script that generated the error Unable to synchronously open object (object 'latitude' doesn't exist)

read lat and long. MintPy doesn't seem to support this yet, so we use the raw h5 file object f = h5py.File(he_obj.file, "r") lats = np.array(f["HDFEOS"]["GRIDS"]["timeseries"]["geometry"]["latitude"]) lons = np.array(f["HDFEOS"]["GRIDS"]["timeseries"]["geometry"]["longitude"])

Full error message

Unable to synchronously open object (object 'latitude' doesn't exist)

System information

Operating system: Linux Python environment: conda MintPy version: 1.5.1 Your custom / default template file (if the bug is related to a specific dataset):

yunjunz commented 11 months ago

This is related to the insarmaps_scripts repo. The latitude and longitude dataset is included in the HDF-EOS5 file, as shown below using the FernandinaSenDT128 example dataset, as shown below.

I don't know how the script is run here. Maybe @falkamelung or @stackTom is more clear on how you run it or what is going on inside hdfeos5_2json_mbtiles.py.

(insar) yunjunz:~/data/test/FernandinaSenDT128/mintpy>$ gdalinfo S1_IW12_128_0593_0597_20141213_20160524.he5 
Driver: HDF5/Hierarchical Data Format Release 5
Files: S1_IW12_128_0593_0597_20141213_20160524.he5
Size is 512, 512
Metadata:
  access_mode=READ
  ALOOKS=5
  altitude=698834.2261352595
  ANTENNA_SIDE=-1
...
Subdatasets:
  SUBDATASET_1_NAME=HDF5:"S1_IW12_128_0593_0597_20141213_20160524.he5"://HDFEOS/GRIDS/timeseries/geometry/azimuthAngle
  SUBDATASET_1_DESC=[579x587] //HDFEOS/GRIDS/timeseries/geometry/azimuthAngle (32-bit floating-point)
  SUBDATASET_2_NAME=HDF5:"S1_IW12_128_0593_0597_20141213_20160524.he5"://HDFEOS/GRIDS/timeseries/geometry/height
  SUBDATASET_2_DESC=[579x587] //HDFEOS/GRIDS/timeseries/geometry/height (32-bit floating-point)
  SUBDATASET_3_NAME=HDF5:"S1_IW12_128_0593_0597_20141213_20160524.he5"://HDFEOS/GRIDS/timeseries/geometry/incidenceAngle
  SUBDATASET_3_DESC=[579x587] //HDFEOS/GRIDS/timeseries/geometry/incidenceAngle (32-bit floating-point)
  SUBDATASET_4_NAME=HDF5:"S1_IW12_128_0593_0597_20141213_20160524.he5"://HDFEOS/GRIDS/timeseries/geometry/latitude
  SUBDATASET_4_DESC=[579x587] //HDFEOS/GRIDS/timeseries/geometry/latitude (32-bit floating-point)
  SUBDATASET_5_NAME=HDF5:"S1_IW12_128_0593_0597_20141213_20160524.he5"://HDFEOS/GRIDS/timeseries/geometry/longitude
  SUBDATASET_5_DESC=[579x587] //HDFEOS/GRIDS/timeseries/geometry/longitude (32-bit floating-point)
  SUBDATASET_6_NAME=HDF5:"S1_IW12_128_0593_0597_20141213_20160524.he5"://HDFEOS/GRIDS/timeseries/geometry/slantRangeDistance
  SUBDATASET_6_DESC=[579x587] //HDFEOS/GRIDS/timeseries/geometry/slantRangeDistance (32-bit floating-point)
  SUBDATASET_7_NAME=HDF5:"S1_IW12_128_0593_0597_20141213_20160524.he5"://HDFEOS/GRIDS/timeseries/observation/displacement
  SUBDATASET_7_DESC=[36x579x587] //HDFEOS/GRIDS/timeseries/observation/displacement (32-bit floating-point)
  SUBDATASET_8_NAME=HDF5:"S1_IW12_128_0593_0597_20141213_20160524.he5"://HDFEOS/GRIDS/timeseries/quality/avgSpatialCoherence
  SUBDATASET_8_DESC=[579x587] //HDFEOS/GRIDS/timeseries/quality/avgSpatialCoherence (32-bit floating-point)
  SUBDATASET_9_NAME=HDF5:"S1_IW12_128_0593_0597_20141213_20160524.he5"://HDFEOS/GRIDS/timeseries/quality/temporalCoherence
  SUBDATASET_9_DESC=[579x587] //HDFEOS/GRIDS/timeseries/quality/temporalCoherence (32-bit floating-point)
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,  512.0)
Upper Right (  512.0,    0.0)
Lower Right (  512.0,  512.0)
Center      (  256.0,  256.0)
fukun364202818 commented 11 months ago

Thank you very much for your answer. I used the gdalinfo command to check the file name S1_IW12_128_0593_0597_20141213_20160524.he5 generated by the save_hdfeos5.py module. Specific information is as follows:

Subdatasets: SUBDATASET_1_NAME=HDF5:"S1_IW_127_0000_20220610_20230605.he5"://HDFEOS/GRIDS/timeseries/geometry/azimuthAngle SUBDATASET_1_DESC=[2833x3637] //HDFEOS/GRIDS/timeseries/geometry/azimuthAngle (32-bit floating-point) SUBDATASET_2_NAME=HDF5:"S1_IW_127_0000_20220610_20230605.he5"://HDFEOS/GRIDS/timeseries/geometry/height SUBDATASET_2_DESC=[2833x3637] //HDFEOS/GRIDS/timeseries/geometry/height (32-bit floating-point) SUBDATASET_3_NAME=HDF5:"S1_IW_127_0000_20220610_20230605.he5"://HDFEOS/GRIDS/timeseries/geometry/incidenceAngle SUBDATASET_3_DESC=[2833x3637] //HDFEOS/GRIDS/timeseries/geometry/incidenceAngle (32-bit floating-point) SUBDATASET_4_NAME=HDF5:"S1_IW_127_0000_20220610_20230605.he5"://HDFEOS/GRIDS/timeseries/geometry/slantRangeDistance SUBDATASET_4_DESC=[2833x3637] //HDFEOS/GRIDS/timeseries/geometry/slantRangeDistance (32-bit floating-point) SUBDATASET_5_NAME=HDF5:"S1_IW_127_0000_20220610_20230605.he5"://HDFEOS/GRIDS/timeseries/observation/displacement SUBDATASET_5_DESC=[30x2833x3637] //HDFEOS/GRIDS/timeseries/observation/displacement (32-bit floating-point) SUBDATASET_6_NAME=HDF5:"S1_IW_127_0000_20220610_20230605.he5"://HDFEOS/GRIDS/timeseries/quality/avgSpatialCoherence SUBDATASET_6_DESC=[2833x3637] //HDFEOS/GRIDS/timeseries/quality/avgSpatialCoherence (32-bit floating-point) SUBDATASET_7_NAME=HDF5:"S1_IW_127_0000_20220610_20230605.he5"://HDFEOS/GRIDS/timeseries/quality/temporalCoherence SUBDATASET_7_DESC=[2833x3637] //HDFEOS/GRIDS/timeseries/quality/temporalCoherence (32-bit floating-point) Corner Coordinates: Upper Left ( 0.0, 0.0) Lower Left ( 0.0, 512.0) Upper Right ( 512.0, 0.0) Lower Right ( 512.0, 512.0) Center ( 256.0, 256.0)

Output information display no / / HDFEOS/GRIDS/timeseries/geometry/latitude and / / HDFEOS/GRIDS timeseries/geometry/longitude. Why is that? Did I use the save_hdfeos5.py command incorrectly? Could you tell me how to use it correctly? Thank you very much.