I am new to Google Earth Engine.
I have a program for Atmosphere Monitoring. I have managed to pull data for historical data. However, I can't pull recent data e.g. (a couple of days, today , yesterday etc.), I get error:
Collection.toList: The value of 'count' must be positive. Got: 0.
As it says 'Near-Real-Time' that mean that the data must update many times a day? My final goal is to be able to pull data in (near) real time so that I can this data through some other program visualize it. Is that possible?
var pt = ee.Geometry.Point(23.72801716860135,37.984115295446216);
Map.centerObject(pt,14);
Map.addLayer(pt);
var starDate = '2023-02-20';
var endDate = '2023-02-21';
var Monthly = ee.ImageCollection('ECMWF/CAMS/NRT').select('total_aerosol_optical_depth_at_550nm_surface')
.filterDate(starDate, endDate);
print(Monthly);
var allDates = ee.List(Monthly.aggregate_array('system:time_start'));
var allDatesSimple = allDates.map(function(date){
return ee.Date(date).format().slice(0,10);
});
//print(allDatesSimple);
var getTemp = function(image) {
// Reducing region and getting value
var value_tmmx = ee.Image(image)
.reduceRegion(ee.Reducer.first(), pt)
.get('total_aerosol_optical_depth_at_550nm_surface');
return ee.Number(value_tmmx).multiply(0.1);
};
var count = Monthly.size();
var tmmx_list = Monthly.toList(count).map(getTemp);
print("tmmn_list", tmmx_list);
var paired = allDatesSimple.zip(tmmx_list);
print ("paired", paired);
var myFeatures = ee.FeatureCollection(paired.map(function(el){
el = ee.List(el); // cast every element of the list
return ee.Feature(null, {
'date': ee.String(el.get(0)),
'aerosol':ee.Number(el.get(1)),
});
}));
print(myFeatures);
// Export features, specifying corresponding names.
Export.table.toDrive(myFeatures,
"export_aerosol", //my task
"GEE_Folder", //my export folder
"aerosol2", //file name
"csv");