SAOCOM
Reader Interface
SAOCOM product format reader.
Classes
Functions:
read_channel_metadata
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
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
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
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
polarization_dict = {'vv': SARPolarization.VV, 'hh': SARPolarization.HH, 'hv': SARPolarization.HV, 'vh': SARPolarization.VH}
data_type_dict
module-attribute
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'}
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
SAOCOMAcquisitionMode
Bases: Enum
SAOCOM L1 acquisition modes
SAOCOMGeneralChannelInfo
dataclass
SAOCOM general channel info dataclass
Attributes
Methods:
__init__
__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
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
image_radiometric_quantity
instance-attribute
Methods:
__init__
__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
acquisition_time
property
Acquisition start time for this product
channels_number
property
Returning the number of channels of SAOCOM product
footprint
property
Product footprint as tuple of (min lat, max lat, min lon, max lon)
Methods:
__init__
get_files_from_channel_name
SAOCOMManifest
dataclass
SAOCOM .xemt manifest class
Attributes
Methods:
__init__
__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
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
burst_info_from_metadata
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
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
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
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
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
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
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
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
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
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
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 |