-
Notifications
You must be signed in to change notification settings - Fork 107
/
Landsat_annual_mosaic.js
52 lines (42 loc) · 1.32 KB
/
Landsat_annual_mosaic.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
Create yearly, cloud-free mosaics from Landsat data and calculate the percentile values.
This can be used as a basis for land cover change analysis or classifications.
*/
// Load the Landsat 5 collection
var LT5 = ee.ImageCollection('LANDSAT/LT5_L1T');
// filter to year
var LT5_2005 = LT5.filterDate(ee.Date('2005-01-01'), ee.Date('2005-12-31'));
// Create a cloud-free Top-of-Athmosphere composite with custom parameters
var p50_2005 = ee.Algorithms.Landsat.simpleComposite({
collection: LT5_2005,
percentile: 50,
cloudScoreRange: 5
});
var p10_2005 = ee.Algorithms.Landsat.simpleComposite({
collection: LT5_2005,
percentile: 10,
cloudScoreRange: 5
});
var p90_2005 = ee.Algorithms.Landsat.simpleComposite({
collection: LT5_2005,
percentile: 90,
cloudScoreRange: 5
});
// Display the composites.
Map.setCenter(105.77, 10.07, 9);
Map.addLayer(p50_2005, {bands: ['B4', 'B3', 'B2'], max: 255}, 'LT5 TOA 2005 median');
// Export composites
// the region you want to export (var roi) has to be drawn as a polygon directly in the EarthEngine editor
// or imported as a FusionTable
Export.image(p50_2005, 'LT5_TOA_2005_p50_RRD', {
scale: 30,
region: roi
});
Export.image(p10_2005, 'LT5_TOA_2005_p10_RRD', {
scale: 30,
region: roi
});
Export.image(p90_2005, 'LT5_TOA_2005_p90_RRD', {
scale: 30,
region: roi
});