geodesymiami / results

0 stars 0 forks source link

MintPy reference_point.py and view.py y/x lat/lon location discrepancy #4

Open falkamelung opened 2 years ago

falkamelung commented 2 years ago

As smallbaselineApp.py tells me that the selected reference point is I the masked out area, I used view.py to select a good reference point 19.0695, -98.6672:

image image

However, I am still getting an error:

reference_point.py /scratch1/05861/tg851601/PopocatepetlSenDT5/minopy/inputs/ifgramStack.h5 -t /scratch1/05861/tg851601/PopocatepetlSenDT5/minopy/sm
allbaselineApp.cfg -c /scratch1/05861/tg851601/PopocatepetlSenDT5/minopy/avgSpatialCoh.h5 --lookup /scratch1/05861/tg851601/PopocatepetlSenDT5/minop
y/inputs/geometryRadar.h5
--------------------------------------------------
reading reference info from template: /scratch1/05861/tg851601/PopocatepetlSenDT5/minopy/smallbaselineApp.cfg
input reference point in lat/lon: (19.0695, -98.6672)
input reference point in y/x: (943, 1119)
mask: maskConnComp.h5
Traceback (most recent call last):
  File "/work2/05861/tg851601/stampede2/code/rsmas_insar/sources/MintPy/mintpy/smallbaselineApp.py", line 1288, in <module>
    main(sys.argv[1:])
  File "/work2/05861/tg851601/stampede2/code/rsmas_insar/sources/MintPy/mintpy/smallbaselineApp.py", line 1270, in main
    app.run(steps=inps.runSteps)
  File "/work2/05861/tg851601/stampede2/code/rsmas_insar/sources/MintPy/mintpy/smallbaselineApp.py", line 1041, in run
    self.run_reference_point(sname)
  File "/work2/05861/tg851601/stampede2/code/rsmas_insar/sources/MintPy/mintpy/smallbaselineApp.py", line 481, in run_reference_point
    mintpy.reference_point.main(iargs)
  File "/work2/05861/tg851601/stampede2/codet/rsmas_insar/sources/MintPy/mintpy/reference_point.py", line 488, in main
    inps = read_reference_input(inps)
  File "/work2/05861/tg851601/stampede2/codet/rsmas_insar/sources/MintPy/mintpy/reference_point.py", line 447, in read_reference_input
    raise ValueError(msg)

It turns out that there is a discrepancy: view.py shows for the given lat/lon coordinates x=1091.8, y=932.2, whereas reference_point.py says 1119, 932.

Yunjun's comment: Hi Falk,

The internal reference in mintpy is always Y/X, for precision reason. The lat/lon is only for human input and will be converted to Y/X in the code. The geo2radar/radar2geo coordinate conversion (as demonstrated here: https://nbviewer.org/github/insarlab/MintPy-tutorial/blob/main/applications/coord_conversion.ipynb) does not have sub-pixel accuracy: I don’t remember a quantitative number anymore, 2 pixels is an conservative accuracy I hardwired in the code (https://github.com/insarlab/MintPy/blob/main/mintpy/objects/coord.py#L290-L291).

If you want to shift your reference point by <3 pixels, it’s not likely work by changing the reference.lalo value; you have to use reference.yx for that.

This could qualify as a “bug”, but it is a very low-level software engineering issue, and I don’t have a better solution currently. I am open to better ideas!

Yunjun

Solution: Manually selecting a reference point that view.py shows to be mask out but that gives a y/x not masked out works fine:

reference_point.py /scratch1/05861/tg851601/PopocatepetlSenDT5/minopy/inputs/ifgramStack.h5 -t /scratch1/05861/tg851601/PopocatepetlSenDT5/minopy/smallbaselineApp.cfg -c /scratch1/05861/tg851601/PopocatepetlSenDT5/minopy/avgSpatialCoh.h5 --lookup /scratch1/05861/tg851601/PopocatepetlSenDT5/minopy/inputs/geometryRadar.h5
--------------------------------------------------
reading reference info from template: /scratch1/05861/tg851601/PopocatepetlSenDT5/minopy/smallbaselineApp.cfg
input reference point in lat/lon: (19.0695, -98.668)
input reference point in y/x: (943, 1104)
mask: maskConnComp.h5
falkamelung commented 2 years ago

Another confusion is that maskConnComp is used for reference_point, but tempCoh is used for masking out:

image

minTempCoh=0.5:

image

minTempCoh=0.55:

image

minTempCoh=0.6:

image

Even if minTempCoh=0.7 is set it uses -m 0.5:

generate_temporal_coherence.py -d /scratch1/05861/tg851601/PopocatepetlSenDT5/minopy
20220202:134557 * generate_temporal_coherence.py -d /scratch1/05861/tg851601/PopocatepetlSenDT5/minopy
All updated (removed) attributes already exists (do not exists) and have the same value, skip update.
--------------------------------------------------
open  HDF5 file temporalCoherence.h5 in a mode
writing dataset /temporalCoherence         block: [0, 1000, 0, 3800]
close HDF5 file temporalCoherence.h5.
generate_mask.py /scratch1/05861/tg851601/PopocatepetlSenDT5/minopy/temporalCoherence.h5 -m 0.5 --nonzero -o /scratch1/05861/tg851601/PopocatepetlSenDT5/minopy/maskTempCoh.h5 --update

Note: view.py maskConnComp.h5 --ref-lalo 19.0695 -98.70 does not work.