1

I want to get 1990 NDVI from Landsat5,and remove the cloud cover, so I used the code:

var addNDVI = function(image) {
  var ndvi = image.normalizedDifference(['B4', 'B3']).rename('NDVI');
  return image.addBands(ndvi);
};

var addFmask = function(image) {
  var datamask = image.select('fmask');
  var cloudMask = datamask.neq(1).and(datamask.neq(2)).and(datamask.neq(3)).and(datamask.neq(4));
  return image.updateMask(cloudMask);
};

var collection2 = ee.ImageCollection('LANDSAT/LT5_L1T_TOA_FMASK')
    .filterBounds(alb)
    .filterDate('1991-01-01', '1991-12-31')
    .select(['B3', 'B4', 'fmask'])
    .map(addFmask)
    .map(addNDVI).select('NDVI');

When I run this code, I got the error as below:

Error generating chart: ImageCollection.load: Use LANDSAT/LT05/C01/T1_SR instead of LANDSAT/LT5_L1T_TOA_FMASK

So, I'm wonder if there are any question to use Fmask algorithm in the Landsat5 or I need to make some correction?

1

The LANDSAT/LT5_L1T_TOA_FMASK dataset has been deprecated in favor of Collection 1 datasets for Landsat 5, which use the format LANDSAT/LT05/C01/*. This change follows the USGS' Landsat Collections reorganization that occurred in 2016.

Collection 1 images include QA bands that provide cloud and shadow information, similar to the older *_TOA_FMASK images. For example, the USGS Landsat 5 Surface Reflectance Tier 1 (LANDSAT/LT05/C01/T1_SR) has a sr_cloud_qa band. You will need to update your code to use the new band names and modify the masking logic.

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.