Skip to content

RadarSAT-2

Reader Interface

RADARSAT-2 product format reader.

Classes

Functions:

read_product_metadata

Python
read_product_metadata(xml_path: str | Path, beta_calibration_xml: str | Path | None) -> dict[str, support.RADARSATChannelMetadata]

Read RADARSAT-2 product metadata.

Parameters:

Name Type Description Default
xml_path str | Path

Path to the .xml metadata file

required
beta_calibration_xml str | Path | None

Path to the beta calibration .xml metadata file

required

Returns:

Type Description
dict[str, RADARSATChannelMetadata]

dictionary with channel id as keys and RADARSATChannelMetadata dataclass as values

read_channel_data

Python
read_channel_data(raster_file: str | Path, block_to_read: list[int] | None = None, scaling_conversion: float = 1) -> np.ndarray

open_product

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

Open a RADARSAT-2 product.

Parameters:

Name Type Description Default
pf_path str | Path

Path to the RADARSAT-2 product

required

Returns:

Type Description
RADARSATProduct

RADARSATProduct object corresponding to the input RADARSAT-2 product

Utilities

RADARSAT-2 reader support module.

Classes

RADARSATTimeOrdering

Bases: Enum

RADARSAT-2 available Time Ordering

Attributes

INCREASING class-attribute instance-attribute
Python
INCREASING = 'Increasing'
DECREASING class-attribute instance-attribute
Python
DECREASING = 'Decreasing'

RADARSATProductType

Bases: Enum

RADARSAT-2 L1 product types

Attributes

SLC class-attribute instance-attribute
Python
SLC = 'SLC'
SGF class-attribute instance-attribute
Python
SGF = 'SGF'
SGX class-attribute instance-attribute
Python
SGX = 'SGX'
SGC class-attribute instance-attribute
Python
SGC = 'SGC'
SSG class-attribute instance-attribute
Python
SSG = 'SSG'
SPG class-attribute instance-attribute
Python
SPG = 'SPG'
SCF class-attribute instance-attribute
Python
SCF = 'SCF'
SCS class-attribute instance-attribute
Python
SCS = 'SCS'

RADARSATAcquisitionModes

Bases: Enum

RADARSAT-2 L1 acquisition modes

Attributes

STRIPMAP class-attribute instance-attribute
Python
STRIPMAP = auto()
SCANSAR class-attribute instance-attribute
Python
SCANSAR = auto()
SPOTLIGHT class-attribute instance-attribute
Python
SPOTLIGHT = auto()

InvalidRADARSATProduct

Bases: RuntimeError

Invalid RADARSAT-2 product

RADARSATAttitude dataclass

RADARSAT-2 sensor's attitude

Attributes

num instance-attribute
Python
num: int
yaw_deg instance-attribute
Python
yaw_deg: ndarray
pitch_deg instance-attribute
Python
pitch_deg: ndarray
roll_deg instance-attribute
Python
roll_deg: ndarray
time_axis instance-attribute
Python
time_axis: ndarray
time_step instance-attribute
Python
time_step: float

Methods:

__init__
Python
__init__(num: int, yaw_deg: ndarray, pitch_deg: ndarray, roll_deg: ndarray, time_axis: ndarray, time_step: float) -> None
from_metadata staticmethod
Python
from_metadata(attitude_data_node: _Element, namespace: dict[str, str]) -> RADARSATAttitude

Generating RADARSATAttitude object directly from metadata xml node.

Parameters:

Name Type Description Default
attitude_data_node _Element

attitudeInformation xml node

required
namespace dict[str, str]

xml namespace

required

Returns:

Type Description
RADARSATAttitude

sensor's attitude dataclass

RADARSATGeneralChannelInfo dataclass

RADARSAT-2 general channel info representation dataclass

Attributes

product_name instance-attribute
Python
product_name: str
product_id instance-attribute
Python
product_id: int
channel_id instance-attribute
Python
channel_id: str
swath instance-attribute
Python
swath: str
satellite instance-attribute
Python
satellite: str
acq_start_time instance-attribute
Python
acq_start_time: PreciseDateTime
product_type instance-attribute
Python
product_type: RADARSATProductType
acquisition_mode instance-attribute
Python
acquisition_mode: RADARSATAcquisitionModes
acquisition_mode_std instance-attribute
Python
acquisition_mode_std: StandardSARAcquisitionMode
polarization instance-attribute
Python
polarization: SARPolarization
projection instance-attribute
Python
projection: SARProjection
orbit_direction instance-attribute
Python
orbit_direction: OrbitDirection

Methods:

__init__
Python
__init__(product_name: str, product_id: int, channel_id: str, swath: str, satellite: str, acq_start_time: PreciseDateTime, product_type: RADARSATProductType, acquisition_mode: RADARSATAcquisitionModes, acquisition_mode_std: StandardSARAcquisitionMode, polarization: SARPolarization, projection: SARProjection, orbit_direction: OrbitDirection) -> None
from_metadata_node staticmethod
Python
from_metadata_node(root: _Element, namespace: dict[str, str], name: str, channel_id: str) -> RADARSATGeneralChannelInfo

