How to add Time column in the sentinel 5p data

38 Views Asked by At

These codes (Google earth engine to download each pixel values in CSV format) provide me latitude, longitude and CH4 values with system index column. I need a column with time that should give time series values like '2021-04-08','2021-04-09' and so on. How I can add time column in the following codes:

var startDate = '2021-04-08';
var endDate = '2021-10-19';

Map.addLayer(region)
Map.centerObject(region, 6)

// Create a date filter to get data from the specified month

var dateFilter = ee.Filter.date(startDate, endDate);

// Get the mean data for the specified month and region

var dataset = ee.ImageCollection('COPERNICUS/S5P/OFFL/L3_CH4')
          .select('CH4_column_volume_mixing_ratio_dry_air_bias_corrected')
          .filterBounds(region)
          .filter(dateFilter)

var meanData = dataset.mean().clip(region);

var band_viz = {
  min: 1750,
  max: 1900,
  palette: ['black', 'blue', 'purple', 'cyan', 'green', 'yellow', 'red']
};
Map.addLayer(meanData, band_viz)

// Extract the pixel values, latitude, and longitude

var features = meanData.addBands(ee.Image.pixelLonLat()).sampleRegions({
collection: region,
properties: ['CH4'],
scale: 1113.2 
});

// Export the data to a CSV file

Export.table.toDrive({
collection: features,
fileFormat: "CSV",
folder: "gee",
fileNamePrefix: "mean_tropomi_CH4_data" 
});
0

There are 0 best solutions below