Unexpected results exporting S2 bands as GeoTIFF files

I have been using a simple gpt script (see below) using BandSelect to write S2 (level 2A products) bands as geotiff files. My output is two multiband geotiff files for 10m and 20m bands at their native resolution for analysis in R. I assume I do not need to resample as I am keeping these original resolutions? extract_to_tif_files.xml (1.5 KB)

The resulting 10m band file loads perfectly as a R raster. However the 20m band file fails to load properly - showing as a double image. Running gdalinfo suggests the tif metadata is incorrect, the 20m band file having the same dimensions and resolution as the 10m band file. gdalinfo_geotif_20m_output.txt (2.1 KB)

I have tried exporting as Geotif-Bigtif with slightly different results - correct dimensions in terms of total pixels for the 20m file, but incorrect resolution (10m) resulting in the geography being wrong.

The 20m tif files do reload in SNAP but geography/projection is altered from original.

This seems such a simple task, I can’t understand what I’m doing wrong?? Is there a more reliable way of accomplishing the export? Many thanks.

Update: an answer seems to be (1) Resample to 20m and then (2) Subset by bands to a GeoTIFF-BigTIFF.

Still not sure why BandSelect doesn’t work?

The problem is that the BandSelect operator does not correctly consider the multi-size characteristics of Sentinel-2 data.
As you have found out, adding the Resampling operator fixes this. But for consistency you should not only add it before the 20m bands but also in front of the 10m bands. This should not slow down the processing drastically, because there is not to be resampled actually. In this example I mentioned it:

Thanks for the explanation. I think it might be good if the Help included a mention of this - there is no warning or info about BandSelect not being suitable for multi-resolution products (unlike Subset that requires resampling). I also assumed resampling would be quite time intensive, but as you say it’s not the case.

Actually this should not go into the help, it should be fixed. Either by showing the warning message or even better by considering the multiple resolutions correctly.
As this operator is part of the S1TBX, I guess it wasn’t yet often used with multi-res products.
Anyway, I’ve created an issue (SITBX-498)