Calculate the Net Primary Production for every 8 days.

There are two MODIS product available, with information on NPP, which is the Net Primary Productivity (net flux of carbon from the atmosphere into green plants per unit time) and GPP (gross primary production; npp + cellular respiration).

NPP is available for every year, the GPP for every 8 days.

Since we are mostly interested in the Net Primary Productivity, we use the GPP to calculate the NPP for every 8 days using the formula below:

NPP8 = (GPP8 / GPPy) x NPP y

step 1: Import the (1) MOD17A3H.006: Net Primary Production Yearly L4 Global 500 m and (2) MYD17A2H.006: Gross Primary Productivity 8-Day L4 Global 500 m into the GEE.


Step 2: Add the countries of interest to your script:

// Define country names
var country_names = ['Laos','Vietnam','Cambodia'];
// import the country feasture collection
var countries = ee.FeatureCollection('ft:1tdSwUL7MVpOauSgRzqVTOwdfy17KDbw-1d9omPw')
// find the countries in the country list
var myCountries = countries.filter(ee.Filter.inList('Country', country_names));
// Get the geometry of the countries
var myRegion = myCountries.geometry();

// set location and zoom level

// add the layer
Map.addLayer(myRegion,false,"my region");

Step 3: filter for period and region of interest.

// Define period
var startdate = ee.Date.fromYMD(2010,1,1);
var enddate = ee.Date.fromYMD(2015,12,31);

// filter npp
var nppCollection = npp.filterDate(startdate, enddate)
// filter gpp
var gppCollection = gpp.filterDate(startdate, enddate)

Step 4:

// calculate the npp8
var myNpp = function(myimg){
     // get date
     var d = ee.Date(myimg.get('system:time_start'))
     // get year
     var y = d.get('year').toInt();

     // filter for year for GPP and NPP
     var GPPy = ee.Image(gppCollection.filter(ee.Filter.calendarRange(y, y, 'year')).sum());
     var NPPy = ee.Image(nppCollection.filter(ee.Filter.calendarRange(y, y, 'year')).mean());
     var npp8 = myimg.expression('(GGP8 / GPPy) * NPPy',
        GGP8: myimg,
        GPPy: GPPy,
        NPPy: NPPy

  return npp8.copyProperties(myimg,['system:time_start'])

var npp8Collection = ee.ImageCollection(;

// create vizualtion settings
var npp_viz = {min:0.0, max:300, palette:"ff0000,f0ff00,004717"};

// add the image

Find and example here.