Skip to content

SAOCOM

Reader Interface

SAOCOM product format reader.

Classes

Functions:

read_channel_metadata

Python
read_channel_metadata(file_path: Path | str, channel_id: str) -> support.SAOCOMChannelMetadata

Reading channel metadata info and storing them in a SAOCOMChannelMetadata dataclass.

Parameters:

Name Type Description Default
file_path Path | str

Path to the metadata .xml file

required

Returns:

Type Description
SAOCOMChannelMetadata

SAOCOMChannelMetadata metadata dataclass

read_channel_data

Python
read_channel_data(raster_file: str | Path, raster_info: RasterInfo, binary_ordering_mode: str, header_offset: int, row_prefix: int, block_to_read: list[int] = None) -> np.ndarray

Reading SAOCOM channel raster files with raster info.

Parameters:

Name Type Description Default
raster_file str | Path

Path to binary raster file to be read

required
raster_info RasterInfo

channel raster info

required
binary_ordering_mode str

binary ordering mode corresponding to the raster itself

required
header_offset int

header offset of the raster file

required
row_prefix int

row prefix of the raster file

required
block_to_read list[int] | None

data block to be read, to be specified as a list of 4 integers, in the form:

Text Only
0. first line to be read
1. first sample to be read
2. total number of lines to be read
3. total number of samples to be read

if None, the whole raster is read, by default None

None

Returns:

Type Description
ndarray

numpy array containing the data read from raster file, with shape (lines, samples)

open_product

Python
open_product(pf_path: str | Path) -> support.SAOCOMProduct

Open a SAOCOM product.

NOTE: Saocom product must be provided as a path to a folder with a given name (i.e. L1_A_SLC) containing a .xemt metadata file with the same name (i.e. L1_A_SLC.xemt) and another subfolder (with the same name, L1_A_SLC) containing [Data, Config, Images, ...]

Parameters:

Name Type Description Default
pf_path str | Path

Path to the SAOCOM product

required

Returns:

Type Description
SAOCOMProduct

SAOCOMProduct object corresponding to the input SAOCOM product

Utilities

SAOCOM reader support module.

Attributes

polarization_dict module-attribute

Python
polarization_dict = {'vv': SARPolarization.VV, 'hh': SARPolarization.HH, 'hv': SARPolarization.HV, 'vh': SARPolarization.VH}

data_type_dict module-attribute

Python
data_type_dict = {'FLOAT32': 'f4', 'FLOAT_COMPLEX': 'c8', 'INT16': 'i2', 'INT32': 'i4', 'UINT16': 'u2', 'UINT32': 'u4', 'INT8': 'b', 'UINT8': 'B', 'INT16_COMPLEX': 'i2, i2', 'INT_COMPLEX': 'i4, i4', 'DOUBLE_COMPLEX': 'c16', 'FLOAT64': 'f8', 'INT8_COMPLEX': 'i1, i1'}

byte_order_dict module-attribute

Python
byte_order_dict = {'BIGENDIAN': '>', 'LITTLEENDIAN': '<'}

Classes

InvalidSAOCOMProduct

Bases: RuntimeError

Invalid SAOCOM product

InvalidHeaderOffset

Bases: ValueError

Invalid header offset

InvalidRowPrefix

Bases: ValueError

Invalid prefix value

InvalidDataType

Bases: ValueError

Invalid data type

BlockExceedsRasterLimits

Bases: RuntimeError

Block to be read exceeds raster limits

SAOCOMProductType

Bases: Enum

SAOCOM L1 product level

Attributes

SLC class-attribute instance-attribute
Python
SLC = 'SLC'
GRD class-attribute instance-attribute
Python
GRD = 'GRD'

SAOCOMAcquisitionMode

Bases: Enum

SAOCOM L1 acquisition modes

Attributes

STRIPMAP class-attribute instance-attribute
Python
STRIPMAP = 'STRIPMAP'
TOPSAR class-attribute instance-attribute
Python
TOPSAR = 'TOPSAR'

