I am trying to get MODIS satellite data with Google Earth Engine to find temperature data of given points on a map. I would like to get an array of all the points in an area (every 1km square in California) and their temperatures in a given timeframe. The array would be kind of like this: [[temperature on December 10, temperature on December 11...], [...], [...]]
With each element corresponding to a different 1km square. So far, I have the following code to find the temperature of a specific point:
var dataset = ee.ImageCollection('MODIS/006/MOD11A1')
.filter(ee.Filter.date('2018-12-10', '2018-12-23'));
var landSurfaceTemperature = dataset.select('LST_Day_1km');
var landSurfaceTemperatureVis = {
min: 13000.0,
max: 16500.0,
palette: [
'040274', '040281', '0502a3', '0502b8', '0502ce', '0502e6',
'0602ff', '235cb1', '307ef3', '269db1', '30c8e2', '32d3ef',
'3be285', '3ff38f', '86e26f', '3ae237', 'b5e22e', 'd6e21f',
'fff705', 'ffd611', 'ffb613', 'ff8b13', 'ff6e08', 'ff500d',
'ff0000', 'de0101', 'c21301', 'a71001', '911003'
],
};
Map.setCenter(-6.746, 46.529, 10);
Map.addLayer(landSurfaceTemperature, landSurfaceTemperatureVis, 'Land Surface Temperature');
//print(landSurfaceTemperature);
// map over the image collection and use server side functions
var tempToDegrees = landSurfaceTemperature.map(function(image){
return image.multiply(0.02).subtract(273.15);
});
// print and add to the map
//print('image collection in temp in degrees', tempToDegrees);
Map.addLayer(tempToDegrees, {min: -20, max: 40, palette: landSurfaceTemperatureVis.palette}, 'temp in degrees');
var point = ee.Geometry.Point(coordinates);
var data = dataset.select('LST_Day_1km').get('LST_Day_1km');
var dataN = ee.Number(data);
print(dataN);
When I print dataN, the output is null. I want to print the temperature in degrees. How can I do this?