Sentinel-2 L2A Scene Classification Map

//VERSION=3
function setup() {
  return {
    input: ["SCL", "dataMask"],
    output: { bands: 4, sampleType: "UINT8" }
  };
}

const classes = {
  0: [0, 0, 0], // No Data (Missing data) - black  
  1: [255, 0, 0], // Saturated or defective pixel - red 
  2: [47, 47, 47], // Topographic casted shadows ("Dark features/Shadows" for data before 2022-01-25) - very dark grey
  3: [100, 50, 0], // Cloud shadows - dark brown
  4: [0, 160, 0], // Vegetation - green
  5: [255, 230, 90], // Not-vegetated - dark yellow
  6: [0, 0, 255], // Water (dark and bright) - blue
  7: [128, 128, 128], // Unclassified - dark grey
  8: [192, 192, 192], // Cloud medium probability - grey
  9: [255, 255, 255], // Cloud high probability - white
  10: [100, 200, 255], // Thin cirrus - very bright blue
  11: [255, 150, 255], // Snow or ice - very bright pink
}

function evaluatePixel(samples) {
  // return black if key not available
  let imgVals = classes[samples.SCL] || [0, 0, 0];
  return imgVals.concat(samples.dataMask * 255);
}

Evaluate and Visualize

General description

Scene classification was developed to distinguish between cloudy pixels, clear pixels and water pixels of Sentinel-2 data and is a result of the Scene classification algorithm run by ESA. Twelve different classifications are provided including classes of clouds, vegetation, soils/desert, water and snow. It does not constitute a land cover classification map in a strict sense.

Description of representative images

Scene Classification of Rome.

Scene classification of Rome

Color legend

Value Scene Classification HTLM color code Color
0 No Data (Missing data) #000000
1 Saturated or defective pixel #ff0000
2 Topographic casted shadows (called "Dark features/Shadows" for data before 2022-01-25) #2f2f2f
3 Cloud shadows #643200
4 Vegetation #00a000
5 Not-vegetated #ffe65a
6 Water #0000ff
7 Unclassified #808080
8 Cloud medium probability #c0c0c0
9 Cloud high probability #ffffff
10 Thin cirrus #64c8ff
11 Snow or ice #ff96ff

References