3

I am trying to create a composite image from an image collection (In this example Sentinel 2) where the pixel value for the resulting composite is the lower or upper quartiles of the pixel value distribution.

Its easy to get the mean, median, maximum and minimum pixel values but I don't know how to make a composite of lower quartile values.

// In this code I created a collection where all the clouds had been removed
// I then mapped the NDVI values to the entire Collection.
// I want to create a composite image of the lower quartile NDVI values

var withNDVI = col_noclouds.map(addNDVI);

// Get the max, min and median values in each band.
var maximum = withNDVI.max();
var minimum = withNDVI.min();
var median = withNDVI.median();


// Display the composite.
Map.addLayer(maximum, ndviParams_Col, 'maximum_NDVI');
Map.addLayer(median, ndviParams_Col, 'median_NDVI');
Map.addLayer(minimum, ndviParams_Col, 'minimum_NDVI');

If anyone can suggest a way to create a composite of lower quartile pixel values that would be very useful.

2
  • You have quite a few undefined variables and functions in your code example. For example: col_noclouds, addNDVI, ndviParams_Col. You are more likely to get help if you provide a complete example. Dec 16, 2017 at 23:47
  • Thanks Tyler. I didnt post the whole thing as its very long and involved :) Dec 18, 2017 at 5:49

1 Answer 1

2

You can use ee.ImageCollection.reduce() and ee.Reducer.percentile() to create a lower quartile composite. For example:

Map.addLayer(
  withNDVI.reduce(ee.Reducer.percentile([25])),
  {bands:'NDVI_p25', min:-1, max:1},
  '25 percentile NDVI'
);
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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