-
Notifications
You must be signed in to change notification settings - Fork 299
Description
Description of the problem
I am trying to geocode ISCE-2 interferograms using geocode.py, and I just run the example commend obtained from geocode.py as follows.
Full script that generated the error
geocode.py filt_fine.int --lat-file ../../geom_reference/lat.rdr --lon-file ../../geom_reference/lon.rdr
The program runs successfully, however the wrapped phase in a geocoded interferogram is incorrect. Phase values after geocoding change into 3.14, which is the same as pi. Give the interferograms below.
And there appears some unexpected messages ComplexWarning in the terminal, this is the output:
Full error message
No lookup table info range/lat found in files.
number of processor to be used: 1
resampling software: pyresample
read latitude / longitude from lookup table file: ../../geom_reference/lat.rdr
output pixel size in (lat, lon) in degree: (-0.00031570278911694004, 0.00032012760497859225)
output area extent in (S, N, W, E) in degree: (33.464494425028974, 33.96488334577933, 112.49700943082642, 113.56847652468977)
output file row / column number: (1585, 3347)
--------------------------------------------------
resampling file: filt_fine.int
--------------------------------------------------1/1
reading complex in block (0, 0, 2550, 1423) from filt_fine.int ...
nearest resampling with pyresample.kd_tree using 1 CPU cores in 6 segments ...
/home/comma/miniconda3/envs/isce2/lib/python3.9/site-packages/pyresample/kd_tree.py:824: ComplexWarning: Casting complex values to real discards the imaginary part
full_result[valid_output_index] = result
/home/comma/miniconda3/envs/isce2/lib/python3.9/site-packages/mintpy/geocode.py:140: ComplexWarning: Casting complex values to real discards the imaginary part
dsDict[dsName][block[0]:block[1],
write file: geo_filt_fine.int
write file: geo_filt_fine.int.rsc
write file: geo_filt_fine.int.xml
write file: geo_filt_fine.int.vrt
time used: 00 mins 1.5 secs.
According to the error message, I modified the line 823 in kd_tree.py and line 103 in geocode.py, to add dtype = 'complex_' while creating the matrix, just like:
full_result = np.ones(output_raw_shape, dtype = 'complex_') * fill_value # line 823 in kd_tree.py
dsDict[dsName] = np.zeros((res_obj.length, res_obj.width), dtype = 'complex_') # line 103 in geocode.py
Under the condition dtype = 'complex_', I got a correct geocoded interferogram with geocode.py as below:

At the same time, it would generate the same ComplexWarning under the condition dtype = 'complex_' if we try to geocode unwrapped interferograms or coherence maps whose data type is actually not complex. But the output data seems to be true although there is a ComplexWarning.
System information
- Operating system: Linux-Ubuntu
- Python environment: conda
- MintPy version: 1.5.0

