Animate the NDVI derived from MODIS 16-Day Global 250-m through the year using Google Earth Engine.

Study Area

The Hindu Kush, also known in Ancient Greek as the Caucasus Indicus is an 500 miles stretch of mountain range that stretches through Afghanistan, Pakistan, India, Nepal, Bhutan, and Bangladesh. It forms the western section of the Hindu Kush Himalayan Region (HKH) and is the westernmost extension of the Pamir Mountains, the Karakoram, and the Himalayas. Geologically, the range is rooted in the formation of a subcontinent from a region of Gondwana that drifted away from East Africa about 160 million years ago, around the Middle Jurassic period. 

Study Area: Hindu Kush Mountainous Region.

MOD13Q1.006 Terra Vegetation Indices 16-Day Global 250m

For this work, the MOD13Q1.006 Terra Vegetation Indices 16-Day Global 250m was used. The NASA LP DAAC at the USGS EROS Center archives this product and can be downloaded from this website. This product provides a Vegetation Index (VI) value at a per pixel basis.

There are two primary vegetation layers.

The first is the Normalized Difference Vegetation Index (NDVI) which is referred to as the continuity index to the existing National Oceanic and Atmospheric Administration-Advanced Very High-Resolution Radiometer (NOAA-AVHRR) derived NDVI.

The NDVI is calculated from these individual measurements as follows:

NDVI= (NIR-Red) \ (NIR+Red)

The second vegetation layer is the Enhanced Vegetation Index (EVI) that minimizes canopy background variations and maintains sensitivity over dense vegetation conditions. The EVI also uses the blue band to remove residual atmosphere contamination caused by smoke and sub-pixel thin cloud clouds.

The MODIS NDVI and EVI products are computed from atmospherically corrected bi-directional surface reflectances that have been masked for water, clouds, heavy aerosols, and cloud shadows.

In this work, we will try to animate the NDVI derived from MOD13Q1.006 Terra Vegetation Indices 16-Day Global 250m for the year 2018-01-01 through 2018-12-31 at the Hindu Kush Mountain Region in the Google Earth Engine platform. This code stacks all the MODIS data through out the year, calculates the NDVI and animates them.

Here is the code:

// Simple ImageCollection preview via animated GIF.
var countries_name = ['Nepal', 'India', 'Afghanistan', 'Myanmar','Pakistan','Bhutan','Bangladesh'] 
var HKM_region = countries.filter(ee.Filter.inList('Country', countries_name));

// The region of interest (Hindu Kush Himalaya) 
var rect = ee.Geometry.Rectangle({
  coords: [[58, 6], [102, 38]],
  geodesic: false

Map.centerObject(rect, 3); // Zooms to the study area at level 3

// Select MODIS vegetation composites from 2018.
var collection = Modis.filterBounds(HKM_region)
  .filterDate('2018-01-01', '2019-01-01')

// Add the first image to the map, just as a preview.
var im = ee.Image(collection.first());
Map.addLayer(im, {}, "Preview Image");
Map.addLayer(rect, {}, "Zoom Level");

var image = ee.Image().toByte()
    //.paint(HKM_region, 'fill') // Get color from property named 'fill'
    .paint(HKM_region, 1, 2); // Outline using color 3, width 5.
Map.addLayer(image, {palette: ['FE230D', 'F9380F', 'F9380F', 'F9380F'], max: 0.5, opacity: 0.5,},"HKM Region");

// Visualization parameters.
var args = {
  crs: 'EPSG:3857',  // Maps Mercator
  dimensions: '600',
  region: rect,
  min: -2000,
  max: 10000,
  palette: 'black, blanchedalmond, green, green',
  framesPerSecond: 12,

// Create a video thumbnail and add it to the map.
var thumb = ui.Thumbnail({
  // Specifying a collection for "image" animates the sequence of images.
  image: collection,
  params: args,
  style: {
    position: 'bottom-right',
    width: '320px'

Final Output.

18 thoughts on “Animate the NDVI derived from MODIS 16-Day Global 250-m through the year using Google Earth Engine.”

  1. Thank you for sharing. I get an error “countries is not defined in the scope” likely to be from this line.
    Kindly assist
    var HKM_region = countries.filter(ee.Filter.inList(‘Country’, countries_name));

    1. Thanks for letting me know. Please try or click at “Here is the code”. This will bring you to GEE code editor and you should be able to run the code. If that doesn’t work, please let me know and I will fix it. Thanks!

  2. Pingback: Display Natural Color, Color Infrared (Vegetation), Healthy Vegetation, and Vegetation Analysis Maps in a Single Screen using Simple Codes in Google Earth Engine – Study Area (Ethiopia) – DINESH SHRESTHA

  3. Pingback: Add Legends and Title to your Map in GEE – DINESH SHRESTHA

  4. Pingback: Earth Engine App: Take your GEE expertise to next level. – DINESH SHRESTHA

  5. Pingback: Develop a Harmonic Model: Original vs Fitted NDVI values (Study Area: Thailand) – DINESH SHRESTHA

  6. Pingback: Using Hansen Global Forest Change Data to determine Forest Cover, Forest Gain, and Forest Loss (Study Area: Malaysia) – DINESH SHRESTHA

  7. Pingback: Make your map look Artistic – Add Grid Lines in your Map (Study Area: Canada) – DINESH SHRESTHA

  8. Pingback: Night Light Maps (Study Area: South Asia) – DINESH SHRESTHA

  9. Pingback: How to generate Histogram in Google Earth Engine? – DINESH SHRESTHA

  10. Pingback: Using 2001 MODIS Land Cover Type Yearly Global 500m Data to Determine the Land-Cover Analysis (Study Area: Mexico) – DINESH SHRESTHA

  11. Pingback: Learn How to Add two charts next to the map to interactively display a time-series of NDVI and reflectance for each click on the map? – DINESH SHRESTHA

  12. Pingback: Create a Chart to show Landsat 8 TOA Spectra at three points near Mumbai City – DINESH SHRESTHA

  13. Pingback: Learn how to calculate and export 90th Percentile Annual NDVI for years 1985-2019 using Landsat 8, 7, and 5 scenes (Study Area: Turkey) – DINESH SHRESTHA

  14. Pingback: Use 2018 Landsat 8 Scenes for Land Cover Classification in Google Earth Engine (Study Area: Dubai) – DINESH SHRESTHA

  15. Pingback: Land Cover Change Analysis between 1999 and 2018 in GEE (Study Area: Mumbai) – DINESH SHRESTHA

  16. Pingback: Time-lapse: Animate 30m Landsat images generated 90th percentile Annual NDVI from 1999 to 2018 (Study Area: South America) – DINESH SHRESTHA

  17. When I execute code, the following message is displayed on the console “Modis” is not defined in this scope.

Leave a Reply

%d bloggers like this: