4

I would like to filter S-5P data to show only data with clouds less than 5% using Google Earth Engine. I'm working with Sentinel-5P NRTI NO2: Near Real-Time Nitrogen Dioxide.

A guide from Copernicus states that there are "quality flags related to the presence of clouds within each pixel: 0% pixels means that the sky above this particular area is free of clouds and, conversely, 100% means that the entire sky is covered by clouds." There are many cloud related S-5P parameters on p140 of the documentation

How can I filter by the quality flag mentioned using earth engine?

With Landsat data you can view the cloud property like this

// Get a specific metadata property.
var cloudiness = image.get('CLOUD_COVER');
print('CLOUD_COVER: ', cloudiness); // ee.Number

I've tried viewing the metadata properties of S-5P like this, but the properties returned are only high-level

// Get a list of all metadata properties.
var properties = collection.propertyNames();
print('Metadata properties: ', properties); // ee.List of metadata properties

I've also looked at the earth engine page Image Properties tab however those don't seem to relate to Quality or Cloud cover

Here is the basic code

var collection = ee.ImageCollection('COPERNICUS/S5P/NRTI/L3_NO2')
  .select('tropospheric_NO2_column_number_density')
  .filterBounds(geometry)

var current = collection.filterDate('2019-03-20', '2019-03-27').mean();

var vizParams = { min: 0, max: 0.0002, palette: ['black', 'red']};
Map.addLayer(current, vizParams, 'S5P N02');

UPDATE

I haven't been able to find any of the references to cloud within the NO2 data, however S-5P has a "cloud_fraction" band. I am able to set this to 5% and apply it as a mask to the NO2 dataset. Is this the correct way to get my result?

// Cloud mask for pixels with less than 5% cloud cover
var cloudMask = function(image) {
      return image.updateMask(image.select("cloud_fraction").lt(5));
    };

// Map the cloud masking functions over NO2 data
var collection = ee.ImageCollection('COPERNICUS/S5P/NRTI/L3_NO2')
  .select(['tropospheric_NO2_column_number_density','cloud_fraction'])
  .filterDate('2019-03-01', '2019-03-28')
  .filterBounds(geometry)
  .map(cloudMask);

// Reduce the collection to the mean of each pixel and display.
var meanImage = collection.reduce(ee.Reducer.mean());
var vizParams = {min: 0, max: 0.0002};
Map.addLayer(meanImage, vizParams, 'S5P N02 mean');
1

The script seems fine to me, but I think you should correct the mask value: in S5P, cloud_fraction range is [0, 1] so you should mask with lt(0.05) rather than lt(5)

| 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.