SAOCOMGeneralChannelInfo dataclass

SAOCOM general channel info dataclass

Attributes

channel_id instance-attribute
Python
channel_id: str
swath instance-attribute
Python
swath: str
product_type instance-attribute
Python
product_type: SAOCOMProductType
polarization instance-attribute
Python
polarization: SARPolarization
projection instance-attribute
Python
projection: SARProjection
acquisition_mode instance-attribute
Python
acquisition_mode: SAOCOMAcquisitionMode
acquisition_mode_std instance-attribute
Python
acquisition_mode_std: StandardSARAcquisitionMode
orbit_direction instance-attribute
Python
orbit_direction: OrbitDirection
signal_frequency instance-attribute
Python
signal_frequency: float
acq_start_time instance-attribute
Python
acq_start_time: PreciseDateTime

Methods:

__init__
Python
__init__(channel_id: str, swath: str, product_type: SAOCOMProductType, polarization: SARPolarization, projection: SARProjection, acquisition_mode: SAOCOMAcquisitionMode, acquisition_mode_std: StandardSARAcquisitionMode, orbit_direction: OrbitDirection, signal_frequency: float, acq_start_time: PreciseDateTime) -> None
from_metadata staticmethod
Python
from_metadata(node: _Element, channel_id: str) -> SAOCOMGeneralChannelInfo

Generating SAOCOMGeneralChannelInfo object directly from metadata.

Parameters:

Name Type Description Default
node _Element

Channel metadata node

required
channel_id str

channel id

required

Returns:

Type Description
SAOCOMGeneralChannelInfo

general channel info dataclass

SAOCOMChannelMetadata dataclass

SAOCOM channel metadata dataclass

Attributes

general_info instance-attribute
Python
general_info: SAOCOMGeneralChannelInfo
orbit instance-attribute
Python
orbit: Trajectory
image_radiometric_quantity instance-attribute
Python
image_radiometric_quantity: SARRadiometricQuantity
burst_info instance-attribute
Python
burst_info: BurstInfo
raster_info instance-attribute
Python
raster_info: RasterInfo
dataset_info instance-attribute
Python
dataset_info: DatasetInfo
swath_info instance-attribute
Python
swath_info: SwathInfo
sampling_constants instance-attribute
Python
sampling_constants: SARSamplingFrequencies
doppler_centroid_poly instance-attribute
Python
doppler_centroid_poly: DopplerEvaluator
doppler_rate_poly instance-attribute
Python
doppler_rate_poly: DopplerEvaluator
pulse instance-attribute
Python
pulse: PulseInfo | None
coordinate_conversions instance-attribute
Python
coordinate_conversions: CoordinatesConversions
state_vectors instance-attribute
Python
state_vectors: StateVectors
binary_ordering_mode instance-attribute
Python
binary_ordering_mode: str
header_offset instance-attribute
Python
header_offset: int
row_prefix instance-attribute
Python
row_prefix: int

Methods:

__init__
Python
__init__(general_info: SAOCOMGeneralChannelInfo, orbit: Trajectory, image_radiometric_quantity: SARRadiometricQuantity, burst_info: BurstInfo, raster_info: RasterInfo, dataset_info: DatasetInfo, swath_info: SwathInfo, sampling_constants: SARSamplingFrequencies, doppler_centroid_poly: DopplerEvaluator, doppler_rate_poly: DopplerEvaluator, pulse: PulseInfo | None, coordinate_conversions: CoordinatesConversions, state_vectors: StateVectors, binary_ordering_mode: str, header_offset: int, row_prefix: int) -> None

SAOCOMProduct

SAOCOM product object

Attributes

manifest_path property
Python
manifest_path: Path

Manifest .xemt file path

acquisition_time property
Python
acquisition_time: PreciseDateTime

Acquisition start time for this product

channels_number property
Python
channels_number: int

Returning the number of channels of SAOCOM product

