Add properties and filter

Evaluate a statement, add the results as a property to the image and use this property to filter.

Use the script below or follow this link.

 

// filter the date
var NDVI = gimms.filterDate(‘1981-01-01’, ‘1990-12-31’).sort(‘system:time_start’, false).select(“ndvi”);

// funtion to calculate mean for each image
var calcMean = function(img){

var mean = img.reduceRegion({
reducer:ee.Reducer.mean(),
geometry: roi,
scale:500
});

return img.set("mean_value",mean.get('ndvi'));
};

// add mean to properties
var NDVImean = NDVI.map(calcMean);

// print the image collection
print(NDVImean);

// filter based on NDVI mean
var NDVImeanSelect = NDVImean.filter(ee.Filter.gt("mean_value",0.29));

// print selection
print(NDVImeanSelect);

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s