Generating S1GeneralChannelInfo object directly from metadata xml nodes.

Parameters:

Name Type Description Default
root _Element

root metadata xml node

required
namespace dict[str, str]

xml namespace

required
name str

product name

required
channel_id str

current channel ID

required

Returns:

Type Description
RADARSATGeneralChannelInfo

general channel info dataclass

RADARSATChannelMetadata dataclass

RADARSAT-2 channel metadata dataclass

Attributes

general_info instance-attribute
Python
general_info: RADARSATGeneralChannelInfo
attitude instance-attribute
Python
attitude: RADARSATAttitude
image_calibration_factor instance-attribute
Python
image_calibration_factor: float
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
state_vectors instance-attribute
Python
state_vectors: StateVectors
orbit instance-attribute
Python
orbit: Trajectory
samples_ordering instance-attribute
Python
samples_ordering: RADARSATTimeOrdering
lines_ordering instance-attribute
Python
lines_ordering: RADARSATTimeOrdering
doppler_centroid_poly instance-attribute
Python
doppler_centroid_poly: DopplerEvaluator
doppler_rate_poly instance-attribute
Python
doppler_rate_poly: DopplerEvaluator
coordinate_conversions instance-attribute
Python
coordinate_conversions: CoordinatesConversions

Methods:

__init__
Python
__init__(general_info: RADARSATGeneralChannelInfo, attitude: RADARSATAttitude, image_calibration_factor: float, image_radiometric_quantity: SARRadiometricQuantity, burst_info: BurstInfo, raster_info: RasterInfo, dataset_info: DatasetInfo, swath_info: SwathInfo, sampling_constants: SARSamplingFrequencies, state_vectors: StateVectors, orbit: Trajectory, samples_ordering: RADARSATTimeOrdering, lines_ordering: RADARSATTimeOrdering, doppler_centroid_poly: DopplerEvaluator, doppler_rate_poly: DopplerEvaluator, coordinate_conversions: CoordinatesConversions) -> None

RADARSATProduct

RADARSAT-2 product object

Attributes

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 COSMO product

channels_list property
Python
channels_list: list[str]

Returning the list of channels in terms of SwathID (swath-polarization)

data_list property
Python
data_list: list[Path]

Returning the list of raster data files of RADARSAT-2 product

product_type property
Python
product_type: RADARSATProductType

Returning the product type

metadata_file property
Python
metadata_file: Path

Returning the product metadata file path of RADARSAT-2 product

beta_calibration_lut_file property
Python
beta_calibration_lut_file: Path

Returning the beta LUT calibration file path

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

RADARSAT-2 Product init from directory path.

Parameters:

Name Type Description Default
path str | Path

path to RADARSAT-2 product

required
get_raster_file_from_channel_name
Python
get_raster_file_from_channel_name(channel_name: str) -> Path

Get raster file path associated to input channel name.

Parameters:

Name Type Description Default
channel_name str

selected channel name

required

Returns:

Type Description
Path

raster file path

Functions:

get_acquisition_mode

Python
get_acquisition_mode(beam_mode: str) -> RADARSATAcquisitionModes

Parameters:

Name Type Description Default
beam_mode str

RS2 beam mode mnemomic

required

Returns:

Type Description
RADARSATAcquisitionModes

acquisition mode among STRIPMAP, SCANSAR, SPOTLIGHT

read_lut

Python
read_lut(path: str | Path) -> float

Reading Beta LUT calibration file to extract the calibration factor.

Parameters:

Name Type Description Default
path str | Path

Path to the Beta LUT calibration .xml file

required

Returns:

Type Description
float

calibration factor

raster_info_from_metadata

Python
raster_info_from_metadata(image_generation_parameters_node: _Element, image_attributes_node: _Element, namespace: dict[str, str], projection: SARProjection) -> RasterInfo

Creating a RasterInfo metadata element from xml node.

Parameters:

Name Type Description Default
image_generation_parameters_node _Element

imageGenerationParameters metadata xml node

required
image_attributes_node _Element

imageAttributes metadata xml node

required
namespace dict[str, str]

xml namespace

required
projection SARProjection

SAR data projection

required

Returns:

Type Description
RasterInfo

RasterInfo metadata object

burst_info_from_metadata

Python
burst_info_from_metadata(raster_info: RasterInfo) -> BurstInfo

Generating BurstInfo object directly from metadata.

Parameters:

Name Type Description Default
raster_info RasterInfo

product raster info

required

Returns:

Type Description
BurstInfo

burst info dataclass

dataset_info_from_metadata

Python
dataset_info_from_metadata(source_attributes_node: _Element, namespace: dict[str, str], projection: SARProjection, acq_mode: RADARSATAcquisitionModes) -> DatasetInfo

