How can I plot the chart to show the SO2 time series?

var collection = ee.ImageCollection('COPERNICUS/S5P/NRTI/L3_SO2')
  .filterDate('2021-10-01', '2021-10-31')
  // .filterMetadata("SO2_column_number_density", 'less_than', 0);
  .map(function (image) { return image.updateMask(image.gte(0)) })
// print(collection)
// var col=collection.values.filter(ee.Filter.notNull(['SO2_column_number_density']))
var no2Image = collection.mean().clip(geometry); // mean across each period
print('NO2 image', no2Image); // debug info in console
var band_viz = {
  min: 0,
  max: 0.004,
  opacity: 1,
  palette: ['black', 'blue', 'purple', 'cyan', 'green', 'yellow', 'red']
// The region of interest - a planar rectangle around London/S.England.
var rect = geometry
Map.setOptions('hybrid'); // set map to hybrid backdrop
Map.centerObject(rect, 6); // zoom in to the defined area
Map.addLayer(no2Image, band_viz, 'Sentinel 5P NRT N02 - Nov 2019');
// Create a task that you can launch from the Tasks tab.
// commented out here - but saves off geoTIFF files
  image: no2Image.clip(rect),
  description: 'SO2_red_sea_december',
  folder: 'GEE',
  fileNamePrefix: 'SO2_change',
  region: rect,
  fileFormat: 'GEOTIFF',
  scale: 1000

Code source: Filter negative SO2 image collection in GEE

1 Answer 1


For details you can check this link.

One way:

var chart =
          imageCollection: collection,
          region: geometry,
          regionReducer: ee.Reducer.mean(),
          scale: 1113.2,
          startDay: 1,
          endDay: 365
          title: 'Average SO2 by Day of Year',
          hAxis: {
            title: 'Day of year',
            titleTextStyle: {italic: false, bold: true}
          vAxis: {
            titleTextStyle: {italic: false, bold: true}
          lineWidth: 5,
          colors: ['1d6b99'],

Code link

Not the answer you're looking for? Browse other questions tagged or ask your own question.