Empty output images using WcsRequest to download SCL from L2A



I want to download an index (e.g. NDVI) and I also need to download the cloudmasks from L2A which is called SCL.

I considered the problem, that L1C seems to have more images and thus outputs than L2A and adapted the WMS configurator so that the NDVI and the SCL layer use L2A as input.

Using a time range of 10 days (2017-08-01 until 2017-08-10), I get 2 results for the NDVI layer.
However, for the SCL layer I get 5 results, only 2 with content (same time than the 2 NDVI results) and 3 empty images.

Hence, I think that your service did not recognize the invalidity of the empty output files.

Here is the code:

from sentinelhub.data_request import WcsRequest
from sentinelhub.constants import MimeType
from sentinelhub.common import BBox, CRS
import numpy as np

# FUNCTIONS ------------------------------------------------------------------------------------------------------------
def WCS_Download(bbox_coord):

    BBOX = BBox(bbox=bbox_coord, crs=CRS.WGS84)

    for Layer in Layers:

        wcs = WcsRequest(data_folder=outdir,
                        time=(start, end),
                        resx='{}m'.format(res), resy='{}m'.format(res),

        wcs_img = wcs.get_data(save_data=True)

# CONFIG ---------------------------------------------------------------------------------------------------------------

Layers = ['NDVI', 'CLOUD']
INSTANCE_ID = '<instance_id>'
BBOX_coord = [16.53,47.83,16.84,48.31]
res = 20
start = '2017-08-01'
end = '2017-08-10'

# MAIN -----------------------------------------------------------------------------------------------------------------


Hi Johannes,

to correctly obtain Sentinel-2 L2A data using WmsRequest or WcsRequest you basically have to do 2 things:

  • Set parameter layer to a layer which is defined in Sentinel Hub Configurator to use Sentinel-2 L2A source. (You did this correctly.)
  • Set parameter data_source to DataSource.SENTINEL2_L2A. (This is what you are missing.)

It is a bit redundant to specify the same thing in 2 different places but at the moment but the services and the Python package have to get this info separately. For the future we have plans to improve that.

More examples about data source specification in documentation. (I will try to make it a bit clearer for this part.)


Ah ok, thank you very much maleksandrov.
I commented that line out, because I thought its redundant like you said.
Now it works fine!