0

I am attempting to calculate the Green Chlorophyll Index across districts in Mali during the growing season(5/1-10/1) for the years2010 to 2019. I use Landsat 8 Surface Reflectance data for 2013-2019(since LANDSAT 8 began in 2013) and I use LANDSAT 7 for 2010 to 2012.

The problem is that in 2010, and to a lesser extent in 2011 and 2012, there seem to be major gaps in satellite coverage. You can see that in the 2010 GEE image, there is no data for wide swaths of the country during the growing season between 5/1/2010 and 10/1/2010. When I expand the date bounds to the entire year I have data for the entire map. This is strange since LandSat 7 had a 16 day repeat cycle, so I should have several images from during the growing season, which is the period for which I need data. How can I go about fixing this issue? I am using code graciously given by Daniel Wiell. Here is a link to the code: https://code.earthengine.google.com/3947435b3d378aa984dad0acdf44dffd

var districts = ee.FeatureCollection("users/geerootfold/gadm36_MLI_4")
  .filter(ee.Filter.eq('NAME_0', 'Mali'))
  .select(['NAME_4'], ['region']) // Rename the property you're interested to something cleaner

Map.centerObject(districts)
Growing Season (5/1-10/1) Image
[![enter image description here][1]][1]
Near Full Year (1/1-12/1) Image 
[![enter image description here][1]][1]

var years = sequence(2010,2010)
years.map(process)

function process(year) {
  var start = ee.Date.fromYMD(year, 5, 1)
  var end = ee.Date.fromYMD(year, 10, 1) // end is exclusive

  var maxGci = ee.ImageCollection("LANDSAT/LE07/C02/T1_L2")
    .filterDate(start, end)
    .filterBounds(districts)
    .map(function (image) {
      var normalized = image
        .multiply(0.0000275).subtract(0.2)
      var cloudFree = bitwiseExtract(image.select('QA_PIXEL'), 1, 6).eq(0)
      return ee.Image()
        .expression('nir / green - 1', {
          green: normalized.select('SR_B2'),
          nir: normalized.select('SR_B4')
        })
        //.updateMask(cloudFree)
        .rename('GCI')
    })
    .max()
    .clip(districts)
  
  var meanOfMaxGci = maxGci
    .reduceRegions({
      collection: districts,
      reducer: ee.Reducer.mean().combine({
        reducer2: ee.Reducer.stdDev(),
        sharedInputs: true
      }),
      scale: 1000
    })
    .map(function (feature) {
      return feature
        .set('year', year)
    })
  
  print(meanOfMaxGci)
  
  Export.table.toDrive({
    collection: meanOfMaxGci,
    description: 'meanOfMaxGCI' + year,
    folder: 'GEE GCI3',
    // Explicitly specify your columns to exclude .geo
    fileFormat: 'CSV',
    selectors: ['region', 'year', 'mean', 'stdDev']
  })
  
  
  var visParams = {
    min: 0,
    max: 6,
    palette: [
      'FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901',
      '66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01',
      '012E01', '011D01', '011301'
    ],
  }
  Map.addLayer(maxGci, visParams, 'max GCI ' + year)    
}


function bitwiseExtract(value, fromBit, toBit) {
  if (toBit === undefined)
    toBit = fromBit
  var maskSize = ee.Number(1).add(toBit).subtract(fromBit)
  var mask = ee.Number(1).leftShift(maskSize).subtract(1)
  return value.rightShift(fromBit).bitwiseAnd(mask)
}


function sequence(start, end) {
    return Array
      .apply(null, Array(end - start + 1))
      .map(function (_, i) {
        return i + start
      })
  }
  
  

1 Answer 1

1

This looks more likely to be due to different dates for the satellite coverage, especially if you are pulling images from different times of the year...

1
  • I have adjusted my question to focus on the missing spaces during significant parts of the 2010 images. This is really the primary issue I am dealing with.
    – Matt
    May 23, 2023 at 21:44

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.