I am attempting to calculate NDVI and GCI values during the 2019 growing season within districts in Mali. Specifically, I want to take the max of NDVI/GCI values for each pixel over the growing season for each district and then average all of these maximum values within each district to get a "mean of the max" for each district. I am using MODIS for NDVI values and LANDSAT for GCI. While I know the resolutions are different I am getting almost no correlation between the values for different districts, which seems odd given that the scholarly articles I've read say LANDSAT and MODIS are very similar. I know NDVI measures the fraction of red light reflected and GCI is more a measure of chlorophyll, but I would expect some correlation. Here is my code for each measure. Any explanation relating to coding errors, or the nature of NDVI and GCI?
NDVI
var districts = ee.FeatureCollection("users/geerootfold/gadm36_MLI_4")
.filter(ee.Filter.eq('NAME_0', 'Mali'))
var year = 2019
var modis = ee.ImageCollection('MODIS/006/MOD13Q1')
.filterDate('2019-05-01','2019-09-30')
.select('NDVI')
var mosaic = modis.max().divide(10000).clip(districts)
// Add reducer output to the Features in the collection.
var reducers = ee.Reducer.mean().combine({
reducer2: ee.Reducer.stdDev(),
sharedInputs: true
});
var featureCollection = mosaic.reduceRegions({
collection: districts,
reducer: reducers,
scale: 250,
});
print(featureCollection)
var size=featureCollection.size()
var toList = featureCollection.toList(size)
print(toList, 'toList')
var idList = ee.List.sequence(0, size.subtract(1))
var newList = idList.map(function(x){
var index = idList.get(x)
var feat = toList.get(x)
return ee.Feature(feat).set('year', 2019).copyProperties(feat)
})
print(newList, 'newList')
var MeansOfFeatures = ee.FeatureCollection(newList)
Export.table.toDrive({
collection: MeansOfFeatures,
description: 'meanOfMaxNdvi'+year,
folder: 'GEE NDVI2',
// Explicitly specify your columns to exclude .geo
fileFormat: 'CSV',
selectors: ['NAME_4', 'year', 'mean','stdDev']
})
var districts = ee.FeatureCollection("users/geerootfold/gadm36_MLI_4")
.filter(ee.Filter.eq('NAME_0', 'Mali'))
var colour = {
min: 0.0,
max: 1.0,
palette: [
'FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901',
'66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01',
'012E01', '011D01', '011301'
],
};
Map.addLayer(mosaic, colour, 'spatial mosaic')
GCI
var districts = ee.FeatureCollection("users/geerootfold/gadm36_MLI_4")
.filter(ee.Filter.eq('NAME_0', 'Mali'))
var year = 2019
// Add reducer output to the Features in the collection.
var reducers = ee.Reducer.mean().combine({
reducer2: ee.Reducer.stdDev(),
sharedInputs: true
});
var modis1 = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA')
.filterDate('2019-05-01','2019-09-30')
var modis = modis1.max().clip(districts)
print(modis)
var B5 = modis.select('B5')
var B3 = modis.select('B3')
var gci = function(modis){
var nir = modis.select('B5')
var green = modis.select('B3')
return nir.divide(green).subtract(1).rename('GCI')
}
// Add reducer output to the Features in the collection.
var modisGCI = gci(modis)
print('modisgci',modisGCI)
var reducers = ee.Reducer.mean().combine({
reducer2: ee.Reducer.stdDev(),
sharedInputs: true
});
print(modisGCI)
var featureCollection = modisGCI.reduceRegions({
collection: districts,
reducer: reducers,
scale: 30,
});
print(featureCollection)
var size=featureCollection.size()
var toList = featureCollection.toList(size)
print(toList, 'toList')
var idList = ee.List.sequence(0, size.subtract(1))
var newList = idList.map(function(x){
var index = idList.get(x)
var feat = toList.get(x)
return ee.Feature(feat).set('year', 2019).copyProperties(feat)
})
print(newList, 'newList')
var MeansOfFeatures = ee.FeatureCollection(newList)
Export.table.toDrive({
collection: MeansOfFeatures,
description: 'meanOfMaxGCI'+year,
folder: 'GEE GCI2',
// Explicitly specify your columns to exclude .geo
fileFormat: 'CSV',
selectors: ['NAME_4', 'year', 'mean','stdDev']
})
var districts = ee.FeatureCollection("users/geerootfold/gadm36_MLI_4")
.filter(ee.Filter.eq('NAME_0', 'Mali'))
var colour = {
min: 0.0,
max: 1.0,
palette: [
'FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901',
'66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01',
'012E01', '011D01', '011301'
],
};
Map.addLayer(modisGCI, colour, 'spatial mosaic')
// Add reducer output to the Features in the collection.
var reducers = ee.Reducer.mean().combine({
reducer2: ee.Reducer.stdDev(),
sharedInputs: true
});
Link to District Shapefile: https://code.earthengine.google.com/?asset=users/geerootfold/gadm36_MLI_4
Link to NDVI code: https://code.earthengine.google.com/6fc9b38ab45af9e8dafc9a993a455a9e
Link to GCI code: https://code.earthengine.google.com/605e5de51cd8df0cffd2027f3b227c6c