WCS GetCoverage sometimes returns black images

Hello!

I am downloading Sentinel-2 L2A imagery as PNG with a simple truecolor script.
In rare cases a WCS request returns a PNG that is valid and have a proper size but have only one color (black).
If I retry the request later, the same request returns a proper image (multiple colors).
If I request WFS GetFeature after WCS request gave a bad image, I got a sane-looking data with proper dates.

It happens maybe in 1% of requests every day after fresh satellite data arrives.
At my example I had requested image (bad.png) 15 hours after image was processed according to WFS.
Next day I repeated the original WCS request and got a good image (good.png).
Requests and script are probably okay because they work 99% time with different places.

So why I got a bad image for the first time?

Some technical data:

  1. Images

Cannot post two images so here is the link: imgur.com/a/I7EtBEX

  1. analyzing images with ImageMagick

identify -verbose -unique bad.png | grep -E ‘Filesize|Colors:|Number’
Colors: 1
Filesize: 100B
Number pixels: 5460

identify -verbose -unique good.png | grep -E ‘Filesize|Colors:|Number’
Colors: 3159
Filesize: 11641B
Number pixels: 5460

  1. GetCoverage request

https://services.sentinel-hub.com/ogc/wcs/REDACTED?SERVICE=wcs&WARNINGS=False&MAXCC=100.0&Transparent=True&ShowLogo=False&Geometry=POLYGON+((43.245773+76.93730499999999%2C+43.249041+76.937%2C+43.24928+76.94056999999999%2C+43.249417+76.94219099999999%2C+43.247312+76.942356%2C+43.246065+76.942544%2C+43.246116+76.94435199999999%2C+43.242352+76.945009%2C+43.241855+76.93784599999999%2C+43.245773+76.93730499999999))&BBOX=43.241856%2C76.937001%2C43.249416%2C76.945008&FORMAT=image%2Fpng&CRS=EPSG%3A4326&TIME=2020-08-08T04%3A56%3A58%2F2020-08-08T06%3A56%3A58&RESX=10m&RESY=10m&COVERAGE=TRUECOLOR_S2_L2A&REQUEST=GetCoverage&VERSION=1.1.2

  1. GetFeature request

https://services.sentinel-hub.com/ogc/wfs/REDACTED?SERVICE=wfs&REQUEST=GetFeature&TYPENAMES=S2.TILE&BBOX=43.241856%2C76.937001%2C43.249416%2C76.945008&OUTPUTFORMAT=application%2Fjson&SRSNAME=EPSG%3A4326&TIME=2020-08-08T04%3A56%3A00%2F2020-08-08T06%3A56%3A00&MAXCC=100.0&MAXFEATURES=100&FEATURE_OFFSET=0

  1. Image was taken at “date”: “2020-08-08”, “time”: “05:56:58” and located in two tiles
    Image first requested on the same day at 19:10 UTC.

  2. evalScript

    //VERSION=3 (auto-converted from 1)
    let minVal = 0.0;
    let maxVal = 0.4;
    let viz = new HighlightCompressVisualizer(minVal, maxVal);
    
    function evaluatePixel(samples) {
    let val = [samples.B04, samples.B03, samples.B02, samples.dataMask];
    return viz.processList(val);
    }
    
    function setup() {
    return {
    input: [{bands: ["B02",        "B03",        "B04",        "dataMask"      ]    }],
    output: {      bands: 4    }
    }}
1 Like

It seems to me that you are requesting WFS data on Sentinel-2 L1C dataset and actual data on Sentinel-2 L2A dataset. Am I right?
This would explain your issue - in general L2A is available a couple of hours after L1C but sometimes it takes longer to appear.

You should in general do a meta-data search on the same dataset as you are then asking for data.
E.g. you should replace TYPENAMES=DSS2 and your issue will hopefully go away.
https://www.sentinel-hub.com/develop/api/ogc/standard-parameters/wfs/

I’d also recommend you check the new version of the Catalogue service:

Thank you for the suggestion, it was really L1C in the WFS request. I had not paid enough attention to “S2.TILE” part. I tried it with DSS2, and it works fine.

I perform the search in area of interest (bbox) using the WFS API. Does the Catalogue service provide more information about data inside the area compared to WFS?

The data included in one and another is somehow similar, but Catalogue API has much better ways to get these data out. E.g. if you just need dates in some area:

and similar

1 Like