Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. // A rectangle representing the roi.
  2. var geometry = ee.Geometry.Rectangle(-8.372, 10.017, -2.703, 5.358)
  3.  
  4. var ic = ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA")
  5. .filterBounds(geometry)
  6. .filterDate('2013-01-01','2013-12-01');
  7.  
  8. var c = ic.filterBounds(geometry);
  9.  
  10. var withCloudiness = c.map(function(image) {
  11. var cloud = ee.Algorithms.Landsat.simpleCloudScore(image).select('cloud');
  12. var cloudiness = cloud.reduceRegion({
  13. reducer: 'mean',
  14. geometry: geometry,
  15. scale: 30,
  16. maxPixels: 1e9
  17. });
  18. return image.set(cloudiness);
  19. });
  20.  
  21. var filteredCollection = withCloudiness.filter(ee.Filter.lt('cloud', 10));
  22.  
  23. // Compute the median in each band, in each pixel.
  24. //var median = filteredCollection.median();
  25.  
  26. print(filteredCollection);
  27.  
  28. // Select the red, green and blue bands.
  29. //var filteredCollection = median.select('B3', 'B2', 'B1');
  30. var visParams = {bands: ['B4', 'B3', 'B2'], max:0.4};
  31. Map.addLayer(filteredCollection);
  32. Map.setCenter(-6.01, 6.51, 5);
  33.  
  34. Map.addLayer(filteredCollection,visParams);
  35.  
  36. var visParams = {bands: ['B4', 'B3', 'B2'],min:0,max:0.25};
  37. Map.addLayer(filteredCollection, visParams);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement