Which resample algorithm that Sen2cor use?

Dear all,

I saw that Sen2cor resampled at the 60m resolution. So, I would like to ask about which resample algorithm(for ex: nearest (default),bilinear,cubic,cubicspline,lanczos,average,mode) Sen2cor use to resample 10m,20m resolution to 60m resolution?

Best.

the L2A Products Algorithm Theoretical Basis Document says: cubic spline (p.43)

2 Likes

Dear Michi,
Thank for your help

Please note that in the next versions of Sen2Cor, i.e. >= v2.2 the internal resampling strategy will evolve as follow:

  • Downsampling (10m -> 20m, 10m > 60m, 20m -> 60m): uses a block_reduce algorithm
    E.g. for 10m to 20m downsampling, four 10m-pixels are averaged into a single 20m-pixel for each
    20m-pixels of the images as shown in the figure above.
    (block_reduce from skimage.measure module)

  • Upsampling (60m -> 20m, 20m -> 10m): cubic spline is used. (resize from skimage.transform module)

The reason for change was to better preserve the geolocation accuracy between bands of different native resolutions, (e.g. band B8A and B09 used in the water vapour retrieval algorithm), complying with the L1C geolocation convention expressed here as follow:

The geographic coordinates (Geoposition “ULX” and “ULY”) given in the granule metadata correspond to the coordinates of the upper-left corner (vs the middle) of the upper-left pixel of the image. These geographic coordinates are the same for each band for all resolutions (10m, 20m, 60m).

2 Likes

Hi Jerome,

Do you know a document or XML file that support this information?

Thank you

Mikel

Dear Mikel,

A document is currently in preparation that describes the algorithm of Sen2Cor.

If you want to check the exact function used to perform this operation, it is located in L2A_Tables.py:

from skimage.measure import block_reduce

You can then search for “block_reduce” function to check how it is used in the L2A_Tables.py module.

Best regards,
Jérôme

1 Like

Hi Jerome,

thanks for your detailed explanation.

For the upsampling using resize from skimake.transform, assuming correctly that the (default) mode constant is used? I just want to make sure, since the default is apparently set to change to reflect in skimage 0.15.

Best,

Val

Hi Val,

Yes the (default) mode “constant” is used.
If I understand well your comment, there is a plan to change the default mode to “reflect” in a future version 0.15 of scikit-image? In this case we will need to explicitly specify mode=‘constant’ to keep this mode for the upscaling. http://scikit-image.org/docs/dev/api/skimage.transform.html#skimage.transform.resize

Best regards,
Jérôme

Hi Jerome,

I’m currently using skimage version 0.13.0 on Python 3.5.3 - when executing resize from skimage.transform, I’m getting the following warning:

/opt/conda/envs/python35/lib/python3.5/site-packages/skimage/transform/_warps.py:84: UserWarning: The default mode, ‘constant’, will be changed to ‘reflect’ in skimage 0.15.
warn("The default mode, ‘constant’, will be changed to ‘reflect’ in "

Best,

Val