Rich-Hall / sentinel1decoder

Python decoder for Sentinel-1 level0 files
GNU General Public License v3.0
22 stars 5 forks source link

If too many rows are selected l0decoder.py breaks. #4

Open radioandnukes opened 1 year ago

radioandnukes commented 1 year ago

If i select too many rows the l0decoder.py breaks it tends to be after 10000 rows or so. I would like to decode the whole file.

Empty DataFrame Columns: [Packet Version Number, Packet Type, Secondary Header Flag, PID, PCAT, Sequence Flags, Packet Sequence Count, Packet Data Length, Coarse Time, Fine Time, Sync, Data Take ID, ECC Number, Test Mode, Rx Channel ID, Instrument Configuration ID, Sub-commutated Ancilliary Data Word Index, Sub-commutated Ancilliary Data Word, Space Packet Count, PRI Count, Error Flag, BAQ Mode, BAQ Block Length, Range Decimation, Rx Gain, Tx Ramp Rate, Tx Pulse Start Frequency, Tx Pulse Length, Rank, PRI, SWST, SWL, SAS SSB Flag, Polarisation, Temperature Compensation, Calibration Mode, Tx Pulse Number, Signal Type, Swap Flag, Swath Number, Number of Quads] Index: [] Traceback (most recent call last): File "extractraw.py", line 59, in <module> iq_array = decoder.decode_file(selection) File "/home/goose/.local/lib/python3.8/site-packages/sentinel1decoder/l0decoder.py", line 114, in decode_file nq = input_header["Number of Quads"].unique()[0] IndexError: index 0 is out of bounds for axis 0 with size 0

radioandnukes commented 1 year ago

It appears to be that selection = selection.iloc[x:x] causes issues if i just do selection[x:x] the issue doesn't seem to happen.

Rich-Hall commented 1 year ago

Odd that this happens - not certain why, but I'll investigate.

Rich-Hall commented 1 year ago

So, the issue with decoding an entire file is we have variable numbers of samples at different places, especially with certain modes (e.g Interferometric Wide Swath) - I'm packing these into an array for processing, and the array is rectangular, so the code is written to expect just a single Number of Quads value in the selected packets. The best way of sorting this I think is to wrap some logic over the top which breaks the input header into blocks of constant NQ (i.e. blocks of single continuous stares/sweeps).

Rich-Hall commented 1 year ago

I've just pushed a commit that might help with this. There's a new Level0File class which wraps up much of the decoding functionality - you can now access continuous decodable sections of data ("bursts") through this and decode these. Hope this helps.