insarlab / MintPy

Miami InSAR time-series software in Python
https://mintpy.readthedocs.io
Other
555 stars 244 forks source link

Can't load HyP3 `INSAR_ISCE_BURST` data in v1.6.0 #1198

Open Alex-Lewandowski opened 1 month ago

Alex-Lewandowski commented 1 month ago

Description of the problem

Running the load_data step on HyP3 INSAR_ISCE_BURST data results in a ValueError: Un-recognized Sentinel-1 satellite from {ref_granule}!

The issue is caused by this branch: https://github.com/insarlab/MintPy/blob/main/src/mintpy/prep_hyp3.py#L127-L133

Granule names in the INSAR_ISCE_BURST metadata start with "S1" (no "A" or "B"), so a ValueError is raised.

Full script that generated the error

smallbaselineApp.py config/path --work-dir data/path --dostep load_data

Full error message

Traceback (most recent call last):
  File "/home/jovyan/.local/envs/opensarlab_mintpy_recipe_book/bin/smallbaselineApp.py", line 10, in <module>
    sys.exit(main())
  File "/home/jovyan/.local/envs/opensarlab_mintpy_recipe_book/lib/python3.9/site-packages/mintpy/cli/smallbaselineApp.py", line 209, in main
    run_smallbaselineApp(inps)
  File "/home/jovyan/.local/envs/opensarlab_mintpy_recipe_book/lib/python3.9/site-packages/mintpy/smallbaselineApp.py", line 1155, in run_smallbaselineApp
    app.run(steps=inps.runSteps)
  File "/home/jovyan/.local/envs/opensarlab_mintpy_recipe_book/lib/python3.9/site-packages/mintpy/smallbaselineApp.py", line 908, in run
    self.run_load_data(sname)
  File "/home/jovyan/.local/envs/opensarlab_mintpy_recipe_book/lib/python3.9/site-packages/mintpy/smallbaselineApp.py", line 176, in run_load_data
    mintpy.cli.load_data.main(iargs)
  File "/home/jovyan/.local/envs/opensarlab_mintpy_recipe_book/lib/python3.9/site-packages/mintpy/cli/load_data.py", line 123, in main
    load_data(inps)
  File "/home/jovyan/.local/envs/opensarlab_mintpy_recipe_book/lib/python3.9/site-packages/mintpy/load_data.py", line 811, in load_data
    prepare_metadata(iDict)
  File "/home/jovyan/.local/envs/opensarlab_mintpy_recipe_book/lib/python3.9/site-packages/mintpy/load_data.py", line 632, in prepare_metadata
    prep_module.main(iargs)
  File "/home/jovyan/.local/envs/opensarlab_mintpy_recipe_book/lib/python3.9/site-packages/mintpy/cli/prep_hyp3.py", line 94, in main
    prep_hyp3(inps)
  File "/home/jovyan/.local/envs/opensarlab_mintpy_recipe_book/lib/python3.9/site-packages/mintpy/prep_hyp3.py", line 165, in prep_hyp3
    meta = add_hyp3_metadata(fname, meta, is_ifg=is_ifg)
  File "/home/jovyan/.local/envs/opensarlab_mintpy_recipe_book/lib/python3.9/site-packages/mintpy/prep_hyp3.py", line 140, in add_hyp3_metadata
    raise ValueError('Un-recognized Sentinel-1 satellite from {ref_granule}!')
ValueError: Un-recognized Sentinel-1 satellite from {ref_granule}!

System information

yunjunz commented 1 month ago

Could you post an example metadata file for the hyp3 INSAR_ISCE_BURST product here for reference?

@forrestfwilliams What would be a proper way to calculate the relative orbit number for the hyp3 INSAR_ISCE_BURST product? I would think it's doable using the burst_id.

Alex-Lewandowski commented 1 month ago

Hi @yunjunz,

Here is the metadata for a HyP3 INSAR_ISCE_BURST product: S1_213524_IW1_20170411_20170517_VV_INT80_8E81.txt

It includes the ASF reference and secondary burst SLC IDs and orbit numbers, but no full burst IDs or (as far as I know) a way to identify which S1 satellite acquired them.

Reference Granule: S1_213524_IW1_20170411T133605_VV_BD30-BURST
Secondary Granule: S1_213524_IW1_20170517T133607_VV_431B-BURST
Reference Pass Direction: DESCENDING
Reference Orbit Number: 16097
Secondary Pass Direction: DESCENDING
Secondary Orbit Number: 16622

The full burst IDs contain the path as the first set of digits. We could calculate paths with orbit numbers and knowledge of whether the data is from S1A or S1B. I don't think we have enough information for either of those options.

We could use asf_search to find the path with the SLC IDs but I bet that would be slow for deep stacks. @forrestfwilliams, is there a better way to find that info? Could we start including full burst IDs in INSAR_ISCE_BURST metadata?

yunjunz commented 1 month ago

Right, the following asf_search call works. But we don't want to add it to the mintpy dependency.

>>> import asf_search as asf
>>> asf.granule_search(['S1_213524_IW1_20170411T133605_VV_BD30-BURST'])[0].properties['pathNumber']
100

Given our discussion at #1162, it seems that the easiest way is to calculate and add the following metadata directly in both types of hyp3 products. Then we do not need to grab all the other parameters to do the calculation in mintpy.

Given that these metadata are not required for normal processing (just for HDF-EOS5 file generation only), I will go ahead and skip the calculation of relative_orbit and start/stopUTC for the INSAR_ISCE_BURST product, to let the code runs through.