At the moment I am struggling with a time series and the extraction of MODIS LAI data. I am using the band "Lai" from MODIS/006/MCD15A3H. My study area is small, so presumably, since the pixeldata from MODIS Lai has a 500x500 spatial resolution, I only have one pixel to extract with respect to the time series of it (all 3 days one Lai value for my geometry).

I already have a similar code to extract the NDVI for my studyarea that workds, however, I don't get how to do it with the LAI data from MODIS. Below is my code for the LAI data. It works to display it in the chart, however it seems that the scale is off, since Lai values are not higher than 8 as far as I am aware of. (NDVI would be -1 to 1) (Lai is 0 to 8ish). But in my scale it has values beyond that (up to 60), exceeding the usual range it should be displayed. I am not sure what part of the code could solve the problem.

Besides that, if I filter cloud cover (which would also smooth the line chart), there seems to be no data left. Is there a chance to filter cloud cover (for a smoother line), but still getting results?

var geometry = /* color: #d63000 */ee.Geometry.Polygon(
        [[[16.62138331919588, 48.21312568441956],
          [16.619409213360917, 48.20875013496642],
          [16.620696673688066, 48.2084927380614],
          [16.623915324505937, 48.20803514036929],
          [16.624644885357988, 48.209522317919415],
          [16.624215731915605, 48.20995130341788],
          [16.624988208111894, 48.21135263100322]]]);

//draw polygon of area interested on map//draw polygon of area interested on map
var polygon = ee.Geometry.Polygon

// which dataset + where + when
var imageCollection = ee.ImageCollection("MODIS/006/MCD15A3H")
                //.filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 20));

//print collection

//zoom to geometry
Map.centerObject(geometry, 10);

// Create palettes for display of Lai
var Lai_pal = ['e1e4b4', '999d60', '2ec409', '0a4b06'];
var Lai = imageCollection.select(['Lai']);
var Laimed = Lai.mean(); 

// Create a time series chart.
var plotLai = ui.Chart.image.seriesByRegion(imageCollection, geometry,ee.Reducer.mean(),
'Lai',0.1,'system:time_start', 'system:index')
                title: 'Lai time series',
                hAxis: {title: 'Date'},
                vAxis: {title: 'Lai'}

// Display of lai values, however it seems like it doesn't do anyting afterall to display on the map

Map.addLayer(plotLai.clip(geometry), {min:0.0, max:100.0, palette: Lai_pal}, 'Lai');

The LAI values in MODIS are saved as an integer with a scaling factor. In this case the scaling factor is 0.1

This means, that to get the true LAI value you need to apply the scaling factor to the value. So for a value of 63, the LAI would be 6.3.

Your cloud filtering doesn't work because CLOUDY_PIXEL_PERCENTAGE doesn't exist for the MODIS product you chose. Instead there are Quality Control Bits which offer information about the pixels. I would suggest you always take a look at the dataset page to get an overview over the dataset. Here's the one for MODIS_006_MCD15A3H.

Masking using QA bits is a bit more involved, here I'm using Code by Daniell Wiell from this answer.

// which dataset + where + when
var imageCollection = ee.ImageCollection("MODIS/006/MCD15A3H")

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)

var masked = imageCollection.map(function(image){
  var qa = image.select('FparLai_QC')
  var good = bitwiseExtract(qa, 0) // returns 0 for good quality
  return image.updateMask(good.not())  // needs to be inverted to mask pixels with bad quality

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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