Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Global Water Bodies Occurrence visualisation script

//VERSION=3

// this script visualizes water bodies occurence derived from Quality layer (QUAL)

// set up input and output settings
function setup() {
  return {
    input: ["QUAL", "dataMask"],
    output: {
      bands: 4,
      sampleType: "AUTO"
    }
  }
}

// create a visualizer
const map = [
  [71, 0xff0000], // Very low occurrence  // red
  [72, 0x8e35ef], // Low occurrence       // Purple
  [73, 0xa6a6e6], // Medium occurrence    // Magenta
  [74, 0x00ffff], // High occurrence      // cyan
  [74, 0x3bb9ff], // Very high occurrence  // deep sky blue
  [76, 0x0032c8]  //Permanent occurrence   //blue
];

const visualizer = new ColorMapVisualizer(map);

//  evaluatePixel function
function evaluatePixel(sample) {
  let rgbVis = visualizer.process(sample.QUAL);
  return rgbVis.concat(sample.dataMask);
}

General description of the script

This script visualizes Water Bodies Occurence derived from Quality layer (QUAL) in the Water Bodies data.The occurrence values rank from low occurrence to permanent occurrence. The Water Bodies Occurrence values and color legend are shown in the table below:

Table 1: Color legend for the Water Bodies Occurrence

Value Color Label
71 Very low Occurrence
72 Low Occurrence
73 Medium Occurrence
74 High Occurrence
75 Very high Occurrence
76 Permanent Occurrence
251 No data

Description of representative images

December 2020 water bodies occurrence on Iran’s second largest salt lake Bakhtegan and lake Tashk visualised in EO browser

Water occurrence map lake Bakhtegan and Tashk, Iran

Resources