Skip to content

STACK service specifications


icon


Service Description

The Co-located Stacking (STACK) service computes the co-location of datasets from different sensors, optical and SAR, having different map projections and spatial resolutions on a common grid. It performs resampling and warping of the secondary datasets and the stacking of each secondary with the reference. The upsampling or/and downsampling of spatially overlapping datasets is performed on a common area (intersection based on STAC asset geometry) and is based only on pixel coordinates. The service requires input geocoded products, which are a prerequisite for the stacking service. Collocation results depend on the level of accuracy of geopositioning of source images. The Co-located Stacking processor is built with the GDAL VRT method1.

Workflow

The service implements the workflow depicted below.

graph TB c(cos2) --> d1[Dataset 1] c --> d2[Dataset 2] c --> d3[Dataset ...] c --> dn[Dataset n] d1 --> b1((SAR or opt<br>calibration)) d2 --> b2((SAR or opt<br>calibration)) d3 --> b3((SAR or opt<br>calibration)) dn --> bn((SAR or opt<br>calibration)) b1 --> a1[input 1] b2 --> a2[input 2] b3 --> a3[input ...] bn --> an[input n] subgraph Inputs a1[input 1] a2[input 2] a3[input ...] an[input n] ba1[band list<br>input 1] ba2[band list<br>input 2] ba3[band list<br>input ...] ban[band list<br>input n] end subgraph Collocated Stacking ba1 --> stack ba2 --> stack ba3 --> stack ban --> stack a1 --> stack((collocated<br>stacking)) a2 --> stack((collocated<br>stacking)) a3 --> stack((collocated<br>stacking)) an --> stack((collocated<br>stacking)) stack --> cs1[Collocated<br>input 1] stack --> cs2[Collocated<br>input 2] stack --> cs3[Collocated<br>input ...] stack --> csn[Collocated<br>input n] end subgraph Outputs cs1[Collocated<br>input 1] --> o2[Collocated<br>input 1] cs2[Collocated<br>input 2] --> o3[Collocated<br>input 2] cs3[Collocated<br>input ...] --> o4[Collocated<br>input ...] csn[Collocated<br>input n] --> on[Collocated<br>input n] stack --> o1[Collocated<br>stack] end

Inputs

The Co-located Stacking service requires as input at least geocoded images from supported SAR or optical sensors. When available it uses as input calibrated products from Optical and Radar products Calibration services. Collocation stacking is also possible if the input set of images is built by mixing assets from SAR and Optical EO data

Parameters

The STACK service requires a specified number of mandatory and optional parameters. All service parameters are listed in the below Table 1.

Parameter Description Required Default value
Input product reference(s) Single band asset to be used in the RGB combination for the RED channel YES
List(s) of comma separated bands List of bands as comma separeted CBN YES
Area of Interest Area of interest expressed in WKT NO
S-expression S-expression to create an additional band from the ones in the STACK (e.g. average) NO

Table 1 - Service parameters for the STACK processor.

More information about the service parameters are given below.

Input-product-reference/s

This first mandatory parameter is the list of input products that are used to create the collocated stack.

The input products can be:

  • Optical calibrated products
  • SAR calibrated products
  • Geophysical results of downstream processing service executions

List-of-comma-separated-bands

This second mandatory parameter is a list of bands expressed as a comma separated list of common band names. It defines, for each input-reference product, the list of common band names to extract. There's a one to one mapping between the input-reference and the bands parameters.

Example

If green,nir is set as bands for reference 1 and green,red is set as bands for reference 2, four assets will be defined in STACK as: 1.green, 1.nir, 2.green, 2.red.

AOI (optional)

This third parameter (optional) may define the area of interest expressed as a Well-Known Text value.

Warning

If set, it overrides the automatic determination of the maximium common area between the input-reference products geometry.

Tip

