torchsar.products package

Submodules

torchsar.products.alos module

torchsar.products.alos.get_alos_palsar_attitude(D)

get attitude data

return a numpy array

1st: Pitch Roll Yaw PitchRate RollRate YawRate 2st: Pitch Roll Yaw PitchRate RollRate YawRate

:

nst: Pitch Roll Yaw PitchRate RollRate YawRate

Parameters

D (dict) – LeaderFileImportantImagingParametersRecordALOS dict

torchsar.products.alos.get_alos_palsar_plat_position(D)

get platform position data

return a numpy array

1st: X Y Z Vx Vy Vz 2st: X Y Z Vx Vy Vz

:

nst: X Y Z Vx Vy Vz

Parameters

D (dict) – LeaderFileImportantImagingParametersRecordALOS dict

torchsar.products.alos.read_alos_palsar_ldr_iip(ledfile, verbose=False)

Read important imaging parameters from leader file

Read important imaging parameters from leader file.

For example, LED-ALPSRP050500980-H1.0__A

Parameters

ledfile (str) – Leader file path string.

torchsar.products.alos.read_alos_palsar_raw(rawfile, ledfile, sl=1, el=- 1, rmbp=False)

read ALOS PALSAR raw data

read ALOS PALSAR raw data pulse from line sl to line el. This function call function read_ceos_sar_raw() firstly and do some post-process.

Parameters
  • rawfile (str) – ALOS PALSAR raw data file path string, —> IMG*.0__A, e.g. IMG-HH-ALPSRP050500980-H1.0__A

  • ledfile (str) – ALOS PALSAR leader file path string, —> LED*.0__A, e.g. LED-ALPSRP050500980-H1.0__A

  • sl (int, optional) – start line (azimuth) (the default is 1, which means the first line)

  • el (int, optional) – end line (azimuth) (the default is -1, which means the last line)

  • rmbp (bool, optional) – If you want to remove the padded border pixels, set rmbp to True, else set to False (the default is False).

Returns

  • Sr (2d-array) – SAR raw signal data matrix.

  • Pd (dict) – Parameter dictionary.

torchsar.products.alos.read_alos_palsar_slc(filepath, sl=1, el=- 1, rmbp=False)

read ALOS PALSAR SLC data

read ALOS PALSAR SLC data pulse from line sl to line el. This function call function read_ceos_sar_slc() firstly.

Parameters
  • filepath (str) – ALOS PALSAR raw data file path string, for ALOSPALSAR –> IMG*.1__A

  • sl (int, optional) – start line (azimuth) (the default is 1, which means the first line)

  • el (int, optional) – end line (azimuth) (the default is -1, which means the last line)

  • rmbp (bool, optional) – If you want to remove the padded border pixels, set rmbp to True, else set to False (the default is False).

Returns

S – SAR SLC data matrix.

Return type

2d-array

torchsar.products.ceos module

torchsar.products.ceos.decfmtfceos(F, n, x, b, e='<')

decode format descriptor of CEOS

decode format descriptor of CEOS.

'nFx' –> decode b x Bytes-by-x Bytes as format F specified, and do n times.

Parameters
  • F (str) – formation string, C –> Complex(real, imag), F –> float, B –> Bytes, A –> String, I –> asicc

  • n (int) – amount of elements with formation F

  • x (int) – number of Bytes

  • b (bytes) – bytes to be decoded

  • e (str, optional) – endian, '<' –> little, '>' – > big (the default is ‘<’, which means little endian)

Returns

decoded result list.

Return type

list

torchsar.products.ceos.read_ceos_sar_raw(filepath, sl=1, el=- 1, rmbp=False)

read CEOS SAR raw data

read CEOS SAR raw data pulse from line sl to line el.

Parameters
  • filepath (str) – SAR raw data file path string, for ERS1/2 –> *.raw for RADARSAT –> DAT_01.001

  • sl (int, optional) – start line (azimuth) (the default is 1, which means the first line)

  • el (int, optional) – end line (azimuth) (the default is -1, which means the last line)

  • rmbp (bool, optional) – If you want to remove the padded border pixels, set rmbp to True, else set to False (the default is False).

Returns

S

Return type

2d-array

torchsar.products.ceos.read_ceos_sar_slc(filepath, sl=1, el=- 1, rmbp=False)

read CEOS SAR slc data

read CEOS SAR slc data from line sl to line el.

Parameters
  • filepath (str) – SAR slc data file path string, for ERS1/2 –> *.D for RADARSAT –> DAT_01.001

  • sl (int, optional) – start line (azimuth) (the default is 1, which means the first line)

  • el (int, optional) – end line (azimuth) (the default is -1, which means the last line)

  • rmbp (bool, optional) – If you want to remove the padded border pixels, set rmbp to True, else set to False (the default is False).

Returns

S – Processed SLC SAR data matrix.

Return type

2d-array

torchsar.products.ers module

torchsar.products.ers.get_ers_sar_plat_position(D)

get platform position data

return a numpy array

1st: X Y Z Vx Vy Vz 2st: X Y Z Vx Vy Vz

:

nst: X Y Z Vx Vy Vz

Parameters

D (dict) – LeaderFileImportantImagingParametersRecordALOS dict

torchsar.products.ers.read_ers_sar_ldr_iip(filepath, verbose=False)

Read important imaging parameters from leader file

Read important imaging parameters from leader file.

Parameters

filepath (str) – Leader file path string.

torchsar.products.ers.read_ers_sar_raw(rawfile, ledfile, sl=1, el=- 1, rmbp=False)

read ERS SAR raw data

read ERS1/2 SAR raw data pulse from line sl to line el.