channels_list property
Python
channels_list: list[str]

Returning the list of channels

footprint property
Python
footprint: tuple[float, float, float, float]

Product footprint as tuple of (min lat, max lat, min lon, max lon)

Methods:

__init__
Python
__init__(path: str | Path) -> None

SAOCOM Product init from directory path.

Parameters:

Name Type Description Default
path str | Path

path to SAOCOM product

required
get_files_from_channel_name
Python
get_files_from_channel_name(channel_name: str) -> list[Path]

Get files associated to a given channel name.

Parameters:

Name Type Description Default
channel_name str

channel id name

required

Returns:

Type Description
list[Path]

path to .xml metadata file and binary file

SAOCOMManifest dataclass

SAOCOM .xemt manifest class

Attributes

manifest_path instance-attribute
Python
manifest_path: Path
channels instance-attribute
Python
channels: list[str]
polarizations instance-attribute
Python
polarizations: list[SARPolarization]
acquisition_start_time instance-attribute
Python
acquisition_start_time: PreciseDateTime
acquisition_end_time instance-attribute
Python
acquisition_end_time: PreciseDateTime
raster_files instance-attribute
Python
raster_files: dict[str, list[Path]]
footprint instance-attribute
Python
footprint: tuple[float, float, float, float]

Methods:

__init__
Python
__init__(manifest_path: Path, channels: list[str], polarizations: list[SARPolarization], acquisition_start_time: PreciseDateTime, acquisition_end_time: PreciseDateTime, raster_files: dict[str, list[Path]], footprint: tuple[float, float, float, float]) -> None
from_file staticmethod
Python
from_file(path: str | Path) -> SAOCOMManifest

Generating a SAOCOMManifest object representing the content of the .xemt file.

Parameters:

Name Type Description Default
path str | Path

path to the .xemt file

required

Returns:

Type Description
SAOCOMManifest

SAOCOM manifest dataclass

Functions:

raster_info_from_metadata

Python
raster_info_from_metadata(node: _Element) -> tuple[RasterInfo, str, int, int]

Creating a RasterInfo metadata object from metadata file.

Parameters:

Name Type Description Default
node _Element

RasterInfo metadata node

required

Returns:

Type Description
RasterInfo

RasterInfo metadata object

str

binary ordering mode of raster itself

int

header offset

int

row prefix

burst_info_from_metadata

Python
burst_info_from_metadata(node: _Element, raster_info: RasterInfo) -> BurstInfo

Generating BurstInfo object directly from metadata.

Parameters:

Name Type Description Default
node _Element

BurstInfo metadata node

required
raster_info RasterInfo

product raster info

required

Returns:

Type Description
BurstInfo

burst info dataclass

dataset_info_from_metadata

Python
dataset_info_from_metadata(node: _Element) -> DatasetInfo

Creating a DatasetInfo metadata object from metadata file.

Parameters:

Name Type Description Default
node _Element

DatasetInfo metadata node

required

Returns:

Type Description
DatasetInfo

DatasetInfo metadata object

swath_info_from_metadata

Python
swath_info_from_metadata(node: _Element) -> SwathInfo

Creating a SwathInfo metadata object from metadata file.

Parameters:

Name Type Description Default
node _Element

SwathInfo metadata node

required

Returns:

Type Description
SwathInfo

SwathInfo metadata object

state_vectors_from_metadata

Python
state_vectors_from_metadata(node: _Element) -> StateVectors

Generating StateVectors object directly from product metadata.

Parameters:

Name Type Description Default
node _Element

StateVectorData xml node

required

Returns:

Type Description
StateVectors

orbit's state vectors dataclass

sampling_constants_from_metadata

Python
sampling_constants_from_metadata(node: _Element) -> SARSamplingFrequencies

Creating a SARSamplingFrequencies metadata object from metadata file.

Parameters:

Name Type Description Default
node _Element

SamplingConstants metadata node

required

Returns:

