1

I'm trying to obtain daily NO2 pollution values for global district areas. I fail to get any of the bands of my images returned as columns. When I reduceRegions over only one image from the collection, I manage to obtain the bands of the image as columns.

Here's the code:

var districts = ee.FeatureCollection(gadm);

var no2Days = ee.ImageCollection("COPERNICUS/S5P/NRTI/L3_NO2")
  .select('NO2_column_number_density')
  .filterDate('2020-04-26', '2020-04-28');

var scaleNo2 = no2Days.first().projection().nominalScale();
print(no2Days.first());

var no2FirstDay = no2Days.first();
print(no2FirstDay);

var no2FirstDayRed = no2FirstDay.reduceRegions({
  reducer: ee.Reducer.mean(),
  collection: districts,
  scale: scaleNo2,
 });
print(no2FirstDayRed.limit(5));

var dailyAverage = no2Days.map(function(image){
  var time = ee.Date(image.get('system:time_start')).format('YYYY-MM-dd');
  var districtMeans = image.reduceRegions({
    'reducer': ee.Reducer.mean(),
    'scale': scaleNo2,
    'collection': districts,
  }).map(function(feat){
    return ee.Feature(feat).set('Date', time);
  });
  return districtMeans;
}).flatten();
print(dailyAverage.limit(5));

Export.table.toDrive({
  collection: no2FirstDayRed.limit(5),
  description:'no2Test',
  fileFormat: 'csv'
});

The script can be found here: https://code.earthengine.google.com/5fd4bda5eb3db4ebd552fc2c66439edc

1

When exporting, the first feature is tested on it's available properties. If they are not present in the first, they won't be exported. You can find solutions here and here. This might work for you (note that you did not share your asset, so I am unable to verify):

dailyAverage = dailyAverage.filter(ee.Filter.notNull(['NO2_column_number_density']));

link

| improve this answer | |
  • This works great, thank you so much. I've now shared the asset. Any hunch, why there are null values? Also, would you have any advice how to select bands early on? I'd like to select 'NO2_column_number_density', but it gives me computation timeouts, when I print it. – Sebastian Kraus Apr 29 at 13:02
  • When I try to export without selecting a band first, exporting takes very long. This is probably because of memory issues, when doing the reduceRegions over all bands? – Sebastian Kraus Apr 30 at 9:41
0

To select bands from each image in the collection use .select([bandsToSelect]) In your case, no2Days.select('NO2_column_number_density')

Regarding your question about null values, NO2 data has some masked out pixels. I zoomed to one area, see the link.

| improve this answer | |

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.