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.