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