CNES land cover classifier confidence visualisation script

//VERSION=3

// This script visualise the confidence of classifier

// Set up input and output settings
function setup() {
    return {
      input: [{
        bands: [
          "OCS_Confidence"
        ]
      }],
      output: {
        bands: 4
      }
    }
  }
  
  // Create color map
  const ramps = [
    [1, 0x000000],
    [100, 0x00c800 ],
  ];
  
  // Create visualiser
  const visualizer = new ColorRampVisualizer(ramps);
  
  
  //EvaluatePixel function
  function evaluatePixel(samples) {
    let val = samples.OCS_Confidence;
    let rgb_triplet = visualizer.process(val);
    if (val == 0 || val > 100) {
        rgb_triplet.push(0) // Masked data out of range
    } else {
        rgb_triplet.push(1) // Display visualiser for data within a valid range of confidence
    }
    return rgb_triplet;
  }

General description of the script

The script visualises the information on the classifier confidence with values ranging from 1 to 100.

Table 1: Color legend for CNES land cover classifier confidence

Value Color Color Code Label
1 #000000 1% confidence
100 #00c800 100% confidence

Description of representative images

The overview of CNES Land Cover classifier confidence 2020 for France visualised in EO Browser

CNES land cover classifier confidence France overview

CNES Land Cover classifier confidence 2020 around Lyon visualised in EO Browser

CNES land cover classifier confidence Lyon

Resources