1

Need to combine two image NDVI collections (MOD13Q1 and MYD13Q1) in Google Earth Engine but don't know how to proceed.

My proposed workflow is to combine the two NDVI products from two collections to create a multi-temporal dataset. Then, from there will create a stacked image (image layer stacking) composed of NDVI images from the combined dataset, which will be later used for classification.

var region = ee.Geometry.Rectangle(xxlon, xxlat, xxlon, xxlat);
var roi = region;

// Load MODIS MOD13Q1 dataset.
var MOD13Q1_fullCollection = ee.ImageCollection('MODIS/MOD13Q1').select('NDVI');
var MOD13Q1_dateFilter = MOD13Q1_fullCollection.filterDate('2015-01-01','2017-12-31');
var MOD13Q1 = MOD13Q1_date.filterBounds(roi);
print (MOD13Q1);

// Load MODIS MOD13Q1 dataset.
var MYD13Q1_fullCollection = ee.ImageCollection('MODIS/MYD13Q1').select('NDVI');
var MYD13Q1_date = MYD13Q1_fullCollection.filterDate('2015-01-01','2017-12-31');
var MYD13Q1 = MYD13Q1_date.filterBounds(roi);
print (MYD13Q1);

var stackCollection = function(collection){
                      var first = ee.Image(collection.first()).select([]);
                      var appendbands = function(image, previous){
                      return ee.Image(previous).addBands(image.reproject('EPSG:4326',null,232));
                          };
                    return ee.Image(collection.iterate(appendbands,first));
    };

var stacked = stackCollection(supposed_to_be_the_combined_NDVI_from_two_collections);
  • 1
    what do you mean by combine? do you need all images in one collection, or you want one collection in which each images has 2 bands, ndvi_MOD13Q1 and ndvi_MYD13Q1? – Rodrigo E. Principe Feb 27 '18 at 12:30
5

My guess is you are trying to combine the two 16-day composites into a synthethic 8-day composite containing data from both Aqua and Terra (as has been proposed in many research papers).

You can do this by simply merging both collections and then sorting according to the central acquisition date.

https://code.earthengine.google.com/84430216d1ce67eeeb7f067dd6db581e

// Load MODIS MOD13Q1 dataset.
var MOD13Q1 = ee.ImageCollection('MODIS/MOD13Q1')
  .select('NDVI')
  .filterDate('2015-01-01','2017-12-31')
  .filterBounds(roi)
print(MOD13Q1);

// Load MODIS MYD13Q1 dataset.
var MYD13Q1 = ee.ImageCollection('MODIS/MYD13Q1')
  .select('NDVI')
  .filterDate('2015-01-01','2017-12-31')
  .filterBounds(roi)
print(MYD13Q1);

// merge collections
var MOD_merged = MOD13Q1.merge(MYD13Q1)
print(MOD_merged)

// sort by date
var MOD_merge_sorted = MOD_merged.sort("system:time_start")
print(MOD_merge_sorted)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.