Sentinel-1
Reader Interface
Sentinel-1 SAFE product format reader.
Classes
Functions:
read_external_orbit
read_external_orbit(xml_path: str | Path, time_boundaries: tuple[PreciseDateTime, PreciseDateTime] | None = None) -> StateVectors
Reading SAFE product external orbit file. External orbits can be very large and span over several hours so time boundaries can be provided to limit the orbit extent just around the acquisition time interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xml_path
|
str | Path
|
path to the external orbit file |
required |
time_boundaries
|
tuple[PreciseDateTime, PreciseDateTime] | None
|
time boundaries as start time [0] and stop time [1], by default None |
None
|
Returns:
| Type | Description |
|---|---|
StateVectors
|
StateVectors dataclass from orbit |
read_channel_metadata
read_channel_metadata(xml_path: str | Path, external_orbit_path: str | Path | None = None) -> support.S1ChannelMetadata
Reading SAFE product channel metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xml_path
|
str | Path
|
path to the channel metadata xml file |
required |
external_orbit_path
|
str | Path | None
|
path to the external orbit xml file, by default None |
None
|
Returns:
| Type | Description |
|---|---|
S1ChannelMetadata
|
channel metadata dataclass |
read_channel_calibration
read_channel_calibration(xml_path: str | Path, radiometric_quantity: SARRadiometricQuantity = SARRadiometricQuantity.BETA_NOUGHT) -> float
Reading SAFE product channel calibration metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xml_path
|
str | Path
|
path to the channel calibration xml file |
required |
radiometric_quantity
|
SARRadiometricQuantity
|
radiometric quantity selected, by default SARRadiometricQuantity.BETA_NOUGHT |
BETA_NOUGHT
|
Returns:
| Type | Description |
|---|---|
float
|
radiometric data scaling factor |
read_channel_noise_vectors
read_channel_noise_vectors(noise_file: str | Path) -> tuple[list[support.S1AzimuthNoiseVector] | None, list[support.S1RangeNoiseVector]]
Reading SAFE product channel noise vectors file in annotations folder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
noise_file
|
str | Path
|
path to the channel noise vectors xml file |
required |
Returns:
| Type | Description |
|---|---|
list[S1AzimuthNoiseVector] | None
|
list of azimuth noise vectors, if any else None |
list[S1RangeNoiseVector]
|
list of range noise vectors |
read_channel_data
read_channel_data(raster_file: str | Path, block_to_read: list[int] = None, scaling_conversion: float = 1) -> np.ndarray
Reading SAFE tiff channel data file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
raster_file
|
str | Path
|
Path to Tiff raster file to be read |
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
|
scaling_conversion
|
float
|
scaling conversion to be applied to the data read |
1
|
Returns:
| Type | Description |
|---|---|
ndarray
|
numpy array containing the data read from raster file, with shape (lines, samples) |
Utilities
Sentinel-1 SAFE reader support module.
Classes
ChannelDataPairMismatch
Bases: RuntimeError
Mismatch between channel data pair (raster data and corresponding metadata)
InvalidChannelId
Bases: RuntimeError
Invalid channel number
InvalidSAFEProduct
Bases: RuntimeError
Invalid SAFE product
InvalidTimeBoundaries
Bases: RuntimeError
Invalid time boundaries with respect to validity period
S1OrbitType
S1DCEstimateMethod
Bases: Enum
Doppler Centroid estimate method: data or geometry
S1AcquisitionMode
S1ResolutionClasses
Bases: Enum
Sentinel-1 resolution classes
S1Polarization
Bases: Enum
Sentinel-1 signal polarization
S1ReferenceFrameType
Bases: Enum
Sentinel-1 available reference frames
Attributes
PSEUDO_EARTH_FIXED
class-attribute
instance-attribute
SATELLITE_ATTITUDE
class-attribute
instance-attribute
S1L1ProductType
Bases: Enum
Sentinel-1 L1 product types
S1ChirpReplica
dataclass
Sentinel-1 PG chirp replica parameters derived from the calibration pulses at 100 MHz bandwidth dataclass
Attributes
Methods:
__init__
__init__(swath: str, time_axis: ndarray, cross_correlation_bandwidth: ndarray, cross_correlation_pslr: ndarray, cross_correlation_islr: ndarray, cross_correlation_peak_location: ndarray, pg_product_amplitude: ndarray, pg_product_phase: ndarray, model_pg_product_amplitude: ndarray, model_pg_product_phase: ndarray, internal_time_delay: ndarray, reconstructed_replica_validity: list[bool], relative_validity: list[bool], absolute_validity: list[bool]) -> None
from_metadata_node
staticmethod
Generating S1ChirpReplica object directly from metadata xml nodes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
replica_info_node
|
_Element
|
replicaInformation metadata xml node |
required |
Returns:
| Type | Description |
|---|---|
S1ChirpReplica
|
chirp replica dataclass |
S1Noise
dataclass
S1RangeNoiseVector
dataclass
Sentinel-1 noise vector dataclass
Attributes
Methods:
__init__
from_node
classmethod
Generating S1RangeNoiseVector object directly from metadata xml node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node
|
_Element
|
noiseRangeVectorList/noiseRangeVector xml node |
required |
Returns:
| Type | Description |
|---|---|
S1RangeNoiseVector
|
object corresponding to the input xml node |
S1AzimuthNoiseVector
dataclass
Sentinel-1 noise vector dataclass
Attributes
Methods:
__init__
__init__(swath: str, first_azimuth_line: int, last_azimuth_line: int, first_range_sample: int, last_range_sample: int, lines: ndarray, lut: ndarray) -> None
from_node
classmethod
Generating S1AzimuthNoiseVector object directly from metadata xml node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node
|
_Element
|
noiseAzimuthVectorList/noiseAzimuthVector xml node |
required |
Returns:
| Type | Description |
|---|---|
S1AzimuthNoiseVector
|
object corresponding to the input xml node |
S1AntennaPattern
dataclass
Sentinel-1 antenna pattern dataclass
S1GeneralChannelInfo
dataclass
Sentinel-1 general channel info representation dataclass
Attributes
Methods:
__init__
__init__(mission_id: str, channel_id: int, swath: str, product_type: S1L1ProductType, polarization: SARPolarization, projection: SARProjection, mode: S1AcquisitionMode, acquisition_mode_std: StandardSARAcquisitionMode, orbit_direction: OrbitDirection, range_sampling_rate: float, signal_frequency: float, start_time: PreciseDateTime, stop_time: PreciseDateTime) -> None
from_metadata_node
staticmethod
from_metadata_node(header_node: _Element, product_info_node: _Element) -> S1GeneralChannelInfo
Generating S1GeneralChannelInfo object directly from metadata xml nodes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
header_node
|
_Element
|
adsHeader metadata xml node |
required |
product_info_node
|
_Element
|
generalAnnotation/productInformation metadata xml node |
required |
Returns:
| Type | Description |
|---|---|
S1GeneralChannelInfo
|
general channel info dataclass |
S1Attitude
dataclass
Sentinel-1 sensor's attitude
Attributes
Methods:
__init__
__init__(num: int, frame: S1ReferenceFrameType, quaternions: ndarray, angular_velocities: ndarray, roll: ndarray, pitch: ndarray, yaw: ndarray, time_axis: ndarray) -> None
from_metadata_node
staticmethod
Generating S1Attitude object directly from metadata xml node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attitude_node
|
_Element
|
attitudeList xml node |
required |
Returns:
| Type | Description |
|---|---|
S1Attitude
|
sensor's attitude dataclass |
S1Pulse
dataclass
Sentinel-1 pulse info
Attributes
tx_pulse_latch_time
class-attribute
instance-attribute
Methods:
__init__
__init__(length: float, bandwidth: float, energy: float, start_frequency: float, start_phase: float, direction: str, tx_pulse_latch_time: float = _S1_TX_PULSE_LATCH_TIME) -> None
from_metadata_nodes
staticmethod
Generating S1Pulse object directly from metadata xml nodes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
swath_processing_node
|
_Element
|
swathProcParams xml node |
required |
downlink_info_node
|
_Element
|
downlinkInformation xml node |
required |
Returns:
| Type | Description |
|---|---|
S1Pulse
|
pulse info dataclass |
S1ChannelMetadata
dataclass
Sentinel-1 channel metadata xml file wrapper
Attributes
Methods:
__init__
__init__(general_info: S1GeneralChannelInfo, orbit: Trajectory, attitude: S1Attitude, burst_info: BurstInfo, raster_info: RasterInfo, dataset_info: DatasetInfo, swath_info: SwathInfo, sampling_constants: SARSamplingFrequencies, acquisition_timeline: AcquisitionTimeline, doppler_centroid_poly: DopplerEvaluator, doppler_rate_poly: DopplerEvaluator, pulse: S1Pulse, coordinate_conversions: CoordinatesConversions, state_vectors: StateVectors, chirp_replica: dict[str, S1ChirpReplica], noise: dict[str, S1Noise], antenna_pattern: dict[str, S1AntennaPattern], burst_sensing_times: ndarray | None) -> None
S1Manifest
Sentinel-1 SAFE manifest parser
Methods:
__init__
Parsing the SAFE product manifest to gather information about data and metadata files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manifest_path
|
Path
|
path to the manifest file |
required |
parse_manifest_document
parse_manifest_document() -> tuple[list[str], list[str], list[str], list[str], PreciseDateTime, tuple[float, float, float, float]]
Parsing SAFE manifest .xml document to gather information to available data, metadata, calibrations and product acquisition time.
Returns:
| Type | Description |
|---|---|
list[str]
|
list of data relative paths with respect to SAFE product folder |
list[str]
|
list of metadata relative paths with respect to SAFE product folder |
list[str]
|
list of calibration relative paths with respect to SAFE product folder |
list[str]
|
list of noise relative paths with respect to SAFE product folder |
PreciseDateTime
|
acquisition start time |
tuple[float, float, float, float]
|
product footprint [min lat, max lat, min lon, max lon] |
SAFEFolderLayout
SAFE file main directory architecture
Attributes
Methods:
__init__
Definition of internal architecture of a SAFE product folder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
path to the SAFE base folder |
required |
S1Product
Sentinel-1 product object
Attributes
acquisition_time
property
Acquisition start time for this product
data_list
property
Returning the list of raster data files in SAFE product
metadata_list
property
Returning the list of metadata files in SAFE product
calibration_list
property
Returning the list of calibration files in SAFE product
channels_number
property
Returning the number of channels in the SAFE product
channels_list
property
Returning the list of channels in terms of SwathID (swath-polarization)
footprint
property
Product footprint as tuple of (min lat, max lat, min lon, max lon)
Methods:
get_files_from_channel_name
Functions:
convert_camel2snake
data_scaling_factor_from_metadata_node
data_scaling_factor_from_metadata_node(calibration_vector_node: _Element, radiometric_quantity: SARRadiometricQuantity = SARRadiometricQuantity.BETA_NOUGHT) -> float
Extract data scaling factor from safe Calibration xml metadata file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
calibration_vector_node
|
_Element
|
calibrationVectorList xml node |
required |
radiometric_quantity
|
SARRadiometricQuantity
|
selected radiometric quantity, by default SARRadiometricQuantity.BETA_NOUGHT |
BETA_NOUGHT
|
Returns:
| Type | Description |
|---|---|
float
|
calibration scaling factor to be applied to raster data |
raster_info_from_metadata_node
raster_info_from_metadata_node(image_information_node: _Element, samples_step: float | None = None) -> RasterInfo
Creating a RasterInfo metadata element from safe xml node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image_information_node
|
_Element
|
imageInformation metadata xml node |
required |
samples_step
|
float | None
|
samples step in seconds, if no None it means that the product is SLC, otherwise it's GRD, by default None |
None
|
Returns:
| Type | Description |
|---|---|
RasterInfo
|
RasterInfo metadata object |
burst_info_from_metadata
Generating BurstInfo object directly from metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
burst_node
|
_Element
|
swathTiming xml node |
required |
raster_info
|
RasterInfo
|
raster info |
required |
Returns:
| Type | Description |
|---|---|
BurstInfo
|
burst info dataclass |
dataset_info_from_metadata_nodes
dataset_info_from_metadata_nodes(header_node: _Element, product_info_node: _Element) -> DatasetInfo
Creating a DatasetInfo metadata element from safe xml nodes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
header_node
|
_Element
|
adsHeader metadata xml node |
required |
product_info_node
|
_Element
|
productInformation metadata xml node |
required |
Returns:
| Type | Description |
|---|---|
DatasetInfo
|
DatasetInfo metadata object |
swath_info_from_metadata
swath_info_from_metadata(product_info: _Element, downlink_info_node: _Element, swath: str) -> SwathInfo
Creating a SwathInfo metadata object from metadata file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
product_info
|
_Element
|
productInformation xml node |
required |
downlink_info_node
|
_Element
|
downlinkInformation xml node |
required |
swath
|
str
|
swath name |
required |
Returns:
| Type | Description |
|---|---|
SwathInfo
|
SwathInfo metadata object |
state_vectors_from_metadata
state_vectors_from_metadata(orbit_node: _Element, orbit_type: S1OrbitType | None = None) -> StateVectors
Generating StateVectors object directly from product metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
orbit_node
|
_Element
|
orbitList xml node |
required |
orbit_type
|
S1OrbitType
|
S1OrbitType orbit type, by default None |
None
|
Returns:
| Type | Description |
|---|---|
StateVectors
|
orbit's state vectors dataclass |
sampling_constants_from_metadata_nodes
sampling_constants_from_metadata_nodes(swath_processing_node: _Element, product_info_node: _Element, image_info_node: _Element) -> SARSamplingFrequencies
Creating a SARSamplingFrequencies metadata element from safe xml nodes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
swath_processing_node
|
_Element
|
swathProcParams metadata xml node |
required |
product_info_node
|
_Element
|
productInformation metadata xml node |
required |
image_info_node
|
_Element
|
imageInformation metadata xml node |
required |
Returns:
| Type | Description |
|---|---|
SARSamplingFrequencies
|
SARSamplingFrequencies metadata object |
acquisition_timeline_from_metadata_nodes
Creating a AcquisitionTimeline metadata element from safe xml nodes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
downlink_info_node
|
_Element
|
downlinkInformation metadata xml node |
required |
Returns:
| Type | Description |
|---|---|
AcquisitionTimeline
|
AcquisitionTimeline metadata object |
doppler_centroid_evaluator_from_metadata_nodes
doppler_centroid_evaluator_from_metadata_nodes(dc_estimate_node: _Element, estimate_method: S1DCEstimateMethod) -> DopplerEvaluator
Creating a DopplerEvaluator doppler centroid polynomial wrapper from metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dc_estimate_node
|
_Element
|
dcEstimateList metadata xml node |
required |
estimate_method
|
S1DCEstimateMethod
|
doppler centroid estimate method |
required |
Returns:
| Type | Description |
|---|---|
DopplerEvaluator
|
DopplerEvaluator dataclass for Doppler Centroid polynomial |
doppler_rate_evaluator_from_metadata_nodes
doppler_rate_evaluator_from_metadata_nodes(azimuth_fm_rate_node: _Element) -> DopplerEvaluator
Creating a DopplerEvaluator doppler rate vector polynomial wrapper from metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
azimuth_fm_rate_node
|
_Element
|
azimuthFmRateList metadata xml node |
required |
Returns:
| Type | Description |
|---|---|
DopplerEvaluator
|
DopplerEvaluator dataclass for Doppler Rate polynomial |
coordinates_conversions_from_metadata
coordinates_conversions_from_metadata(coord_conversion_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 |
|---|---|---|---|
coord_conversion_node
|
_Element
|
coordinateConversion xml node |
required |
Returns:
| Type | Description |
|---|---|
CoordinatesConversions
|
polynomial for coordinate conversion dataclass |
noise_from_metadata_nodes
antenna_pattern_from_metadata_nodes
antenna_pattern_from_metadata_nodes(antenna_pattern_list_node: _Element) -> dict[str, S1AntennaPattern]
Creating a dictionary of S1AntennaPattern dataclass for each swath from safe xml node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
antenna_pattern_list_node
|
_Element
|
antennaPatternList metadata xml node |
required |
Returns:
| Type | Description |
|---|---|
dict[str, S1AntennaPattern]
|
keys are the swaths, values are S1AntennaPattern dataclasses |
burst_sensing_times_from_metadata
Generating burst sensing times array from metadata xml node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
burst_node
|
_Element
|
bursts xml node from metadata |
required |
Returns:
| Type | Description |
|---|---|
ndarray | None
|
burst sensing times array, if any else None |
get_noise_vectors
get_noise_vectors(swath: str, azimuth_indexes: int | tuple[int, int], azimuth_noise_vectors: list[S1AzimuthNoiseVector] | None, range_noise_vectors: list[S1RangeNoiseVector], is_grd: bool) -> np.ndarray
Get the noise vector(s) from Sentinel-1 annotation file for the given azimuth index(es).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
swath
|
str
|
current swath name |
required |
azimuth_indexes
|
int | tuple[int, int]
|
azimuth index (int) at which the noise vector is to be computed, or a tuple [start, stop) of azimuth indices to get multiple vectors in the inclusive range (start included, stop excluded). |
required |
azimuth_noise_vectors
|
list[S1AzimuthNoiseVector] | None
|
azimuth noise vectors, if any else None |
required |
range_noise_vectors
|
list[S1RangeNoiseVector]
|
range noise vectors |
required |
is_grd
|
bool
|
flag to indicate if the product is a GRD or not |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
noise vectors along range samples, with shape (N,) when azimuth_index is an int, (M, N) when azimuth_index is a tuple. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if no azimuth noise vectors are found for the given azimuth index |
is_s1_safe_product
Check if input path corresponds to a valid S1 Safe product, basic version.
Conditions to be met for basic validity: - path exists - path is a directory - path ends with SAFE - S1Product can be instantiated
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 S1 Safe, else False |