0

I would like to download time-series data from Google Earth Engine (GEE). First I filter the date of the image collection. Because I am only interested in the value of two locations, I use reduceRegion() for each image in the collection and try to return the temperature value at the two locations. Finally, I use Export.table.toDrive() to export the data. However, I can only see metadata but the values.

var dataset = ee.ImageCollection("ECMWF/ERA5_LAND/HOURLY")
                .filterDate('2020-07-01', '2020-12-03');
                
var locs = ee.FeatureCollection([
  ee.Feature(ee.Geometry.Point([25.00033117429692, 121.59054455263632])),
  ee.Feature(ee.Geometry.Point([25.085598501659337, 121.60556252402378]))
  ]);

var timeSeries = ee.FeatureCollection(dataset.map(function(image) {
  var stats = image.reduceRegion({
    reducer: ee.Reducer.mean(),
    geometry: locs.geometry(),
    scale: 100,
    maxPixels: 10000
  })  

  var era5 = ee.List([stats.get('temperature_2m'), -9999])
    .reduce(ee.Reducer.firstNonNull())

  var f = ee.Feature(null, {'temperature_2m': era5,
    'date': ee.Date(image.get('system:time_start')).format('YYYY-MM-dd')})
  return f
}))

Export.table.toDrive({
    collection: timeSeries, 
    description: 'Temperature', 
    folder: 'GEE', 
    fileNamePrefix: 'ERA5-temp-tpe', 
    fileFormat: 'CSV'
})

0 Answers0