Extracting ERA5-Land variables for a point in GEE
I have a point for which I want to extract several meteorological variables from the daily aggregated ERA5-Land dataset in GEE. I know there are many similar questions asked before, but they all have some complications that are not applicable to my case which is more simple. I try to adapt this code https://gis.stackexchange.com/a/391001/24160. I collected the needed variables values and the dates in a list of dictionaries. The problem is that I cannot get the data from that list and put it into a feature collection. Here is the code:
Map.addLayer(point);
Map.centerObject(point, 17);
var point = ee.FeatureCollection(point);
var bands = ['temperature_2m', 'snow_cover'];
var startDate = ee.Date('2025-01-01');
var endDate = ee.Date('2025-01-10');
var dataset = ee.ImageCollection('ECMWF/ERA5_LAND/DAILY_AGGR')
.select(bands)
.filterDate(startDate, endDate);
//print(dataset);
var list_dataset = dataset.toList(dataset.size());
print(list_dataset);
var getValues = function(image) {
var values = ee.Image(image)
.reduceRegion(ee.Reducer.first(), point);
var date = ee.Image(image).get('system:index');
values = values.set("date", date);
return values;
};
var values_list = list_dataset.map(getValues);
print(values_list);
// Generate feature collection - Attempt 1
// var myFeatures = ee.FeatureCollection(values_list.map(function(el){
// var geom = point;
// return ee.Feature(geom, el);
// })).flatten();
// Generate feature collection - Attempt 2
var myFeatures = ee.FeatureCollection(values_list.map(function(el){
el = ee.Dictionary(el);
var geom = point;
return ee.Feature(geom, {
'date': ee.String(el.get('date')),
'snow_cover':ee.Number(el.get('snow_cover')),
'temperature_2m': ee.Number(el.get('temperature_2m'))
});
})).flatten();
print(myFeatures);
//Export to Google Drive as csv file
Export.table.toDrive({
collection:myFeatures,
description: 'era5landtest',
folder: 'ERA5',
fileFormat: 'csv',
});
24.11.2025 10:19 β π 0 π 0 π¬ 0 π 0