insarlab / MintPy

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

pixel coordinate discrepancy between view.py and reference_point.py #941

Closed falkamelung closed 1 year ago

falkamelung commented 1 year ago

Description of the problem Although having carefully selected the reference point, I occasionally get the error message ValueError: input reference point is in masked OUT area defined by maskConnComp.h5!. Digging into this, I noticed that view.py and reference_point.py have different y/x coordinates for the same geographic coordinates.

I am using mintpy.reference.lalo = 25.8794,-80.1241. According to view.py, the radar coordinates are y/x= 1713.7/747.7 (see screenshot below, mask value=1). However, reference_point.py, which shows the same lat/long coordinates, shows y/x: (1711, 745). So the coordinates are off by 2 pixels??

reference_point.py /scratch/05861/tg851601/MiamiTsxSMD14/miaplpy_Surfside_2017_202106/network_sequential_3/inputs/ifgramStack.h5 -t /scratch/05861/tg851601/MiamiTsxSMD14/miaplpy_Surfside_2017_202106/network_sequential_3/smallbaselineApp.cfg -c /scratch/05861/tg851601/MiamiTsxSMD14/miaplpy_Surfside_2017_202106/network_sequential_3/avgSpatialCoh.h5 --lookup /scratch/05861/tg851601/MiamiTsxSMD14/miaplpy_Surfside_2017_202106/network_sequential_3/inputs/geometryRadar.h5
--------------------------------------------------
reading reference info from template: /scratch/05861/tg851601/MiamiTsxSMD14/miaplpy_Surfside_2017_202106/network_sequential_3/smallbaselineApp.cfg
input reference point in lat/lon: (25.8794, -80.1241)
input reference point in y/x: (1711, 745)
mask: maskConnComp.h5
Traceback (most recent call last):
  File "/work2/05861/tg851601/stampede2/code/rsmas_insar/sources/MintPy/src/mintpy/cli/reference_point.py", line 149, in <module>
    main(sys.argv[1:])
  File "/work2/05861/tg851601/stampede2/code/rsmas_insar/sources/MintPy/src/mintpy/cli/reference_point.py", line 141, in main
    inps = read_reference_input(inps)
  File "/work2/05861/tg851601/stampede2/code/rsmas_insar/sources/MintPy/src/mintpy/reference_point.py", line 360, in read_reference_input
    raise ValueError(msg)
ValueError: input reference point is in masked OUT area defined by maskConnComp.h5!

view.py showing different Y/X coordinates:

image

Full script that generated the error

PASTE CODE HERE

Full error message

PASTE ERROR MESSAGE HERE

System information

falkamelung commented 1 year ago

It turns out this is a missing-decimal issue (this is TerraSAR-X). If I give another decimal 25.87937,-80.12414 I get 1713/747 and it runs through. It would be good to have view.py would display an additional decimal if a high-enough zoom factor is reached.

 reference_point.py inputs/ifgramStack.h5 -c avgSpatialCoh.h5 --lookup inputs/geometryRadar.h5 -m maskConnComp.h5 -l 25.87937 -L -80.12414
--------------------------------------------------
input reference point in lat/lon: (25.87937, -80.12414)
input reference point in y/x: (1713, 747)
mask: maskConnComp.h5
yunjunz commented 1 year ago

I remember having similar issues before. Thank you @falkamelung for reporting this and locating the cause! It should have been fixed now by the PR above. Cheers.