In the definition of “Area of interest as Well Known Text” it is possible to apply as AOI the drawn polygon defined with the area filter. To do so, click on the Magic tool wizard button in the left side of the "Area of interest expressed as Well-known text" box and select the option AOI from the list. The platform will automatically fill the parameter value with the rectangular bounding box taken from current search area in WKT format.

S-expression (optional)

This forth optional parameter allows generating a new band derived from the collocated stack result product (e.g. average, index etc.).

A new band is defined with a key and it's associated s-expression separated by a colon : .

output_band_name:(s-expression)

Warning

The s-expressions inserted by the user must be given within brackets.

As an example to compute average between red bands from a pair of input-reference products (1.red and 2.red):

average:(/ (+ 1.red 2.red) 2)

This will add a new band called average in the collocated stack with values between 1.red and 2.red.

S-expressions in the ESA Charter Mapper supports arithmetic (* + / -) and logical (< <= == != >= > & |) operators plus some pre-defined functions.

More information about supported functions can be found in Table 2.

Function Description Syntax
asarray convert the input (list, tuples, etc.) to an array (asarray x)
interp returns the one-dimensional piecewise linear interpolant to a function with given discrete data points (xp, fp), evaluated at x (interp x xp fp)
mean returns the mean value (scalar) from the given input array x (mean x)
norm_diff returns the mormalized difference between A and B as per ((x - y) / (x + y)) (norm_diff x y)
where return elements chosen from x or y depending on condition (where (condition) x y)

Table 2 - Supported functions that can be used in s-expressions.

Examples of s-expresions which can be used to generate new bands from the STACK are listed in the below sections.

Sum

The following s-expression:

sum:(+ 1.pan 2.pan)

can be used to generate a band as the sum of 1.pan and 2.pan.

Difference

The following s-expression:

difference:(- 1.pan 2.pan)

can be used to generate a band as the difference of 1.pan and 2.pan.

Average

The following s-expression:

average:(/ (+ 1.pan 2.pan) 2)

can be used to generate a band as the average between the values of 1.pan and 2.pan.

Difference from average

The following s-expression:

diff_from_avg:(- 1.pan (mean 1.pan))

can be used to estimate a band of difference from the average value of 1.pan.

Normalized difference

The following s-expression:

ndvi:(norm_diff 1.nir 1.red)

can be used to derive multiple spectral indexes defined as normalized difference (e.g. NDVI, NDWI, NDBI, etc.).

Interpolate or rescale

The following s-expression:

rescaled:(interp 1.red (asarray 0 10000) (asarray 0 1))

can be used to interpolate the resclaed TOA reflectance into its original [0,1] range. Here (asarray 0 10000) returns [0, 10000] and is used to specify input range to be used for the interpolation.

Binarization

The following s-expression:

opt_water_mask:(where (>= (norm_diff 1.green 1.nir) 0.3) 1 0)

can be used to derive water mask from binarization. Here (norm_diff 1.green 1.nir) is used to derive the NDWI index. The value 0.3 represents the threshold as TOA reflectance. Similar s-expressions can be made also for SAR such as:

sar_water_mask:(where (<= 1.s0_db_c_hh -23) 1 0)

in which 1.s0_db_c_hh is the asset and the value -23 represents the threshold as Sigma Nought in dB.

Outputs

The output of this service is a multi-mission and multitemporal co-located stack with N assets as single band GeoTIFF in COG format. The output is a STAC item with as many assets as provided in input. All assets of this co-located stack are COG and have the same shape.

STACK Product specifications can be found below.

Attribute Value / description
Long Name Collocated stack from Optical or SAR EO data
Short Name co-loc-stack
Description Multiband co-located stack of N images from optical and radar sensors
Processing level L1 / L2 (according to input)
Data Type Float32
Band N
Format COG
Projection According to input
Fill Value According to input

  1. GDAL documentation, gdalbuildvrt, available at: https://gdal.org/programs/gdalbuildvrt.html