// Set the date range
var startDate = ee.Date(‘2020-09-05’);
var endDate = ee.Date(‘2020-10-01’);
// Define the region of interest with the specified coordinates
var extendedRegion = ee.Geometry.Polygon([
[
[-118.9249755859375, 33.77887165063742], // Point 0
[-117.425341796875, 33.77887165063742], // Point 1
[-117.425341796875, 34.72328232327606], // Point 2
[-118.9249755859375, 34.72328232327606], // Point 3
[-118.9249755859375, 33.77887165063742] // Point 4 (Closing the polygon)
]
]);
// Function to process and export each day’s data
function exportDailyData(day) {
var date = startDate.advance(day, ‘day’);
var dateString = date.format(‘YYYY-MM-dd’).getInfo();
// Create and filter the image collection for that single day
var dailyCollection = ee.ImageCollection(‘COPERNICUS/S5P/NRTI/L3_CO’)
.select(‘CO_column_number_density’)
.filterDate(date, date.advance(1, ‘day’))
.filterBounds(extendedRegion);
// Reduce the ImageCollection to a single image using mean
var dailyMeanCO = dailyCollection.mean();
// Export the image as GeoTIFF
Export.image.toDrive({
image: dailyMeanCO,
description: ‘BOBCAT_’ + dateString,
folder: ‘BOBCATCALTECH’,
scale: 1113.2,
region: extendedRegion,
fileFormat: ‘GeoTIFF’
});
}
// Calculate the number of days to process
var nDays = endDate.difference(startDate, ‘day’);
// Loop over each day and export data
for (var day = 0; day < nDays.getInfo(); day++) {
exportDailyData(day);
}