0

I'm using the code bottom to create NO2 Charts of a region. Please, do you know if it possible to group the three graphs into one?

var collection = ee.ImageCollection('COPERNICUS/S5P/NRTI/L3_NO2')
.select('NO2_column_number_density')
.filterDate('2019-01-01', '2020-04-30');

var mean=ui.Chart.image.series(collection, geometry, ee.Reducer.mean(), 30).setOptions({title: 'NO2 mean'});
var max=ui.Chart.image.series(collection, geometry, ee.Reducer.max(), 30).setOptions({title: 'NO2 max'});;
var min=ui.Chart.image.series(collection, geometry, ee.Reducer.min(), 30).setOptions({title: 'NO2 min'});;

Link to code

Thanks in advance to those who can help me

1

You can do that by using the ui.Chart.feature.byFeature() function. Make a feature collection with a property for each image for mean, min and max value. Then plot the chart.

var feats = collection.map(function(image){
  var reducers = ee.Reducer.mean().combine(ee.Reducer.max(), '', true).combine(ee.Reducer.min(),'', true);
  var stats = image.reduceRegion(reducers, geometry, 1000);
  return ee.Feature(null, stats).set('system:time_start', image.get('system:time_start'));
});

// plot that feature collectioin
var chart = ui.Chart.feature.byFeature(feats, 'system:time_start')
                .setSeriesNames(['NO2 mean', 'NO2 max', 'NO2 min']);
print(chart)

Also note that you better filter the collection on the boundaries of the geometry:

var collection = ee.ImageCollection('COPERNICUS/S5P/NRTI/L3_NO2')
  .select('NO2_column_number_density')
  .filterDate('2019-01-01', '2020-04-30')
  .filterBounds(geometry);

Link code. Note that I draw an dummy geometry and increased the scale to reduce computation time. A scale of 30m might be unnecasarry high for 0.01 arc degrees scale images.

| improve this answer | |
  • Thank you very nuch @Kuik. your answer allowed me to understand many new things that will be useful for other projects – Daniele Piccolo May 11 at 6:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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