I perform some analysis on Sentinel-5P data using Google Earth Engine. I would like to know how many cludless days are during month for each pixel. I am using the code below and it works. The problem is that Sentinel-5P images are captured several times a day so my result is number of cloudless images instead of cloudless days.
//Poland's border
var polska = ee.FeatureCollection('users/patrykgrzybowski1991/POL_adm1');
//upload collection
var collection_january_19 = ee.ImageCollection('COPERNICUS/S5P/NRTI/L3_NO2')//('COPERNICUS/S5P/NRTI/L3_NO2')
//filters
.filterBounds(ee.FeatureCollection('users/patrykgrzybowski1991/POL_adm0'))
.filterDate('2019-01-01', '2019-02-01')
.map(function(img){return ee.Image(img.select('tropospheric_NO2_column_number_density')).updateMask(img.select('cloud_fraction').lt(0.4))})
//cludless images - count
var count_january_19 = collection_january_19.count();
Number of cloudless days is slightly ill-defined when there are multiple images, but if you mean "none of the images on a day had clouds in them", then you probably need to composite the images by day before counting:
var start = ee.Date('2019-01-01')
var daysAsList = ee.List.sequence(0, 31).map(function(n) {
n = ee.Number(n)
var begin = start.advance(n, 'day')
var end = begin.advance(1, 'day')
return collection_january_19.filterDate(begin, end).mosaic()
})
var days = ee.ImageCollection.fromImages(daysAsList).count()