RadarSAT-2
Reader Interface
RADARSAT-2 product format reader.
Classes
Functions:
read_product_metadata
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
read_channel_data(raster_file: str | Path, block_to_read: list[int] | None = None, scaling_conversion: float = 1) -> np.ndarray
open_product
Utilities
RADARSAT-2 reader support module.
Classes
RADARSATTimeOrdering
Bases: Enum
RADARSAT-2 available Time Ordering
RADARSATProductType
RADARSATAcquisitionModes
Bases: Enum
RADARSAT-2 L1 acquisition modes
InvalidRADARSATProduct
Bases: RuntimeError
Invalid RADARSAT-2 product
RADARSATAttitude
dataclass
RADARSAT-2 sensor's attitude
Attributes
Methods:
__init__
__init__(num: int, yaw_deg: ndarray, pitch_deg: ndarray, roll_deg: ndarray, time_axis: ndarray, time_step: float) -> None
from_metadata
staticmethod
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
Methods:
__init__
__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
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
image_radiometric_quantity
instance-attribute
Methods:
__init__
__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
Acquisition start time for this product
channels_number
property
Returning the number of channels of COSMO product
channels_list
property
Returning the list of channels in terms of SwathID (swath-polarization)
data_list
property
Returning the list of raster data files of RADARSAT-2 product
metadata_file
property
Returning the product metadata file path of RADARSAT-2 product
beta_calibration_lut_file
property
Returning the beta LUT calibration file path
footprint
property
Product footprint as tuple of (min lat, max lat, min lon, max lon)
Methods:
__init__
Functions:
get_acquisition_mode
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
raster_info_from_metadata
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
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
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
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
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
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
doppler_centroid_poly_from_metadata
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
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
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
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
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
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 |