I am trying to acquire MODIS NDVI (MOD13Q1 v061) time series using Google Earth Engine for certain locations for which I have the coordinates. My code looks as follows:
////////// Input
// Specify dataset
var dataset = 'MODIS/061/MOD13Q1';
// Specify variable name
var variable = 'NDVI';
// Specify scale factor
var scale = 0.0001;
// Specify the date range of interest
var startDate = '2010-01-01';
var endDate = '2022-12-31';
// Specify a list of sites with names and coordinates
var sites = [
{'name': 'AAC001', 'lat': 59.664, 'lon': 10.762},
{'name': 'WUC002', 'lat': 50.505, 'lon': 6.331}
];
////////// Processing
// Load the image collection
var collection = ee.ImageCollection(dataset)
.filterDate(startDate, endDate)
.select(variable);
// Define projection of the image collection
var projection = collection.first().projection();
// Loop over the sites and export the time series as a CSV file for each site
sites.forEach(function(site) {
// Create a point geometry from the coordinates
var point = ee.Geometry.Point(site.lon, site.lat).transform(projection);
// Filter the image collection based on the point geometry
var collectionPoint = collection.filterBounds(point);
// Get the value for point for each image in the collection
var timeseries = collectionPoint.map(function(image) {
var mean = image.reduceRegion({
reducer: ee.Reducer.mean(),
geometry: point,
scale: scale,
crs: projection,
maxPixels: 1e9,
});
return image.set(variable, mean.get(variable));
});
// Export the time series as a CSV file
Export.table.toDrive({
collection: timeseries,
description: dataset.replace(/\//g, '_') + '_' + variable + '_' + site.name,
fileFormat: 'CSV'
});
});
However, I get the following error:
Error: Error in map(ID=2010_02_18): Image.reduceRegion: Unable to transform geometry into requested projection. (Error code: 3)
GEE interprets "scale" as meters. I have input a scale of 0.0001 meters, which is wrong. The value I got from the Data Catalog: developers.google.com/earth-engine/datasets/catalog/…. However, this refers to scale the NDVI values.
After I changed "scale" to 1 meter I was able to export the time series.