Creating a DatasetInfo metadata element from xml nodes.

Parameters:

Name Type Description Default
source_attributes_node _Element

sourceAttributes metadata xml node

required
namespace dict[str, str]

xml namespace

required
projection SARProjection

product projection

required
acq_mode RADARSATAcquisitionModes

acquisition mode

required

Returns:

Type Description
DatasetInfo

DatasetInfo metadata object

swath_info_from_metadata

Python
swath_info_from_metadata(source_attributes_node: _Element, namespace: dict[str, str], prod_type: RADARSATProductType) -> SwathInfo

Creating a SwathInfo metadata object from metadata file.

Parameters:

Name Type Description Default
source_attributes_node _Element

sourceAttributes xml node

required
namespace dict[str, str]

xml namespace

required
prod_type RADARSATProductType

product type

required

Returns:

Type Description
SwathInfo

SwathInfo metadata object

state_vectors_from_metadata

Python
state_vectors_from_metadata(orbit_data_node: _Element, namespace: dict[str, str]) -> StateVectors

Generating StateVectors object directly from product metadata.

Parameters:

Name Type Description Default
orbit_data_node _Element

OrbitInformation xml node

required

Returns:

Type Description
StateVectors

orbit's state vectors dataclass

sampling_constants_from_metadata

Python
sampling_constants_from_metadata(image_generation_parameters_node: _Element, namespace: dict[str, str], raster_info: RasterInfo, projection: SARProjection) -> SARSamplingFrequencies

Creating a SARSamplingFrequencies metadata element from xml nodes.

Parameters:

Name Type Description Default
image_generation_parameters_node _Element

imageGenerationParameters metadata xml node

required
namespace dict[str, str]

xml namespace

required
raster_info RasterInfo

raster info

required
projection SARProjection

product projection

required

Returns:

Type Description
SARSamplingFrequencies

sampling frequencies

calibration_factor_from_metadata

Python
calibration_factor_from_metadata(file_path: str | Path, product_type: RADARSATProductType) -> float

Retrieving the correct calibration factor to convert digital values to Beta Nought.

Parameters:

Name Type Description Default
file_path str | Path

Path to the calibration LUT .xml file

required

Returns:

Type Description
float

beta nought calibration factor

doppler_centroid_poly_from_metadata

Python
doppler_centroid_poly_from_metadata(doppler_centroid_node: _Element, namespace: dict[str, str]) -> DopplerEvaluator

Creating a DopplerEvaluator doppler centroid polynomial wrapper from metadata.

Parameters:

Name Type Description Default
doppler_centroid_node _Element

dopplerCentroid metadata xml node

required
namespace dict[str, str]

xml namespace

required

Returns:

Type Description
DopplerEvaluator

DopplerEvaluator dataclass for Doppler Centroid polynomial

doppler_rate_poly_from_metadata

Python
doppler_rate_poly_from_metadata(doppler_rate_node: _Element, namespace: dict[str, str]) -> DopplerEvaluator

Creating a DopplerEvaluator doppler rate vector polynomial wrapper from metadata.

Parameters:

Name Type Description Default
doppler_rate_node _Element

dopplerRateValues metadata xml node

required
namespace dict[str, str]

xml namespace

required

Returns:

Type Description
DopplerEvaluator

DopplerEvaluator dataclass for Doppler Rate polynomial

coordinates_conversions_from_metadata

Python
coordinates_conversions_from_metadata(image_generation_parameters_node: _Element, namespace: dict[str, str], raster_info: RasterInfo) -> 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
image_generation_parameters_node _Element

imageGenerationParameters metadata xml node

required
namespace dict[str, str]

xml namespace

required
raster_info RasterInfo

product raster info

required

Returns:

Type Description
CoordinatesConversions

polynomial for coordinate conversion dataclass

get_basic_info_from_metadata

Python
get_basic_info_from_metadata(metadata_path: str | Path) -> tuple[PreciseDateTime, RADARSATProductType, list[str], tuple[float, float, float, float], str]

Recovering acquisition time and list of channels.

Parameters:

Name Type Description Default
metadata_path str | Path

Path to RADARSAT-2 metadata file

required

Returns:

Type Description
PreciseDateTime

acquisition time in PreciseDateTime format

RADARSATProductType

product type

list[str]

list of channels ids

tuple[float, float, float, float]

scene footprint [min lat, max lat, min lon, max lon]

str

beam mode

get_projection_from_product_type

Python
get_projection_from_product_type(prod_type: RADARSATProductType) -> SARProjection

Get product projection from product type.

Parameters:

Name Type Description Default
prod_type RADARSATProductType

product type

required

Returns:

Type Description
SARProjection

product projection

is_radarsat_product

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

Check if input path corresponds to a valid RADARSAT-2 product, basic version.

Conditions to be met for basic validity: - path is dir - metadata file exist - read basic info from metadata file

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