Cloud Mask Classification, Analysis Ready Planetscope

//VERSION=3

function setup() {
    return {
        input: ["cloud_mask"],
        output: {
            bands: 4
        }
    }
}

const map = [
    [2, [0.5, 0.5, 0.8]],  //bright cloud in purple
    [3, [0.4, 0.4, 0.4]],  //cloud shadows in grey
    [4, [0, 0.9, 1]],      //haze in sky blue
    [5, [1, 0.7, 1]],      //adjacent clouds/cloud shadows in light pink
    [6, [0.7, 0.7, 0.7]],  //additional haze or cloud elements in white
    [7, [0, 0.5, 0.5]]     //contamination including snow in green
]
const visualizer = new ColorMapVisualizer(map);


function evaluatePixel(sample) {
    const dataMask =  nodatavalue == -999 ? 0 : 1
    imgVals = visualizer.process(sample.cloud_mask)
    return imgVals.concat(dataMask)
}
//VERSION=3

function setup() {
    return {
        input: ["cloud_mask"],
        output: {
            bands: 4
        }
    }
}

function evaluatePixel(sample) {
    return [sample.cloud_mask];
}

Evaluate and Visualize

The example data is using Planet Sandox data. This data is restricted to Sentinel Hub users with active paid plans. If you are already a Planet Customer, see here on how to get access.

General description

Analysis-Ready PlanetScope has several classifications within QA Band 1, “Cloud and shadow mask”. A value of 1 is clear, meaning that the surface is clearly visible. If it’s not clear, that means it’s classified as having some other type of contamination. In the script, each of the non-clear pixels in QA Band 1 are classified with a unique color, and the pixels that are clear are returned transparent.

Description of representative image

A visualization of different classes of clouds for Bordeaux, France (April 2023)

Cloud Mask Classification of Bordeaux