-
Notifications
You must be signed in to change notification settings - Fork 1
/
Session 2 Clustering_GEE_Exercise
137 lines (89 loc) · 4.55 KB
/
Session 2 Clustering_GEE_Exercise
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
// The link to the exercise can be found here: https://code.earthengine.google.com/eee362aae6371ef5b9fd00ddc9e9734a
///////
//+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
//S. Aparício (Solenix), I. Alonso (Solenix)
//
//MIT LICENSE CC BY EUMETSAT
//+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
//❄️☀️
// Session 2 “Hands-on: Clustring two image of different seasons
// for change detection"
// PARTICIPANT'S VERSION
//
//
//+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
// EXERCICE 2: CLUSTER A S2 CLOUD FREE IMAGE OF ENDALEN (SVALBARD)
// FROM TWO DIFFEREN SEASONS AND APPLY A CHANGE DETECTION BETWEEN THEM
//+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
/////////////////////////////////////////////////////////////////////////////
////////////////////// 1. DEFINED AND VISUALIZE AOI /////////////
/////////////////////////////////////////////////////////////////////////////
//Create a geometry over Endalen, in Svalbard - and name it AOI and visualize it
// *Your code here
//Center the visualization there
// *Your code here
//////////////////////////////////////////////////////////////////////////////
////////////////////// 2. PREPARING SATELLITE IMAGERY /////////////////
//////////////////////////////////////////////////////////////////////////////
//Define a "summer range date" with ee.Date could be from 2022-06-01 to 2022-08-28 > e.g. ee.Date('2022-01-01')
//e.g. ee.Date('2022-01-01')
//var start = //*Your code here
//var end = //*Your code here
//Define a "winter range date" could be from 2022-05-30 to 2022-07-02
//var start2 = //*Your code here
//var end2 = //*Your code here
//Create a summer collection
//var summerCol = //*Your code here
//Create a winter collection
//var winterCol = //*Your code here
//var summerImage = //*Your code here
//var winterImage = //*Your code here
//var visRGB = {
// min: 1400,
// max: 9500,
// gamma: 2.24,
// bands: ['B4', 'B3', 'B2']
//};
//Map.addLayer(summerImage .clip(AOI), visRGB, 'Sentinel-2 Summer Image')
//Map.addLayer(winterImage .clip(AOI), visRGB, 'Sentinel-2 Winter Image')
//////////////////////////////////////////////////////////////////////////////
//////////// 3. Create image of absolute differences ///////////////
//////////////////////////////////////////////////////////////////////////////
//var changeCover = //*Your code here
//Map.addLayer(changeCover.clip(AOI), {}, 'Reflectance Abs. differences Image')
//////////////////////////////////////////////////////////////////////////////
////////////// 4. Collecting training data /////////////////////////
//////////////////////////////////////////////////////////////////////////////
//During the supervised classification we started at this point to
//collect data about the differnt clases.
//Here we won't be doing it manually but we will create a function
//to give as 100 random points in the area.
//Ideally should be more than 100 points, but this is just an example to speed things up
//This sample function will return a FeatureCollection with 100 points
//containing the spectral value of the image they are located on
//var training_data = //*Your code here
//////////////////////////////////////////////////////////////////////////////
////////////// 4. Create a cluster and train it /////////////////////////
//////////////////////////////////////////////////////////////////////////////
// The next stop is to create a clusterer object from one of the different
//algorithms available:
//var clusterer = ee.Clusterer.wekaXMeans()
//var clusterKmeans = //*Your code here
// This is still need to be trained. This is done by
//applying the train() function on the clusterer and passing in the
//training data
//var trainedKmeans = //*Your code here
//This cluster has now looked at all this points, and group them by similiarity
// while these groups are as distinc as possible from other groups of points
//When we apply this cluster to our image, it will take all pixels of the image
//and determine, to which of these groups the pixel is most similar
//var clusteredImage = //*Your code here
//////////////////////////////////////////////////////////////////////////////
////////////// 5. Visualize results /////////////////////////
//////////////////////////////////////////////////////////////////////////////
//var visCluster = {
// min: 0,
// max: 4,
// palette: ['white', 'red']
//};
//Map.addLayer(clusteredImage.clip(AOI), visCluster, 'Clustered Reflectance Change Image')