I am trying to export a csv of daily mean cloud cover in the Netherlands according to S5P data. I have calculated the mean cloud fraction, but the exported csv shows many, many rows - none of them are cloud_fraction (image below). What am I missing?

//  1. Setup
var countries = ee.FeatureCollection("FAO/GAUL/2015/level0");
var NL = countries.filterMetadata('ADM0_NAME', 'equals', 'Netherlands');
var start_period = ee.Date('2018-07-01');
var end_period = ee.Date(new Date().getTime());

var clouds = ee.ImageCollection('COPERNICUS/S5P/OFFL/L3_CLOUD')
  .filterDate(start_period, end_period);

var cloudNL=clouds.map(function(im){ 
   return im.clip(NL)//.resample('bilinear').reproject('EPSG:4326', null, 2000);

//  2. Mean cloud cover dictionary for entire collection
var cloudlist = cloudNL.map(function(image){
  var meandict = image.select('cloud_fraction').reduceRegion({
    reducer: ee.Reducer.mean(),
    geometry: NL
  return image.set(meandict); 

Export.table.toDrive(cloudlist.sort('cloud_fraction'), 'NL_mean_cloud_fraction');

enter image description here

1 Answer 1


ASNWER: Include 'cloud_fraction' in a list of properties of cloudlist to export using the selectors argument. Example:

  collection: cloudlist.sort('cloud_fraction'),
  description: 'NL_mean_cloud_fraction',

EXPLANATION: 'cloud_fraction' didn't appear in your exported .csv is because of null values set for this property in the function you mapped onto cloudNL. It is not possible to set an image property to have a null value. This can be shown by:

var image = ee.Image().set('dummy',null)
print(image.propertyNames()) // there is no 'dummy' property in the returned list 

If the selectors argument is not defined in Export.table.toDirive, I'm guessing that the function sets selectors to be all of the properties of the first entry in the exported collection. If 'cloud_fraction' was set to null in that first entry, then this property would be deselected from your exported .csv -- which would be the case since cloudlist was sorted by 'cloud_fraction' (null values came first).

EDIT: the following example filters cloudlist by 'cloud_fraction' and adds a new property, which we will call 'datestring':

cloudlist = cloudlist

   // keep images with cloud_fraction less than 0.1 
    // extract the first 8 characters from system:index using ee.String.slice
    var datestring = ee.String(image.get('system:index')).slice(0,8)
    return image.set('datestring', datestring)

Note, you will have to add datestring to your list of properties to export as a table.

  • Thanks! I don't see where I explicitly the set cloud_fraction values to null? The csv export now works, but the cloud_fraction column is still completely empty.
    – Olivier
    Feb 19, 2021 at 10:57
  • 1
    The majority of your images do not intersect with your area of interest (NL), so when you reduce your image a null is returned. If you are still sorting your exported collection by 'cloud_fraction', the non-null entires should be at the end of the .csv. Might be useful to filter cloudlist using Filter.notNull, example: cloudlist.filter(ee.Filter.notNull(['cloud_fraction']))
    – korndog
    Feb 19, 2021 at 17:59
  • I realized that the images with cloud_fraction values were simply further down in the Excel. Using .notNull worked for me, thanks! In addition to that, could I keep only values lower than 0.10? And furthermore, could I directly split the system:time attributes before the first 'T', so I only keep e.g. 20200721 as a title?
    – Olivier
    Feb 23, 2021 at 10:58
  • 1
    Glad to hear things are working for you, @Olivier. See my editted answer for my response to your questions.
    – korndog
    Feb 23, 2021 at 18:46
  • 1
    @Olivier, I suggest that you post these follow-up question seperately, since your original question has been answered. At this time, I cannot help you with this last question. I recall a similar question being asked recently: gis.stackexchange.com/questions/387693/…. All the best.
    – korndog
    Feb 24, 2021 at 16:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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