How to get S2A scene classification for Sentinel-2?

Home > Faq > How to get S2A scene classification for Sentinel-2?

You can get information from scene classification layer produced by Sen2Cor, for data where S2A is available. Data can be retrieved by identifier “SCL” (e.g. instead of return [B02]; for blue color one can use return [SCL/10];).
Data can be then used for e.g. validation of the pixel value, e.g. along the lines:

var scl = SCL;
if (scl == 0) { // No Data
  return [0, 0, 0]; // black
} else if (scl == 1) { // Saturated / Defective
  return [1, 0, 0.016]; // red
} else if (scl == 2) { // Dark Area Pixels
  return [0.525, 0.525, 0.525]; // gray
} else if (scl == 3) { // Cloud Shadows
  return [0.467, 0.298, 0.043]; // brown
} else if (scl == 4) { // Vegetation
  return [0.063, 0.827, 0.176]; // green
} else if (scl == 5) { // Bare Soils
  return [1, 1, 0.325]; // yellow
} else if (scl == 6) { // Water
  return [0, 0, 1]; // blue
} else if (scl == 7) { // Clouds low probability / Unclassified
  return [0.506, 0.506, 0.506]; // medium gray
} else if (scl == 8) { // Clouds medium probability
  return [0.753, 0.753, 0.753]; // light gray
} else if (scl == 9) { // Clouds high probability
  return [0.949, 0.949, 0.949]; // very light gray
} else if (scl == 10) { // Cirrus
  return [0.733, 0.773, 0.925]; // light blue/purple
} else if (scl == 11) { // Snow / Ice
  return [0.325, 1, 0.980]; // cyan
} else { // should never happen
  return [0,0,0];
}

Please note that it makes sense to use this layer only on full resolution as any interpolation based on classification codelist will not produce reasonable results. You should also use NEAREST upsampling/downsampling setting, which you can find in "Advanced layer editor" .

Also please note that this map does not constitute a land cover classification map in a strict sense, its main purpose is to be used internally in Sen2Cor in the atmospheric correction module to distinguish between cloudy pixels, clear pixels and water pixels.

An example:

Blinnenhorn, Switzerland (Sentinel-2 L2A, SCL, acquired with EO Browser on October 14, 2017)

Blinnenhorn, Switzerland (Sentinel-2 L2A, true color, acquired with EO Browser on October 14, 2017)

This is a prototype feature and can change in the future releases.