Resample Sentinel-2 Products |

This option allows to resample Sentinel-2 products (in SAFE or MUSCATE format) having into account the particularities of the angle bands.

Because of the discontinuity of the angles when the detector changes, the result of the resampling of the azimuth angle bands is not good from the physics point of view, since it blurs the border between detectors when we use a bilinear method. It is needed a specific processor to carry out the resampling of these bands in a "special" way.

This operator uses not only the angles bands but also the detector footprints. By using the footprints, it is possible to "isolate" the angles of each detector and interpolate them without using the angle information of the adjacent detectors (which causes the blurring). In the pixels closest to the border detector-detector, it is necessary to extrapolate the data since not all data is available to carry out the interpolation with bilinear method. Finally, the angles are joined again.

An approximation has to be made for applying this method: currently the detector footprints overlap and in these overlapping regions the algorithm has to decide which detector is used to compute the angles: it selects always the higher one.

For extrapolating the angles, a simple algorithm is used. The angle matrix is analysed line by line and if a NaN is found next to two valid values, an linear extrapolation is made. After the processing line by line, the same step is made by columns. In the case that only one value is available, the surrounding pixels are set to the same value.

The standard resampling algorithm is applied to the rest of the bands and it is possible for these bands to select the resampling methods, as we can do in the generic resampling operator.

##### S2 resampler parameters

Parameter | Description
--- | ---
Output resolution | The output resolution.
Upsampling method | The method used for interpolation (upsampling to a finer resolution). Value must be one of {"Nearest", "Bilinear", "Bicubic"}
Downsampling method | The method used for aggregation (downsampling to a coarser resolution). Value must be one of {"First", "Min", "Max", "Mean", "Median"}
Flag downsampling method | The method used for aggregation (downsampling to a coarser resolution) of flags. Value must be one of {"First", "FlagAnd", "FlagOr", "FlagMedianAnd", "FlagMedianOr"}
Resample on pyramid levels | This setting will increase performance when viewing the image, but accurate resamplings are only retrieved when zooming in on a pixel.
Resample only bands | Resample only a subset of the product bands. Many times there is no need to resample all the bands, because only a few will be used. By selecting a subset of bands, the resample time significantly decreases.

##### S2 Resampler User Interface

The parameters described above can be set through the graphical user interface designed in the SNAP Desktop component: