0

I read the scaling documentation for Google Earth Engine, but I didn't understand, so I need to make an example. I have two collections: one at 4 km resolution (MODIS) and one at 10 meters resolution (Sentinel). I want compare two bands, say the NDVI. My point is I don't want to compare a 10 meters pixel with a 4 km pixel, but I want to have enough pixels from Sentinel to cover the same area of MODIS and maybe use a ee.Reducer.Mean() to get a single value. Does this code do what I want?

point=ee.geometry.Point(11.05,37.58)

var chart_sentinel=ui.Chart.image.series({
    imageCollection: sentinel_ndvi,
    region: ee.Feature(point).geometry(),
    reducer:ee.Reducer.mean(),
    scale:4000
    });

print(chart_sentinel)
var chart=ui.Chart.image.series({
    imageCollection: modis_ndvi,
    region: ee.Feature(point).geometry(),
    reducer:ee.Reducer.mean(),
    scale:1
    });

Am I actually comparing approximately the same area?

2
  • NDVI isn't a band. Did you mean near infrared (NIR)?
    – Vince
    Commented Mar 14, 2021 at 18:00
  • @Vince I know it isn't, I didn't post the full code. I created a NDVI for each pixel and added as a new band, both for modis and sentinel. Then I only selected NDVI, so each collection has only a band stored called "NDVI". I want to plot the NDVI in a time series, I just want to understand what happens if I put scale 4000 for sentinel collection where NDVI has a 10 meters resolution and if I put scale 1 for modis collection. The geometry is the same point for both charts. The reducer is the mean. Commented Mar 14, 2021 at 18:50

1 Answer 1

1

You're probably best off using the same scale for both charts. Pick the largest scale you have - MODIS. EE will use its image pyramids to get pixel values at the specified scale. So, the Sentinel values charted will be aggregates of 10 m pixels, and will be comperable to the charted MODIS values.

var point = ee.Geometry.Point([37.58, 11.05])

Map.setOptions('HYBRID')
Map.centerObject(point, 12)
Map.addLayer(point)

var modis = ee.ImageCollection('MODIS/006/MOD13A1')
  .filterBounds(point)
  .select('NDVI')
  
var s2 = ee.ImageCollection('COPERNICUS/S2')
  .filterBounds(point)
  .map(function (image) {
    return image
      .normalizedDifference(['B8', 'B4'])
      .multiply(10000) // Match MODIS scale (where NDVI has been multiplied by 10,000)
      .int16()
      .updateMask(image.select('QA60'))
      .rename('NDVI')
      .copyProperties(image, image.propertyNames())
  })

var modisChart = ui.Chart.image.series({
  imageCollection: modis, 
  region: point, 
  reducer: ee.Reducer.mean(), 
  scale: 500 // The MODIS image collection has a 500m scale
})
print(modisChart)

var s2Chart = ui.Chart.image.series({
  imageCollection: s2, 
  region: point, 
  reducer: ee.Reducer.mean(), 
  scale: 500 // Use same scale as MODIS imagery
})
print(s2Chart)

https://code.earthengine.google.com/80b2274c229ed030c0a644b2516c6240

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.