WCS GetCoverage sometimes returns black images


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


  1. GetFeature request


  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.

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