ZeyuJin / geodetic_inversion

homogeneous/layered inversion using InSAR/GPS
17 stars 11 forks source link

Error in mask_insar_phase when running clean_insar_data.m code #6

Open anas9876 opened 1 month ago

anas9876 commented 1 month ago

Hi Dr. Zeyu Jin and Dr. Xiaoyu Zou,

I have been working with the geodetic inversion code. I can run the data in the example dataset in the Work folder without any problem. For my work and my dataset, I've set the paths correctly for all the scripts. Also, I generated the mask data using Google Earth, as explained in the steps in the provided instructions. I ensured that both "dem_samp.grd" and "unwrap_ll.grd" files shared the same grid specifications. The DEM was created using the make_dem.csh script from the GMTSAR toolkit with the command: make_dem.csh 77.4944444444 80.8444444444 39.8416666653 41.7958333319 2, which specifies the same geographical boundaries as the unwrap_ll.grd file. Despite these, I am still encountering an error when running the "clean_insar_data" function: "

clean_insar_data Arrays have incompatible sizes for this operation.

Error in mask_insar_phase (line 76) ramp = pout(1).mlon + pout(2).mlat + pout(3).*topo + pout(4);

Error in clean_insar_data (line 28) mask_insar_phase(this_track, insar_file, mask_file, wavelength_C, 'los_max', 80, 'detrend', 1); "

My question is how to check what to change in the dimension of all my input files for the equation ramp = pout(1).mlon + pout(2).mlat + pout(3).*topo + pout(4) in order to see where the size discrepancy comes from?

I would greatly appreciate any insights or suggestions you might have to help resolve this issue. Thank you for your time and assistance.

Best regards, Anas Sharafeldin Mohamed Osman https://www.linkedin.com/in/eng-anas2020/

Dr_Jin_data my_data The error I am facing unwrap_ll grd_file_geographical_boundaries

anas9876 commented 1 month ago

The answers of Dr. Zeyu Jin and Dr. Xiaoyu Zou to my above issue

ans2 ans1

Thanks a lot to both of them

anas9876 commented 1 month ago

As you can see above, I encountered a challenge in my MATLAB script due to incompatible sizes among the data arrays mlon, mlat, and topo. The dimensions of these arrays did not align, with mlon and mlat at [4690, 6030] and topo at a larger [5061, 7181]. This size discrepancy led to operational errors during matrix computations, as certain functions in the script required all input arrays to have exactly the same dimensions for successful execution.

To solve this, I used GDAL, to uniformly resize the source data files that these arrays were derived from. Using the gdalwarp tool, I resampled the .grd files to a consistent and more manageable size of [1880, 2000]. This ensured that the arrays mlon, mlat, and topo matched in dimensions, facilitating seamless data processing in MATLAB. The resizing reduced the computational load, making the data handling within MATLAB more efficient and preventing further size-related errors.

issue image

anas9876 commented 1 month ago

I understand the processing steps, but I still have a problem with my mask file (mask1.txt). I created the polygon of the mask1.txt file using Google Earth as explained, but in my results after running clean_insar_data.m, it covers the LOS area of displacement as you can see in the figure attached below. How can I solve this issue and produce the mask file correctly, Sir?

image

x3zou commented 1 month ago

Hi Anas,

I think you shouldn't mask out the entire data. Instead, you will need to mask out the near-field area with significant unwrapping errors. However, if you think there is no need to do that, you can skip the masking step (simply uncomment line 67 and change it to 'unw_clean=unw_old' in the mask_insar_phase.m, and comment out lines 52-66 if you don't want to make any mask files). I have also modified mask_insar_phase.m to differentiate the case of 'mask' and 'no-mask' situations so feel free to try that and let me know how it works. Thanks!