rs_dpr_service/s1_slc_s1ard_format.md¶
Convert the Sentinel-1 TOPSAR SLC products read by CPM 3.0.0 into the format expected by the S1 ARD processor.
The S1 ARD processor (s1-ard 1.2.0) runs with CPM 3.0.0rc4 and validates its SLC inputs against the Zarr
layout written by CPM 2.x: one sub-product per burst AND per polarization, flat other_metadata,
sar:polarization, a processing_history indexed by product level, and line/pixel coordinates.
Since CPM 3.0.0, the SAFE conversion joins both polarizations of each burst along a polarization
dimension (CPM issue #1042: https://gitlab.eopf.copernicus.eu/cpm/eopf-cpm/-/issues/1042), splits
other_metadata by polarization and drops several annotation attributes. Its processing history parser
is also broken (only one "Unknown" entry). So S1 ARD rejects the SLC products converted by CPM 3.0.0.
CPM 3.0.0 also mixes up the polarizations of the data (e.g. the 'VV' label contains the VH pixels and noise LUTs): the real polarization of the measurements is found from their pixels, and the noise LUTs are read from the XML files.
This module rebuilds the S1 ARD layout from the DataTree read by CPM 3.0.0 (before it is written, lazily, without copying the measurement data) and from the XML and TIFF files of the SAFE product. The result is NOT compatible with the CPM 3.0.0 SLC model: this is written in its STAC metadata.
This module runs in the EOPF Dask worker (see safe_to_zarr.py), where eopf, lxml and xarray are installed.
SafeAnnotations
¶
XML annotations of a Sentinel-1 TOPSAR SLC SAFE product, read once for all the bursts.
Source code in docs/rs-dpr-service/rs_dpr_service/s1_slc_s1ard_format.py
build_other_metadata(annotation, cpm_metadata, burst_id, image_number=None)
¶
Rebuild the CPM 2.x other_metadata of one burst and polarization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
annotation
|
dict[str, Any]
|
metadata of the annotation XML file, from eopf parse_annotations() |
required |
cpm_metadata
|
dict[str, Any]
|
other_metadata[ |
required |
burst_id
|
str
|
burst identifier |
required |
image_number
|
str | None
|
image number of the annotation XML file. CPM 3.0.0 writes the same image number for all the polarizations, so it is read from the XML file. |
None
|
Source code in docs/rs-dpr-service/rs_dpr_service/s1_slc_s1ard_format.py
is_s1_topsar_slc_safe(safe_uri)
¶
Return True if the SAFE product is a Sentinel-1 IW or EW SLC product.
parse_processing_history(manifest_path)
¶
Read the processing history of a Sentinel-1 SAFE manifest, indexed by product level.
This implements what the CPM 3.0.0 ToProcessingHistoryS01 formatter is meant to do: the CPM version
tests XML attributes with "name" in node (which looks for child elements in lxml), so it never
descends into the processing tree and returns a single "Unknown" entry dated 1970.
S1 ARD reads processing_history["Level-1 Intermediate SLC Product"][0].
Source code in docs/rs-dpr-service/rs_dpr_service/s1_slc_s1ard_format.py
to_s1ard_format(product, safe_path)
¶
Convert a Sentinel-1 TOPSAR SLC product read by CPM 3.0.0 into the format expected by S1 ARD 1.2.0.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
product
|
DataTree
|
product read from the SAFE by eopf.store.open_datatree (CPM 3.0.0) |
required |
safe_path
|
str
|
local path of the SAFE product, to read its XML files |
required |
Returns:
| Type | Description |
|---|---|
DataTree
|
A new DataTree, with one burst per polarization. The measurement data stays lazy. |