#######################################################
Warning
The workflow described in this post (and the ones referring to it later on) is outdated and no longer recommended, because new versions of SNAP and StaMPS have been released. Please have a look at this updated list of instructions: StaMPS - Detailled instructions
#######################################################
Hi all,
@ABraun,@katherine,@cfatras
It seems that I have found a serious bug in mt_prep_gamma_snap, the file attached by Katherine.
If you open any *.rslc.par file in /rslc floder, you will see the parameter ‘image_format’ is ‘FCOMPLEX’, which is often 8 bytes in computer, meantime you can also get ‘range_samples’ and ‘azimuth_lines’ value, do multiplication between these three parameter and you will find it’s equal to the size of *.rslc exactly, which means the *.rslc only contains raw data.
Now we check the source code of mt_prep_gamma_snap in line 149 and line 230(or 232), all contains ‘s’ as an input parameter, which means all your data, including all *.rslc and *.diff, will be read as complex short format, which is often 4 bytes in computer, so, it means we have read the export data uncorrectly .
Despite it will cause huge mistake, the solution is simple, just replace all ‘s’ as ‘f’, which will change the reading format to complex float, and then can read data correctly.
The reason why I find this problem is because the strange value in ‘selpsc.in’ file, from the third line, after the full path of *.rslc, a number appears.
After I check the source code, I know it means mean amplitude in each *.rslc except zero amplitude pixel. So, over 20 thousand is totally unreasonable. After I modified the code and re-run mt_prep_gamma_snap, I think I get the right value.
Another clue is when you run mt_prep_gamma_snap, it will output a message in terminal, “number of lines per file = XXX”, it should tell you the length of *.rslc image, but you will find the output value equals twice of the real value, it because “numlines=size/width/sizeofelement/2”(in /src/selpsc_patch.c in line 264), and given ‘s’ as paramter will set sizeofelement equals 2.
Actually I also have met another bugs in ps_load_initial_gamma.m, I have mentioned to ABraun once, but I don’t know if you guys have met the same problem. After run stamps(1, 1) in Matlab(which run ps_load_initial_gamma), use ps_plot(‘w’), I find that one of my ifg is empty, and I get an error in the following step stamps(2, 2).
Last ifg 03 Jan 2017 is empty
error message in step 2:
Later I find the reason is because the output data format of ps_load_initial_gamma is a little different from ps_load_initial(which is used for other sensor except gamma), mainly on the handling of master image, so I have modified it to solve this problem.
I don’t know if anyone has the same problems as I do, I have viewed the MAINSAR google group, also has no useful information about ps_load_initial_gamma.m.
At last, thanks for Katherine sharing her experience selflessly, I attach the modified code and change log here, hope this will help others and save their time.
Fei
Good luck!
Change_log.txt (1.2 KB)
mt_prep_gamma_snap(changed) (6.4 KB)
ps_load_initial_gamma(changed).m (5.8 KB)