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

UDM2 Mask Classification, PlanetScope

//VERSION=3
//UDM2 Classification

function setup() {
  return {
    input: [{
      bands: [
        "clear",
        "snow",
        "shadow",
        "haze_light",
        "haze_heavy",
        "cloud"
      ]
    }],
    output: {
      bands: 4
    }
  }
}

function evaluatePixel(samples) {
  if (samples.snow == 1) {
    return [0, 0.5, 1, 1] // blue
  }
  if (samples.shadow == 1) {
    return [0.4, 0.4, 0.4, 1] //grey
  }
  if (samples.haze_light == 1) {
    return [0, 0.9, 1, 1] //sky blue 
  }
  if (samples.haze_heavy == 1) {
    return [1, 0.7, 1, 1] //light pink
  }
  if (samples.cloud == 1) {
    return [0.7, 0.7, 0.7, 1] //white
  }
  else {
    return [0, 0, 0, 0]
  }
}

Evaluate and visualize

As PlanetScope is commercial data, brought into Sentinel Hub as Bring Your Own Data, direct EO Browser links are not possible due to the personalized data credentials.

General description

PlanetScope has several usable data mask (UDM2) bands. The clear band gives information on whether the pixel is clear, meaning that the surface is clearly visible. If it’s not clear, that means it’s classified as either shadow, snow, light haze, heavy haze or cloud. Each of these is a separate UDM2 mask band:

  • snow
  • shadow
  • haze_light
  • haze_heavy
  • cloud

When the mask band == 1, the pixel belongs to the mask (for example, when snow == 1, the pixel was recognized as snow). The bands are mutually exclusive - if a pixel belongs to one mask class, it cannot belong to any other.

In the script, each of the UDM2 mask bands is classified with a unique color, and the pixels that do not belong to any class, are returned transparent.

Color legend

Mask HTLM color code Color
Snow #0080FF
Shadow #666666
Light haze #00E6FF
Heavy haze #FFB3FF
Cloud #B3B3B3

Description of representative images

Several mask classes over Austria, acquired on 2021-03-23.

Masks

References