Parameters
  • rawfile (str) – ERS SAR raw data file path string, for ERS1/2 –> *.raw e.g. E2_81988_STD_L0_F327.000.raw

  • ledfile (str) – ERS SAR leader file path string, —> *.ldr, e.g. E2_81988_STD_L0_F327.000.ldr

  • sl (int, optional) – start line (azimuth) (the default is 1, which means the first line)

  • el (int, optional) – end line (azimuth) (the default is -1, which means the last line)

  • rmbp (bool, optional) – If you want to remove the padded border pixels, set rmbp to True, else set to False (the default is False).

Returns

  • S (2d-array) – SAR raw signal data matrix.

  • Pd (dict) – Parameter dictionary.

torchsar.products.ers.read_ers_sar_slc(filepath, sl=1, el=- 1, rmbp=False)

read ERS SAR SLC data

read ERS1/2 SAR SLC data pulse from line sl to line el.

Parameters
  • filepath (str) – ERS SAR raw data file path string, for ERS1/2 –> *.raw

  • sl (int, optional) – start line (azimuth) (the default is 1, which means the first line)

  • el (int, optional) – end line (azimuth) (the default is -1, which means the last line)

  • rmbp (bool, optional) – If you want to remove the padded border pixels, set rmbp to True, else set to False (the default is False).

Returns

S – SAR SLC data matrix.

Return type

2d-array

torchsar.products.radarsat module

torchsar.products.radarsat.read_radarsat_sar_raw(filepath, sl=1, el=- 1, rmbp=False)

read RADARSAT SAR raw data

read RADARSAT raw data pulse from line sl to line el. This function call function read_ceos_sar_raw() firstly and do some post-process.

Parameters
  • filepath (str) – RADARSAT SAR raw data file path string with format .001, such as DAT_01.001.

  • sl (int, optional) – start line (azimuth) (the default is 1, which means the first line)

  • el (int, optional) – end line (azimuth) (the default is -1, which means the last line)

  • rmbp (bool, optional) – If you want to remove the padded border pixels, set rmbp to True, else set to False (the default is False).

Returns

S – SAR raw data.

Return type

2d-array

torchsar.products.record module

torchsar.products.record.printrcd(D)

print record

print record in ascend address order.

Parameters

D (dict) – descriptor dict

torchsar.products.record.readrcd(filepath, decfmtf, D, offset=0, endian='>')

read file record

read record information from a file. see read_ers_sar_raw() for reading ERS SAR raw data.

Parameters
  • filepath (str) – file path string

  • decfmtf (function) – format decoding function. see decfmtfers() for example.

  • D (dict) – record descriptor dict, each value will be rewrited after reading.

  • offset (int, optional) – record offset, read from the offset-th Byte (the default is 0)

  • endian (str, optional) – endian, '<' –> little, '>' – > big (the default is ‘<’, which means little endian)

Returns

state – reading status. 0 –> OK and done; 1 –> no such file; 2 –> bad record

Return type

number

torchsar.products.record.readrcd1item(filepath, decfmtf, adrfmt, offset=0, endian='>')

read one file record item

read one record item information from a file. see read_ceos_sar_raw() for reading ERS SAR raw data.

Parameters
  • filepath (str) – file path string

  • decfmtf (function) – format decoding function. see decfmtfers() for example.

  • adrfmt (tuple) – address and formation of one record item, a tuple with two elements: (adr, fmt), where, adr = (start address, end address) is a tuple and specifies the address (unit Bytes), fmt is the formation string.

  • offset (int, optional) – record address offset, begin from the offset-th Byte (the default is 0)

  • endian (str, optional) – endian, '<' –> little, '>' – > big (the default is ‘<’, which means little endian)

Returns

v – readed record item value.

Return type

{}

torchsar.products.uavsar module

torchsar.products.uavsar.read_uavsar_csm(filepath, sl=1, el=- 1, rmbp=False)

read UAVSAR raw data

read UAVSAR SAR raw data pulse from line sl to line el. This function call function read_ceos_sar_raw() firstly and do some post-process.

Parameters
  • filepath (str) – UAVSAR raw data file path string, for UAVSAR –> *.raw

  • sl (int, optional) – start line (azimuth) (the default is 1, which means the first line)

  • el (int, optional) – end line (azimuth) (the default is -1, which means the last line)

  • rmbp (bool, optional) – If you want to remove the padded border pixels, set rmbp to True, else set to False (the default is False).

Returns

S – SAR raw signal data matrix.

Return type

2d-array

torchsar.products.uavsar.read_uavsar_mlc(filepath, dshape=None, dtype='complex')

read UAVSAR MLC data

read UAVSAR SAR MLC data.

Parameters
  • filepath (str) – UAVSAR MLC data file path string, for UAVSAR –> *.mlc

  • dshape (str) – MLC data shape (\(N_a\times N_r\)), where, \(N_a, N_r\) equal to mlc_mag.set_rows, mlc_mag.set_cols which can be obtained from the .ann file (the default is 1, which means the first line)

  • dshape – MLC data type: 'complex' for complex-valued floating point data, 'real' for real-valued floating point data.

Returns

S – SAR MLC data matrix.

Return type

2d-array

torchsar.products.utils module

torchsar.products.utils.getnumber(b)

obtain number in string or bytes

obtain number in string/bytes, e.g. b’ 123 45 ‘ –> [123, 45], b’ 123, 45 ‘ –> [123, 45] and b’ ‘ –> []

Parameters

b (bytes) – bytes string for extracting numbers.

Returns

n – extracted number list, if there only one element, return a number.

Return type

number list or number

torchsar.products.utils.splitfmt(fmt)

Module contents