2

I'm new to GEE. I'm working on EVI data analysis. So this is my code for MODIS evi. I want to know how to multiply all the images there inside ImageCollection by scale factor 0.0001 to get real EVI values. Because my values are -2000, 10000

How do I get this work done?

var clipper = function(image){
  return image.clip(sureste);
};


Map.addLayer(sureste);
print(sureste);

var modis = ee.ImageCollection('MODIS/006/MOD13Q1')
  .map(clipper);
var months = ee.List.sequence(1,12);

// Group by month, and then reduce within groups by mean();
// the result is an ImageCollection with one image for each
// month.

var byMonth = ee.ImageCollection.fromImages(
      months.map(function(m) {
        return modis.filter(ee.Filter.calendarRange(m, m, 'month'))
                    .filterBounds(sureste)  
                    .select('EVI').mean().multiply()
                    .set('month', m);
}));

print("Monthly images",byMonth);
0

1 Answer 1

2

Following script, with arbitrary geometry sureste, prints values of EVI in Inspector Tab multiplied by 0.0001.

var sureste = 
    /* color: #d63000 */
    /* displayProperties: [
      {
        "type": "rectangle"
      }
    ] */
    ee.Geometry.Polygon(
        [[[-101.8302490234375, 22.848114623774645],
          [-101.8302490234375, 22.376523536444807],
          [-100.7755615234375, 22.376523536444807],
          [-100.7755615234375, 22.848114623774645]]], null, false);
var clipper = function(image){
  return image.clip(sureste);
};

var clipper = function(image){
  return image.clip(sureste);
};

Map.centerObject(sureste);
print(sureste);


var modis = ee.ImageCollection('MODIS/006/MOD13Q1')
  .map(clipper);
var months = ee.List.sequence(1,12);


// Group by month, and then reduce within groups by mean();
// the result is an ImageCollection with one image for each
// month.

var byMonth = ee.ImageCollection.fromImages(
      months.map(function(m) {
        return modis.filter(ee.Filter.calendarRange(m, m, 'month'))
                    .filterBounds(sureste)  
                    .select('EVI').mean().multiply(0.0001)
                    .set('month', m);
}));

var vis = {min: 0.0926025, max: 0.2744175, palette: [
    'FFFFFF', 'CE7E45', 'FCD163', '66A000', '207401',
    '056201', '004C00', '023B01', '012E01', '011301'
]};

print("Monthly images",byMonth);
Map.addLayer(byMonth, vis, "MODIS"); 

After running script in GEE, it can be observed in following image:

enter image description here

4
  • xunilk, Thank you very much for your help, it works well. Mar 20, 2020 at 23:03
  • You're welcome. If you think this question was answered as expected please mark as accepted.
    – xunilk
    Mar 20, 2020 at 23:42
  • code.earthengine.google.com/fa6a7b02bf345fe75f02cedc624ab0cf, mi script no working well, because I want to get the following results 1. Obtains an average EVI value for each month of the year from 2000 to 2019. In other words, a single EVI raster for Jan, a single EVI raster for Feb, 2 Average EVI for the months of the year 2000 to 2019, that is. If Jan has two MODIS EVI images, it takes the average of the images for Jan and exports one image for Jan 2000, 2001, etc. But it doesn't actually change the EVI result for both option 1 and 2 ¿what my mistake is? Mar 26, 2020 at 21:46
  • Hi, Carolina, This is another question. You should post it in this site. Thanks.
    – xunilk
    Mar 26, 2020 at 23:54

Your Answer

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

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