Basic Issues : SAR Level 0
wiggedcrawdad951 opened this issue · 5 comments
Hey, Thank you for uploading this opensource work,
I am currently working on a similar project as yours, I wanted to inquire that which software should I use to compile the C files. More so, is this code applicable on all modes of SAR i-e SP, IW, EW etc. Should i download double polarized data or single polarized data from the Copernicus portal ?
which of the dat files will be read by the read C code, the measurement, index or annot? in double polarized case, there are two measurement .dat files. which one should we use?
Please guide me through this.
Best Regards
1/ compilation: all you need is a functional GNU/Linux distribution with gcc (GNU Compiler Collection), e.g.
apt install build-essential
under Debian/GNU Linux. Clone the repository and run
make
to compile the command line tool.
2/ the data to be downloaded on the Copernicus Hub Portal are the RAW datasets. In the RAW datasets, both huge .dat can be processed, e.g in my test dataset
763726140 Jan 13 08:30 s1a-iw-raw-s-vh-20210112t173201-20210112t173234-036108-043b95.dat
877224812 Jan 13 08:30 s1a-iw-raw-s-vv-20210112t173201-20210112t173234-036108-043b95.dat
I am not using the *-annot.dat nor *-index.dat in these processing steps.
Best regards
Thank you for your reply,
I was able to decode the data successfully resulting in a number of BRC and result*.bin files. judging from the issue closed before if I process only one of the result*.bin files I should get some kind of image as output depending upon the orbit of the satellite.
Ive been facing some errors while processing the bin files. I
ve been using the read_bin.m file from the root directory to do the said task.
Errors:
1/ if i keep the count as suggested in the m file i get the following error
2/ if i keep the count low to a 100 i get the following error
Following is the name of the Result*.bin file i am calling in the function
--> resultSW10_T1286748881_NQ11924.bin
I`ve been using following arguments for the function
x=read_bin('resultSW10_T1286748881_NQ11924.bin',floor(65921.8), 199242); %with the value of count being varied here
Please guide, Thank you again.
Best Regards.
The first error is related to the amount of data you request being larger than the file size. NQ*2 is given when decoding and I would be suspicious of a value such as 199242 which seems much larger than the Sentinel1 packet length. My typical value would be something like
Decim=9 TXPRR=^84cd=1229 TXPSF=-0x23fa=9210 TXPL=0000077e=1918 PRI=00005824=22564 Polar=7 Typ=1(0) Swath=6 NQ=9975
so that NQx2 would be 2*9975=19950. In your example NQ=11914 (end of the filename) so that the argument 2xNQ would be 23828. That's the line length. Then the number of lines should not exceed the amount of data available: if a file similar to yours
268589216 resultSW10_T1302069125_NQ11914.bin
is 268589216 byes longs, then the maximum number of lines you can read is 268589216/8/(11914x2) which is computed as
- each line is 11914x2 elements (complex float)
- each element is 8 bytes (real and imaginary, each coded as a single precision floating point number of 4 bytes)
- I obtain the same result as you with reading the file up to 1410 lines since 268589216/8/11914/2=1409
Assuming you read a maximum of 1409 lines, you will get in sol the matrix resulting from reading the file content and organized according to the last argument provided to the read_bin function.
The second error is related to the crude search for the strongest target in the scene aimed at checking the chirp shape. In line 46 the coordinates (r,c) hold the strongest target location, around which I wish to display the range compressed map. The offset to c must not exceed the sol size, so that c+100 < 1409 and c > 970 in this example. These offsets might be tuned from one scene to another since the strongest target might be located anywhere in the image. The objective here is to assess the phase dependence of the chirp by assuming that the strongest target is a convolution of a Dirac function with the incoming chirp which should give a hint of the chirp shape. This did work well with the Sao Paulo dataset but might not be valid for other areas and you might want to stop execution at line 43.
Also please be aware that the chirp shape is swath dependent: my example is for swath 2 which is identified as 11 in the telemetry (swath telemetry indices are 10, 11 or 12 matching swaths 1, 2 and 3 in SNAP). You are reading a file with swath 10 and using the chirp parameters for swath 11. Please check Sentinel-1-SAR-Space-Packet-Protocol-Data-Unit.pdf p.35 for the Range Decimation (3/7*4xfref for IW1 or Interferometric Wide swath 1) and the chirp shape which should be something like
TXPRR=^8645=1605 TXPSF=-0x302f=12335 TXPL=000007af=1967 PRI=00005563=21859 Polar=7 Typ=0(0) Swath=a NQ=11914
so that ll.15-18 of the script should be
fs=3/7*4*fref % case 10 in Range Decimation, p.35 of Packet Protocol Data Unit
TXPRRcode=1605; % upchirp
TXPSFcode=-12335; % start
TXPLcode=1967;
This read_bin.m script is definitely a proof of concept and far to be safe without tuning the parameters at the moment.
Best, JM
Thank you for your Reply, It was very Helpful.
Considering Case 11 from the SAR-Space-Packet-Data-Protocol-Unit.pdf for SW11 (Swath 2 in IW mode), I called upon 5 of the 11 Result.bin files i obtained for SW11 with respect to their timestamps through the read_bin.m file.
The first issue i face is i am not able to assess what type of data is stored in the bin file, it does not show any thing when opened through the workspace,
afterwards when the m file is executed it gives following figures for the 5 bin files.
these figures seem somewhat familiar to each other and do not explain much, the data i have is of an area near Manaus (Amazon) near Brazil.
when i changed the C limits in the Imagesc Command it showed a change in the amount of yellow or blue in the figure as shown below
I think , that in my execution the result.bin file and the rest of the algorithm have failed to interacr with each other resulting in these false images.
Lastly i was able to eliminate the error in mychirp variable by conforming the limits around the max value obtained and keeping it under the sol matrix dimensions.
What i understood was that the [r,c] co-ordinates give us the area from where the sensor receive maximum backscatter hence we include the surrounding values as well to be proper. I hope, this is the concept here.
Kindly comment about the issues where i am unable to comprehend what the bin file comprises of and why i am not getting a proper image.
while producing the image i received the following 'Output argument "sol" (and maybe others) not assigned during call to "read_bin".'
I commented out the clear sol line , and the error/warning was then removed
% clear sol
figure;
imagesc(fliplr(flipud(abs(ssol(1:3:end,1:3:end)))),[1 2e8])
Thank you,
Best Regards
Further i have Plotted the x-matrix that i get as a result in the end by
'image (abs(x))
command.
the images I receive for the first 8 datasets of SW2 are following
I am not sure what these represent at the moment (the output array x comprises of real and imaginary data of size 24122x189).
Can you please guide me ,
Thank you, anxiously waiting for your reply
Best Regards