Type Description
SARSamplingFrequencies

SARSamplingFrequencies metadata object

pulse_from_metadata

Python
pulse_from_metadata(node: _Element) -> PulseInfo | None

Creating a PulseInfo metadata object from metadata file.

Parameters:

Name Type Description Default
node _Element

Pulse metadata node

required

Returns:

Type Description
PulseInfo | None

PulseInfo metadata object or None if node not found

doppler_poly_from_metadata

Python
doppler_poly_from_metadata(node: _Element, doppler_node_tag: str) -> DopplerEvaluator

Creating a DopplerEvaluator doppler centroid/rate polynomial wrapper from metadata.

Parameters:

Name Type Description Default
node _Element

Channel metadata node

required
doppler_node_tag str

doppler polynomial node tag, it could be "DopplerCentroid" or "DopplerRate"

required

Returns:

Type Description
DopplerEvaluator

DopplerEvaluator dataclass for Doppler Centroid/Rate polynomial

coordinates_conversions_from_metadata

Python
coordinates_conversions_from_metadata(node: _Element) -> CoordinatesConversions

Generating CoordinatesConversions object from metadata.

About coefficients annotated in metadata:

Coefficients of polynomial fit to the "Ground to Slant Range" transform applied. Fixed along all image slices. Defined with respect to (slant range in m)/(pixel no.)^n where first pixel in line is 0.

Values output in order A0, A1, ..., An, in order of increasing degree. Polynomial to be evaluated is: A_0+ A_1 x + ... + A_n x^n where x is pixel number in the line, starting from 0.

Evaluated polynomial gives Slant Range in meters.

Parameters:

Name Type Description Default
node _Element

Channel metadata node

required

Returns:

Type Description
CoordinatesConversions

polynomial for coordinate conversion dataclass

read_raster

Python
read_raster(raster_file_name: str | Path, num_of_samples: int, num_of_lines: int, data_type: str = 'FLOAT32', binary_ordering_mode: str = 'LITTLEENDIAN', block_to_read: list[int] | None = None, header_offset: int = 0, row_prefix: int = 0) -> np.ndarray

Read raster file data.

Parameters:

Name Type Description Default
raster_file_name str | Path

path to the raster file to be read

required
num_of_samples int

number of samples to be read

required
num_of_lines int

number of lines to be read

required
data_type str

data type corresponding to the raster itself, by default FLOAT32

'FLOAT32'
binary_ordering_mode str

binary ordering mode corresponding to the raster itself, by default LITTLEENDIAN

'LITTLEENDIAN'
block_to_read list[int] | None

data block to be read, to be specified as a list of 4 integers, in the form:

Text Only
0. first line to be read
1. first sample to be read
2. total number of lines to be read
3. total number of samples to be read

if None, the whole raster is read, by default None

None
header_offset int

header offset of the raster file, by default 0

0
row_prefix int

row prefix of the raster file, by default 0

0

Returns:

Type Description
ndarray

numpy array containing the data read from raster file, with shape (lines, samples)

Raises:

Type Description
InvalidHeaderOffset

if header offset is negative

InvalidRowPrefix

if row prefix is negative

UnsupportedDataType

invalid data type

BlockExceedsRasterLimits

data type not yet supported

BlockExceedsRasterLimits

if first line to be read is negative

BlockExceedsRasterLimits

if first sample to be read is negative

BlockExceedsRasterLimits

if block to be read exceeds raster number of lines

BlockExceedsRasterLimits

if block to be read exceeds raster number of samples

is_saocom_product

Python
is_saocom_product(product: str | Path) -> bool

Check if input path corresponds to a valid SAOCOM product, basic version.

Conditions to be met for basic validity: - path exists - path is a directory - metadata file exist (.xemt) - folder with same name of metadata file exists - subfolder Data in the previous folder

Parameters:

Name Type Description Default
product str | Path

path to the product to be checked

required

Returns:

Type Description
bool

True if it is a valid product, else False