Quality Data Model
All the analyses implemented in this package have been designed to abstract away the dependency on the input format, relying solely on a generic Python protocol. Once this protocol is satisfied, it enables the execution of all implemented analyses regardless of the type of input product.
This data model protocol and its utilities are available in the perseo_quality.io module.
Protocol
Definition of an input product protocol structure for analyses and processing inside PERSEO Quality
Classes
SARCoordinatesFunction
Bases: Protocol
Protocol to define a function taking SAR coordinates (Azimuth, Range) as inputs and returns a float This can be any generic f: SAR Times -> R.
Methods:
evaluate
Evaluate the wrapped function at given azimuth and range times.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
azimuth_time
|
PreciseDateTime
|
azimuth time at which evaluate the function |
required |
range_time
|
float
|
range time at which evaluate the function |
required |
Returns:
| Type | Description |
|---|---|
float
|
output of the wrapped function |
QualityInputProduct
Bases: Protocol
Protocol to define characteristics of input product for quality tool
Attributes
channels_list
property
Get list of available channels for this product
Methods:
get_channel_data
Gathering all the information that are channel dependent and storing them in a protocol compliant object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_id
|
int | str
|
selected channel identifier |
required |
Returns:
| Type | Description |
|---|---|
ChannelData | ExtendedChannelData
|
ChannelData/ExtendedChannelData-compliant object containing data corresponding to the selected channel |
ChannelData
Bases: Protocol
Protocol to define an object that contains all the channel dependent info and data
Attributes
channel_id
property
Identifier corresponding to the current channel data
sampling_constants
property
Channel data sampling constants
doppler_centroid
property
Channel doppler centroid polynomial wrapper
doppler_rate
property
Channel doppler rate polynomial wrapper
lines_per_burst
property
Lines per burst array, a value for each burst in the swath
radiometric_quantity
property
Channel radiometric quantity
Methods:
get_mid_burst_times
Compute mid azimuth and range times for a given burst.
Returns:
| Type | Description |
|---|---|
tuple[PreciseDateTime, float] | tuple[None, None]
|
azimuth and range mid burst times, (None, None) if no bursts |
get_steering_rate
Compute steering rate at a given azimuth time and for a given burst.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
azimuth_time
|
PreciseDateTime
|
azimuth time |
required |
burst
|
int
|
burst corresponding to the input time |
required |
Returns:
| Type | Description |
|---|---|
float
|
azimuth steering rate |
pixel_to_times_conversion
pixel_to_times_conversion(azimuth_index: float, range_index: float, burst: int = None) -> tuple[PreciseDateTime, float]
Converting input raster pixel coordinates (azimuth_index and range index) to corresponding absolute times, azimuth and range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
azimuth_index
|
float
|
azimuth pixel index, subpixel precision |
required |
range_index
|
float
|
range pixel index, subpixel precision |
required |
burst
|
int
|
burst index, by default None |
None
|
Returns:
| Type | Description |
|---|---|
PreciseDateTime
|
azimuth time |
float
|
range time |
times_to_pixel_conversion
times_to_pixel_conversion(azimuth_time: PreciseDateTime, range_time: float, burst: int = None) -> tuple[float, float]
Converting azimuth and range times to raster image pixels indexes with subpixel precision.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
azimuth_time
|
PreciseDateTime
|
azimuth time |
required |
range_time
|
float
|
range time |
required |
burst
|
int
|
burst number corresponding to these times |
None
|
Returns:
| Type | Description |
|---|---|
float
|
pixel corresponding to azimuth time |
float
|
pixel corresponding to range time |
ground_points_to_burst_association
Determining the burst (or bursts) where the input coordinates lie. If no association can be found (i.e. the point is not visible in the scene), None is returned.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coordinates
|
ArrayLike
|
array of coordinates, in the form (N, 3) |
required |
Returns:
| Type | Description |
|---|---|
list[list[int] | None]
|
list containing the burst association for each input point, None if no association was found |
read_data
read_data(azimuth_index: int, range_index: int, cropping_size: tuple[int, int], output_radiometric_quantity: SARRadiometricQuantity, burst: int | None = None) -> np.ndarray
Extracting the swath portion centered to the provided target position and of size cropping_size by cropping_size. Target position is provided via its azimuth and range indexes in the swath array.
Data block to be read will be assembled this way: 0. first line to be read: azimuth_index - cropping_size[1] // 2 1. first sample to be read: range_index - cropping_size[0] // 2 2. total number of lines to be read: cropping_size[1] 3. total number of samples to be read: cropping_size[0]
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
azimuth_index
|
int
|
index of azimuth time in swath array |
required |
range_index
|
int
|
index of range time in swath array |
required |
cropping_size
|
tuple[int, int]
|
size in pixel of the swath portion to be read (number of samples, number of lines) |
required |
output_radiometric_quantity
|
SARRadiometricQuantity
|
selected output radiometric quantity to convert the read data to, if needed |
required |
burst
|
int
|
if burst is provided, the roi extraction gives error if the boundaries exceed the burst boundaries, by default None |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
cropped swath array centered to the input target coordinates, data is provided with shape (samples, lines) by default the output radiometric quantity is BETA_NOUGHT, unless specified otherwise |
get_location_data
Generating a LocationManager object containing data and info derived from the current ChannelManager and declined to the specific azimuth and range times selected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
azimuth_time
|
PreciseDateTime
|
selected absolute azimuth time |
required |
range_time
|
float
|
selected absolute range time |
required |
Returns:
| Type | Description |
|---|---|
LocationData
|
LocationData instance related to the selected location |
ExtendedChannelData
Bases: ChannelData, Protocol
Extension of original base ChannelData protocol used for Product Channel representation in PERSEO Quality. Extension grants access to new methods that can be used inside for additional computations.
Attributes
channel_id
property
Identifier corresponding to the current channel data
sampling_constants
property
Channel data sampling constants
doppler_centroid
property
Channel doppler centroid polynomial wrapper
doppler_rate
property
Channel doppler rate polynomial wrapper
lines_per_burst
property
Lines per burst array, a value for each burst in the swath
radiometric_quantity
property
Channel radiometric quantity
Methods:
get_roll_angle_deg
Compute roll angle at a given azimuth time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
azimuth_time
|
PreciseDateTime
|
azimuth time at which compute roll angle |
required |
Returns:
| Type | Description |
|---|---|
float | None
|
roll angle in degrees, None if roll angle is not available |
get_altitude_m
Compute altitude over WGS84 ellipsoid at a given azimuth time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
azimuth_time
|
PreciseDateTime
|
azimuth time at which compute altitude |
required |
Returns:
| Type | Description |
|---|---|
float
|
altitude over WGS84 ellipsoid in meters |
get_noise_vector
Get noise vector(s) at a given azimuth index(es).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
azimuth_indexes
|
int | tuple[int, int]
|
azimuth index or tuple of azimuth indexes (start, stop) |
required |
Returns:
| Type | Description |
|---|---|
ndarray | None
|
noise vector(s) corresponding to the input azimuth index(es), if any else None |
times_to_burst_association
Associate the right burst to a given input time point. This function returns 1 association for each input time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
azimuth_times
|
ArrayLike
|
azimuth time array in PreciseDateTime format |
required |
Returns:
| Type | Description |
|---|---|
list[int]
|
burst associated with the given time |
pixel_to_burst_association
get_mid_burst_times
Compute mid azimuth and range times for a given burst.
Returns:
| Type | Description |
|---|---|
tuple[PreciseDateTime, float] | tuple[None, None]
|
azimuth and range mid burst times, (None, None) if no bursts |
get_steering_rate
Compute steering rate at a given azimuth time and for a given burst.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
azimuth_time
|
PreciseDateTime
|
azimuth time |
required |
burst
|
int
|
burst corresponding to the input time |
required |
Returns:
| Type | Description |
|---|---|
float
|
azimuth steering rate |
pixel_to_times_conversion
pixel_to_times_conversion(azimuth_index: float, range_index: float, burst: int = None) -> tuple[PreciseDateTime, float]
Converting input raster pixel coordinates (azimuth_index and range index) to corresponding absolute times, azimuth and range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
azimuth_index
|
float
|
azimuth pixel index, subpixel precision |
required |
range_index
|
float
|
range pixel index, subpixel precision |
required |
burst
|
int
|
burst index, by default None |
None
|
Returns:
| Type | Description |
|---|---|
PreciseDateTime
|
azimuth time |
float
|
range time |
times_to_pixel_conversion
times_to_pixel_conversion(azimuth_time: PreciseDateTime, range_time: float, burst: int = None) -> tuple[float, float]
Converting azimuth and range times to raster image pixels indexes with subpixel precision.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
azimuth_time
|
PreciseDateTime
|
azimuth time |
required |
range_time
|
float
|
range time |
required |
burst
|
int
|
burst number corresponding to these times |
None
|
Returns:
| Type | Description |
|---|---|
float
|
pixel corresponding to azimuth time |
float
|
pixel corresponding to range time |
ground_points_to_burst_association
Determining the burst (or bursts) where the input coordinates lie. If no association can be found (i.e. the point is not visible in the scene), None is returned.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coordinates
|
ArrayLike
|
array of coordinates, in the form (N, 3) |
required |
Returns:
| Type | Description |
|---|---|
list[list[int] | None]
|
list containing the burst association for each input point, None if no association was found |
read_data
read_data(azimuth_index: int, range_index: int, cropping_size: tuple[int, int], output_radiometric_quantity: SARRadiometricQuantity, burst: int | None = None) -> np.ndarray
Extracting the swath portion centered to the provided target position and of size cropping_size by cropping_size. Target position is provided via its azimuth and range indexes in the swath array.
Data block to be read will be assembled this way: 0. first line to be read: azimuth_index - cropping_size[1] // 2 1. first sample to be read: range_index - cropping_size[0] // 2 2. total number of lines to be read: cropping_size[1] 3. total number of samples to be read: cropping_size[0]
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
azimuth_index
|
int
|
index of azimuth time in swath array |
required |
range_index
|
int
|
index of range time in swath array |
required |
cropping_size
|
tuple[int, int]
|
size in pixel of the swath portion to be read (number of samples, number of lines) |
required |
output_radiometric_quantity
|
SARRadiometricQuantity
|
selected output radiometric quantity to convert the read data to, if needed |
required |
burst
|
int
|
if burst is provided, the roi extraction gives error if the boundaries exceed the burst boundaries, by default None |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
cropped swath array centered to the input target coordinates, data is provided with shape (samples, lines) by default the output radiometric quantity is BETA_NOUGHT, unless specified otherwise |
get_location_data
Generating a LocationManager object containing data and info derived from the current ChannelManager and declined to the specific azimuth and range times selected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
azimuth_time
|
PreciseDateTime
|
selected absolute azimuth time |
required |
range_time
|
float
|
selected absolute range time |
required |
Returns:
| Type | Description |
|---|---|
LocationData
|
LocationData instance related to the selected location |
Protocol utilities and support functionalities for Quality I/O
Classes
Functions:
roi_validation
roi_validation(roi: list[int, int, int, int], raster_boundaries: list[int, int, int, int], burst_boundaries: list[int, int, int, int] | None = None) -> None
Validating the region of interest to be read from raster.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
roi
|
list[int, int, int, int]
|
[reading start line, reading start sample, number of lines to be read, number of samples to be read] |
required |
raster_boundaries
|
list[int, int, int, int]
|
[0, 0, raster number of lines, raster number of samples] |
required |
burst_boundaries
|
list[int, int, int, int] | None
|
[current burst starting line, current burst starting sample, lines of current burst, samples of current burst], if None no validation against burst boundaries is performed, by default None |
None
|
Raises:
| Type | Description |
|---|---|
AzimuthExceedsBoundariesError
|
if roi boundaries exceed raster or burst azimuth boundaries |
RangeExceedsBoundariesError
|
ir roi boundaries exceed raster or burst range boundaries |
Layout
SAR Product Layout data models
Classes
L1BurstLayout
dataclass
L1 Burst layout definition and manager
Attributes
range_axis
class-attribute
instance-attribute
mid_burst_azimuth
class-attribute
instance-attribute
Methods:
__init__
__init__(burst_id: int, lines: int, samples: int, lines_step: InitVar[float], lines_start: InitVar[PreciseDateTime], samples_step: InitVar[float], samples_start: InitVar[float]) -> None
__post_init__
__post_init__(lines_step: float, lines_start: PreciseDateTime, samples_step: float, samples_start: float)
is_azimuth_in_burst
Checking if input azimuth belongs to the burst azimuth axis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
az
|
PreciseDateTime
|
azimuth to be checked |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if azimuth belongs to the current burst azimuth axis, else False |
is_range_in_burst
is_azimuth_relative_pixel_in_burst
Checking if input azimuth relative pixel index belongs to the burst azimuth axis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
az_burst_pixel
|
float
|
azimuth pixel index to be checked |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if azimuth pixel index belongs to the current burst azimuth axis, else False |
is_range_relative_pixel_in_burst
azimuth_to_burst_pixel
Associating input azimuth with corresponding pixel relative to burst azimuth start.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
az
|
PreciseDateTime
|
input azimuth value |
required |
Returns:
| Type | Description |
|---|---|
float
|
pixel index (sub-pixel precision) corresponding to the input azimuth, relative to the burst azimuth start |
Raises:
| Type | Description |
|---|---|
AzimuthExceedsBoundariesError
|
if input azimuth exceeds the current burst azimuth axis |
range_to_burst_pixel
Associating input range with corresponding pixel relative to burst range start.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rng
|
float
|
input range value |
required |
Returns:
| Type | Description |
|---|---|
float
|
pixel index (sub-pixel precision) corresponding to the input range, relative to the burst range start |
Raises:
| Type | Description |
|---|---|
RangeExceedsBoundariesError
|
if input range exceeds the current burst range axis |
burst_pixel_to_azimuth
Associating input azimuth relative pixel (sub-pixel precision accepted) to corresponding azimuth value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
az_burst_pixel
|
float
|
relative azimuth pixel |
required |
Returns:
| Type | Description |
|---|---|
PreciseDateTime
|
azimuth associated to the input azimuth relative pixel index |
Raises:
| Type | Description |
|---|---|
AzimuthExceedsBoundariesError
|
if input azimuth pixel index exceeds the current burst azimuth axis |
burst_pixel_to_range
Associating input range relative pixel (sub-pixel precision accepted) to corresponding range value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rng_burst_pixel
|
float
|
relative range pixel |
required |
Returns:
| Type | Description |
|---|---|
float
|
range associated to the input range relative pixel index |
Raises:
| Type | Description |
|---|---|
RangeExceedsBoundariesError
|
if input range pixel index exceeds the current burst range axis |
burst_pixels_to_coordinates
burst_pixels_to_coordinates(az_burst_pixel: float, rng_burst_pixel: float) -> tuple[PreciseDateTime, float]
Associating input azimuth and range relative pixels (sub-pixel precision accepted) to corresponding coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
az_burst_pixel
|
float
|
relative azimuth pixel |
required |
rng_burst_pixel
|
float
|
relative range pixel |
required |
Returns:
| Type | Description |
|---|---|
PreciseDateTime
|
azimuth associated to the input azimuth relative pixel index |
float
|
range associated to the input range relative pixel index |
coordinates_to_burst_pixels
Associating input azimuth and range values to corresponding pixel indexes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
az
|
PreciseDateTime
|
input azimuth value |
required |
rng
|
float
|
input range value |
required |
Returns:
| Type | Description |
|---|---|
float
|
relative azimuth pixel associated to the input azimuth value |
float
|
relative range pixel associated to the input range value |
L1RasterLayout
dataclass
Raster layout definition and management as a collection of BurstLayout objects
Attributes
burst_starting_line_offsets
class-attribute
instance-attribute
raster_azimuth_axis
class-attribute
instance-attribute
raster_range_axis
class-attribute
instance-attribute
mid_swath_azimuth
class-attribute
instance-attribute
mid_swath_range
class-attribute
instance-attribute
Methods:
get_burst_layout
Returning the burst layout object corresponding to the selected burst id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
burst_id
|
int
|
selected burst id |
required |
Returns:
| Type | Description |
|---|---|
L1BurstLayout
|
associated burst layout object |
get_burst_start_coordinates
Returning the azimuth and range start coordinates for the selected burst.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
burst_id
|
int
|
burst number |
required |
Returns:
| Type | Description |
|---|---|
PreciseDateTime
|
azimuth start for the selected burst |
float
|
range start for the selected burst |
get_burst_lines
get_burst_samples
is_azimuth_in_raster
Check if input azimuth does not exceeds the raster azimuth boundaries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
az
|
PreciseDateTime
|
azimuth to be checked |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if azimuth belongs to the raster azimuth axis, else False |
is_range_in_raster
azimuth_to_bursts_association
Detecting which bursts intersect the input azimuth.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
az
|
PreciseDateTime
|
input azimuth |
required |
Returns:
| Type | Description |
|---|---|
list[int]
|
list of burst ids intersecting the input azimuth |
Raises:
| Type | Description |
|---|---|
AzimuthExceedsBoundariesError
|
if azimuth exceeds raster boundaries |
range_to_bursts_association
Detecting which bursts intersect the input range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rng
|
float
|
input range |
required |
Returns:
| Type | Description |
|---|---|
list[int]
|
list of burst ids intersecting the input range |
Raises:
| Type | Description |
|---|---|
RangeExceedsBoundariesError
|
if range exceeds raster boundaries |
azimuth_to_pixel_conversion
azimuth_to_pixel_conversion(az: PreciseDateTime, burst_id: int | None = None) -> list[tuple[int, float]]
Converting input azimuth to raster pixel with sub-pixel precision.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
az
|
PreciseDateTime
|
input azimuth |
required |
burst_id
|
int | None
|
burst to be selected in case of overlapping bursts for the input azimuth, if None all the pixels associated to the given azimuth are returned, by default None |
None
|
Returns:
| Type | Description |
|---|---|
list[tuple[int, float]]
|
list of (burst_id, pixel) corresponding to the input azimuth, more than one tuple in case of overlapping bursts and no burst id provided as input |
Raises:
| Type | Description |
|---|---|
InvalidBurstIdError
|
if the selected burst_id does not contain the input azimuth |
range_to_pixel_conversion
Converting input range to raster pixel with sub-pixel precision.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rng
|
float
|
input range |
required |
burst_id
|
int | None
|
burst to be selected in case of overlapping bursts for the input range, if None all the pixels associated to the given range are returned, by default None |
None
|
Returns:
| Type | Description |
|---|---|
list[tuple[int, float]]
|
list of (burst_id, pixel) corresponding to the input range, more than one tuple in case of more burst covering the input range and no burst id selected |
Raises:
| Type | Description |
|---|---|
InvalidBurstIdError
|
if the selected burst_id does not contain the input range |
pixel_to_azimuth_conversion
Converting input azimuth pixel index to raster azimuth.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
az_pixel_index
|
float
|
input azimuth pixel index, sub-pixel precision is supported |
required |
Returns:
| Type | Description |
|---|---|
PreciseDateTime
|
raster azimuth corresponding to the input azimuth pixel index |
Raises:
| Type | Description |
|---|---|
AzimuthExceedsBoundariesError
|
if input azimuth pixel index exceeds azimuth raster boundaries |
pixel_to_range_conversion
Converting input range pixel index to raster range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rng_pixel_index
|
int
|
input range pixel index, sub-pixel precision is supported |
required |
Returns:
| Type | Description |
|---|---|
float
|
raster range corresponding to the input range pixel index |
Raises:
| Type | Description |
|---|---|
RangeExceedsBoundariesError
|
if input range pixel index exceeds range raster boundaries |
is_roi_in_raster
Checking if input roi is fully within the raster boundaries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
roi
|
list[int, int, int, int]
|
[reading start line, reading start sample, number of lines to be read, number of samples to be read] |
required |
burst
|
int | None
|
if provided the roi is checked against the burst boundaries and not the raster ones, by default None |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if roi lies within raster or burst boundaries, else False |