I'm trying to estimate the total of clear days in a year with the help of state_1km band in the MOD09GA product. But I'm not sure if it is right, also the possible counts are higher than expected when compared with cloud cover observation at weather stations.
// Load morning (Terra) MODIS data.
var morning = ee.ImageCollection('MODIS/006/MOD09GA');
// A function to extract cloudiness data from a MODIS image.
function clear(image) {
// The cloud state is in the low two bits of the 'state_1km' band.
var cloudState = image.select('state_1km').bitwiseAnd(0x03);
// 0:clear, 1:cloudy, 2 means mixed, and 3:missing data.
return cloudState.float()
.remap([0,1],[1,0])
.updateMask(cloudState.neq(3))
.updateMask(cloudState.neq(2));
}
var select_morning = morning.filter(ee.Filter.calendarRange(2015,2015,'year'));
var clear_days = select_morning.map(clear);
var count = clear_days.reduce(ee.Reducer.sum());
Best Answer
Yes, The computation is ok, I got the same results:
Is difficult to obtain the same results from a weather station. A weather station is acquiring data every minute, hour or another time range. MODIS acquire data from 1 to 5 times per day:
Also, the resolution of MODIS data is really coarse compared to a weather station. Will be only an approximation. Compare daily data from the coordinates of your weather station to find relations prior to a rectification.