Normalized difference vegetation index, PlanetScope

//PlanetScope NDVI
let ndvi = index(nir, red);

return colorBlend(
    ndvi,
    [0.0, 0.5, 1.0],
    [
        [1, 0, 0],
        [1, 1, 0],
        [0.1, 0.31, 0],
    ]
);
//VERSION=3
//PlanetScope NDVI EO Browser

function setup() {
    return {
        input: [
            {
                bands: ["red", "nir", "dataMask", "clear"],
            },
        ],
        output: [
            { id: "default", bands: 4 },
            { id: "index", bands: 1, sampleType: "FLOAT32" },
            { id: "eobrowserStats", bands: 2, sampleType: "FLOAT32" },
            { id: "dataMask", bands: 1 },
        ],
    };
}

function evaluatePixel(sample) {
    let ndvi = index(sample.nir, sample.red);
    const clear = sample.dataMask && sample.clear;

    let ndvi_colored = colorBlend(
        ndvi,
        [0.0, 0.5, 1.0],
        [
            [1, 0, 0],
            [1, 1, 0],
            [0.1, 0.31, 0],
        ]
    );

    return {
        default: [...ndvi_colored, clear],
        index: [ndvi],
        eobrowserStats: [ndvi, +!clear],
        dataMask: [sample.dataMask],
    };
}

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

The well known and widely used NDVI is a simple, but effective index for quantifying green vegetation. It normalizes green leaf scattering in Near Infra-red wavelengths with chlorophyll absorption in red wavelengths.

The value range of the NDVI is -1 to 1. Negative values of NDVI (values approaching -1) correspond to water. Values close to zero (-0.1 to 0.1) generally correspond to barren areas of rock, sand, or snow. Low, positive values represent shrub and grassland (approximately 0.2 to 0.4), while high values indicate temperate and tropical rainforests (values approaching 1). It is a good proxy for live green vegetation; see [1] for details.

The normalized difference vegetation index, abbreviated NDVI, is defined as

\[NDVI := \mathtt{Index}(nir,red) = \frac{nir-red}{nir+red}.\]

This is an example script which can be used with EO Browser and is configured to return statistics in a format which can be used with the statistical info chart. For more information, see How Can I Configure My Layers For Statistical Information In EO Browser?

Representative images

NDVI of agriculture fields in Iowa.

References

[1] Wikipedia, Normalized Difference Vegetation Index. Accessed on October 4th 2017.