Skip to main content
responded to OP's comment
Source Link
korndog
  • 1.1k
  • 6
  • 8

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

Export.table.toDrive({
  collection: cloudlist.sort('cloud_fraction'),
  description: 'NL_mean_cloud_fraction',
  selectors:['system:time_start','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 
  .filter(ee.Filter.lt('cloud_fraction',0.1))
  
  .map(function(image){
    
    // 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.

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

Export.table.toDrive({
  collection: cloudlist.sort('cloud_fraction'),
  description: 'NL_mean_cloud_fraction',
  selectors:['system:time_start','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).

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

Export.table.toDrive({
  collection: cloudlist.sort('cloud_fraction'),
  description: 'NL_mean_cloud_fraction',
  selectors:['system:time_start','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 
  .filter(ee.Filter.lt('cloud_fraction',0.1))
  
  .map(function(image){
    
    // 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.

Source Link
korndog
  • 1.1k
  • 6
  • 8

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

Export.table.toDrive({
  collection: cloudlist.sort('cloud_fraction'),
  description: 'NL_mean_cloud_fraction',
  selectors:['system:time_start','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).