COSMO SkyMed
Reader Interface
COSMO product format reader.
Classes
Functions:
read_channel_metadata
Reading channel metadata info and storing them in a COSMOChannelMetadata dataclass.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str | Path
|
Path to the .h5 product |
required |
channel_id
|
str
|
selected channel id |
required |
Returns:
| Type | Description |
|---|---|
COSMOChannelMetadata
|
COSMOChannelMetadata metadata dataclass |
read_channel_data
read_channel_data(raster_file: str | Path, channel_id: str, block_to_read: list[int] | None = None, scaling_conversion: float = 1)
Reading COSMO data file as HDF5 .h5 file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
raster_file
|
str | Path
|
Path to HDF5 .h5 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
|
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
COSMO reader support module.
Attributes
METERS_TO_SECONDS_CONVERSION
module-attribute
Classes
InvalidCOSMOProduct
Bases: RuntimeError
Invalid COSMO product
COSMOGeneration
Bases: Enum
COSMO Generation
COSMOProductType
Bases: Enum
COSMO Product Types
COSMOAcquisitionModes
Bases: Enum
COSMO supported acquisition modes
COSMOGeneralChannelInfo
dataclass
COSMO general channel info dataclass
Attributes
Methods:
__init__
__init__(product_name: str, channel_id: str, swath: str, product_level: COSMOProductType, polarization: SARPolarization, projection: SARProjection, acquisition_mode: COSMOAcquisitionModes, acquisition_mode_std: StandardSARAcquisitionMode, orbit_direction: OrbitDirection, signal_frequency: float, acq_start_time: PreciseDateTime, acq_stop_time: PreciseDateTime) -> None
from_metadata
classmethod
Generating COSMOGeneralChannelInfo object directly from metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
File
|
root object |
required |
channel_id
|
str
|
channel id |
required |
Returns:
| Type | Description |
|---|---|
COSMOGeneralChannelInfo
|
general channel info dataclass |
COSMOChannelMetadata
dataclass
COSMO channel metadata dataclass
Attributes
image_radiometric_quantity
instance-attribute
Methods:
__init__
__init__(general_info: COSMOGeneralChannelInfo, orbit: Trajectory, image_calibration_factor: float, 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, coordinate_conversions: CoordinatesConversions, state_vectors: StateVectors) -> None
COSMOProduct
COSMO product object
Attributes
acquisition_time
property
Acquisition start time for this product
channels_number
property
Returning the number of channels of COSMO product
footprint
property
Product footprint as tuple of (min lat, max lat, min lon, max lon)
Methods:
Functions:
raster_info_from_metadata
Creating a RasterInfo metadata object from metadata file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
File
|
root object |
required |
channel_id
|
str
|
channel id |
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 |
range_ref_time
|
float
|
reference range start time |
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 |
|---|---|---|---|
root_attributes
|
AttributeManager
|
metadata root attributes |
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 |
|---|---|---|---|
root
|
File
|
root object |
required |
channel_id
|
str
|
channel id |
required |
Returns:
| Type | Description |
|---|---|
SwathInfo
|
SwathInfo metadata object |
state_vectors_from_metadata
Generating StateVectors object directly from product metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root_attributes
|
AttributeManager
|
metadata root attributes |
required |
Returns:
| Type | Description |
|---|---|
StateVectors
|
orbit's state vectors dataclass |
sampling_constants_from_metadata
sampling_constants_from_metadata(swath_attributes: AttributeManager, raster_info: RasterInfo) -> SARSamplingFrequencies
Creating a SARSamplingFrequencies metadata object from metadata file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
swath_attributes
|
AttributeManager
|
metadata swath attributes |
required |
raster_info
|
RasterInfo
|
raster info |
required |
Returns:
| Type | Description |
|---|---|
SARSamplingFrequencies
|
SARSamplingFrequencies metadata object |
pulse_info_from_metadata
Creating a PulseInfo metadata object from metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
swath_attributes
|
AttributeManager
|
metadata swath attributes |
required |
Returns:
| Type | Description |
|---|---|
PulseInfo
|
PulseInfo metadata object |
doppler_centroid_poly_from_metadata
Creating a DopplerEvaluator doppler centroid polynomial wrapper from metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
File
|
root object |
required |
channel_id
|
str
|
channel id |
required |
Returns:
| Type | Description |
|---|---|
DopplerEvaluator
|
DopplerEvaluator dataclass for Doppler Centroid polynomial |
doppler_rate_poly_from_metadata
Creating a DopplerEvaluator doppler rate vector polynomial wrapper from metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
File
|
root object |
required |
channel_id
|
str
|
channel id |
required |
Returns:
| Type | Description |
|---|---|
DopplerEvaluator
|
DopplerEvaluator dataclass for Doppler Rate polynomial |
coordinates_conversions_from_metadata
coordinates_conversions_from_metadata(root_attributes: AttributeManager, azimuth_ref: PreciseDateTime, range_step_m: float, projection: SARProjection) -> 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 |
|---|---|---|---|
root_attributes
|
AttributeManager
|
metadata root attributes |
required |
azimuth_ref
|
PreciseDateTime
|
reference azimuth time |
required |
range_step_m
|
float
|
range step in meters |
required |
projection
|
SARProjection
|
product projection |
required |
Returns:
| Type | Description |
|---|---|
CoordinatesConversions
|
polynomial for coordinate conversion dataclass |
compute_calibration_factor
detect_acquisition_mode
Detect Acquisition Mode from string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
acq_mode_str
|
str
|
annotated acquisition mode |
required |
Returns:
| Type | Description |
|---|---|
COSMOAcquisitionModes
|
COSMO Acquisition Mode enum |
detect_product_type
Detect Product Type from string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
product_type_str
|
str
|
annotated product type |
required |
Returns:
| Type | Description |
|---|---|
COSMOProductType
|
COSMO Product Type enum |
get_raster
Get the raster associated to a channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
File
|
root object |
required |
channel_id
|
str
|
selected channel id |
required |
Returns:
| Type | Description |
|---|---|
Dataset
|
Raster dataset |
get_cosmo_generation
Get COSMO product generation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
File
|
root object |
required |
Returns:
| Type | Description |
|---|---|
COSMOGeneration
|
COSMO product generation |
is_cosmo_product
Check if input path corresponds to a valid COSMO product, basic version.
Conditions to be met for basic validity: - path exists - path is a .h5 file - open file and read acquisition mode
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 |