0

I'm trying to find the most recent possible NDVI data from Google Earth Engine. This is the code I'm using:

// Coordinates for East Pine
var Cent = ee.Geometry.Point([-121.187547,55.689782]);

// Center Map on East Pine
Map.centerObject(Cent, 10);

// Import the Landsat 8 TOA image collection.
// Filter out images with cloud covdf > 10%
var Collection = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA').filter(ee.Filter.date('2022-01-01', '2022-12-01'));

// Get the number of images.
var count = Collection.size();
print('Count: ', count);

// Define NDVI Function
var addNDVI_Landsat = function(image) {
  var ndvi = image.normalizedDifference(['B5', 'B4']).rename('NDVI');
  return image.addBands(ndvi);
};

// Apply Function to all Images
var withNDVI_Landsat = Collection.map(addNDVI_Landsat);

// Make a "greenest" pixel composite.
var greenest = withNDVI_Landsat.qualityMosaic('NDVI');
var ndvi = greenest.select('NDVI')

// Define Color Scheme for Visualization
var ndviParams = {min: -.5, max: 1, palette: ['blue', 'white', 'green']};

// Display the result.
Map.addLayer(ndvi, ndviParams, 'Greenest pixel composite');

// // Export to Google drive
// Export.image.toDrive({
//   image: ndvi,
//   description: 'NDVI_2022',
//   scale: 30,
//   region: Boundary
// });

Running this code for any time in 2022 gives me nothing (Count = 16 as opposed to 90000+ in prior years), so I just wanted to make sure there weren't errors in my code or a different way to get the 2022 NDVI data before I proceeded.

1 Answer 1

2

The Code Editor should be telling you that LANDSAT/LC08/C01/T1_TOA is deprecated. It has no new data for 2022 except for a couple days of January.

Its replacement is LANDSAT/LC08/C02/T1_TOA in Landsat Collection 2, with data that's current to just a few days ago.

6
  • I always assumed LANDSAT/LC08/C02/T1_RT_TOA was the replacement of LANDSAT/LC08/C01/T1_RT, and LANDSAT/LE07/C02/T1_TOA was the replacement of LANDSAT/LC08/C01/T1_TOA. Can you please clarify this a bit? Commented Dec 2, 2022 at 6:51
  • @DanielWiell Thanks for asking! You're right that the replacement should be LANDSAT/LC08/C02/T1_TOA, not LANDSAT/LC08/C02/T1_RT_TOA. I've updated my answer, and the data catalog maintainers have been informed of the error too. (In the second part of your answer, LE07 is Landsat 7, not 8, though.)
    – Kevin Reid
    Commented Dec 2, 2022 at 17:44
  • Thanks for clarifying, Kevin. And sure, 8 not 7 :-) Commented Dec 2, 2022 at 18:37
  • @KevinReid do you need to perform cloud masking when using LANDSAT/LC08/C02/T1_TOA
    – N_LLC
    Commented Jan 31, 2023 at 14:54
  • @DanielWiell do you need to perform cloud masking when using LANDSAT/LC08/C02/T1_TOA
    – N_LLC
    Commented Jan 31, 2023 at 14:54

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.