Use MODIS to determine the cloudiest day of they year
step 1: Import the MOD09GA.005 Terra Surface Reflectance Daily L2G Global 1km and 500m
step 2: Draw a geometry
Step 3: use the code below:
// names of countries var country_names = ['Myanmar (Burma)','Thailand','Laos','Vietnam','Cambodia']; // Specify name of country. Ignored if "use_uploaded_fusion_table" == y // fusion table of countries var countries = ee.FeatureCollection('ft:1tdSwUL7MVpOauSgRzqVTOwdfy17KDbw-1d9omPw'); var mekongCountries = countries.filter(ee.Filter.inList('Country', country_names)); var mekongRegion = mekongCountries.geometry(); // filter for date terra = terra.filterDate(ee.Date.fromYMD(2000,1,1),ee.Date.fromYMD(2017,1,1)); // number of days in year var days = ee.List.sequence(0,31,1); // select the state_1km band var img = ee.Image(terra.first()).select("state_1km"); // set clouds to 1 and add day of year var clouds = terra.map(function(img) { var im = ee.Image(img.select("state_1km")).eq(1033); var doy = ee.Date(img.get('system:time_start')).getRelative('day','year'); return im.set("doy",doy).rename("clouds"); }); // sum all clouds for a day and divide by lenght of timeseries var dailycloudcover = ee.ImageCollection.fromImages( days.map(function (d) { var l = clouds.filter(ee.Filter.eq('doy', d)).toList(500).length() var cc = ee.Image(clouds.filter(ee.Filter.eq('doy', d)).sum()).divide(l) return cc.set('doy',d) }).flatten()) // set viz parameter var viz = { min: 0, max: 1, palette: '000000,0000FF,FDFF92,FF2700,FF00E7' }; //show first map Map.addLayer(ee.Image(dailycloudcover.first()),viz,"clouds"); // add the data as a chart var chart = ui.Chart.image.seriesByRegion(dailycloudcover, geometry, ee.Reducer.mean(), 'clouds', 2500, 'doy', 'SITE'); // print the chart print(chart);
follow this link!
Hi, It’s very interesting, but when I tried your code, but I get an error of memory limit exceeded each time (even without change anything).
Thanks! Try to adjust the time period (make it shorter).
Not better, Have you got a special user statut?
You can save the result to a csv. Printing information to the console often results in a time-out for computational intensive task. Try e.g. this https://code.earthengine.google.com/f61e356fcdf63317f5b8f8602c437ead and run the task.
It’s work! Thanks you!