I tried using the code below to download the data. I have doubts about the correctness of the code.
Can you help me correct it?
I encountered errors, which may be due to the large size of the dataset. Additionally, I'm plotting the data, which might cause further issues.
ar roi = geometry;
// Define the time range
var startDate = '2021-01-01';
var endDate = '2021-05-31';
// Create a date range
var dateRange = ee.DateRange(startDate, endDate);
// Load ERA5-Land temperature data
var era5Land = ee.ImageCollection('ECMWF/ERA5_LAND/DAILY_AGGR')
.filterBounds(roi)
.filterDate(dateRange)
.select(['temperature_2m']);
// Aggregate the data to daily scale by calculating the mean
var dailyEra5Land = era5Land.mean();
// Print the first image in the collection
print('First image in the collection:', dailyEra5Land);
// Create a time series chart for temperature
var tempChart = ui.Chart.image.seriesByRegion({
imageCollection: era5Land,
regions: roi,
reducer: ee.Reducer.mean(),
scale: 10000,
xProperty: 'system:time_start'
}).setOptions({
title: 'Temperature Time Series',
hAxis: {title: 'Date'},
vAxis: {title: 'Temperature (°C)'},
});