insarlab / MintPy

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

`lookup_geo2radar.py` error for subset dataset from Gamma #850

Open yunjunz opened 1 year ago

yunjunz commented 1 year ago

Description of the problem

Hi @ymcmrs, the lookup_geo2radar.py does not seem working for me, as shown in the error message below. Are you actively using this script? If not, we should either move this script to mintpy/legacy folder or remove it from the repo?

This script is using tqdm for the progress bar. Is it possible to replace it usage with mintpy.utils.ptime.progressBar object instead, to avoid this extra dependency?

Full script that generated the error

wget https://zenodo.org/record/3952950/files/WellsEnvD2T399.tar.xz
tar -xvJf WellsEnvD2T399.tar.xz
cd WellsEnvD2T399/mintpy
smallbaselineApp.py ${MINTPY_HOME}/mintpy/data/input_files/WellsEnvD2T399.txt
lookup_geo2radar.py inputs/geometryGeo.h5 -w ./inputs/geometryRadar.h5 

Full error message

(insar) yunjunz:~/data/test/WellsEnvD2T399/mintpy>$ lookup_geo2radar.py inputs/geometryGeo.h5 -w ./inputs/geometryRadar.h5 
Traceback (most recent call last):
  File "/Users/yunjunz/tools/miniconda3/envs/insar/bin/lookup_geo2radar.py", line 8, in <module>
    sys.exit(main())
  File "/Users/yunjunz/tools/MintPy/mintpy/lookup_geo2radar.py", line 278, in main
    future = parallel_process(data_parallel, function, n_jobs= proNumb, use_kwargs=False, front_num=1)
  File "/Users/yunjunz/tools/MintPy/mintpy/lookup_geo2radar.py", line 96, in parallel_process
    front = [function(**a) if use_kwargs else function(a) for a in array[:front_num]]
  File "/Users/yunjunz/tools/MintPy/mintpy/lookup_geo2radar.py", line 96, in <listcomp>
    front = [function(**a) if use_kwargs else function(a) for a in array[:front_num]]
  File "/Users/yunjunz/tools/MintPy/mintpy/lookup_geo2radar.py", line 166, in function
    grid_lat0 = griddata(points, zz1, (grid_x0, grid_y0), method='nearest')
  File "/Users/yunjunz/tools/miniconda3/envs/insar/lib/python3.8/site-packages/scipy/interpolate/_ndgriddata.py", line 258, in griddata
    return ip(xi)
  File "/Users/yunjunz/tools/miniconda3/envs/insar/lib/python3.8/site-packages/scipy/interpolate/_ndgriddata.py", line 111, in __call__
    return self.values[i]
IndexError: index 0 is out of bounds for axis 0 with size 0

System information

ymcmrs commented 1 year ago

Hi Yunjun,

Yes, you can move it to legacy or remove it from the repo.

I do not use it too often. Maybe useful for GAMMA users, when he/she wants to use PyAPS or ICAMS with a UTM lookup table, then this script can help them to generate radarCoord-lookup table as ISCE.

I have a quick check about your error, and it is caused by the rangeCoord in geometryGeo,h5, which starts from 100 (not from 0 or smaller than 0). This means the geometryGeo.h5 is a subset product.

The current version of lookup_geo2radar.py does not support subset file of geometryGeo.h5.

Regarding to tqdm, sure, we can replace it with ptim.progressBar if we want to keep using it.

Yunmeng

yunjunz commented 1 year ago

Thank you @ymcmrs for the checking. This is very helpful: I thought the script is not working ;) Since you are using it, it is useful to keep it as it is then.

I would suggest either adding the support or printing out a message saying "subset dataset is NOT supported" in this scenario.

Regarding to tqdm, sure, we can replace it with ptim.progressBar if we want to keep using it.

Yes please, whenever you got a chance.