-
Notifications
You must be signed in to change notification settings - Fork 18
/
gee-advanced.Rmd
189 lines (120 loc) · 7.79 KB
/
gee-advanced.Rmd
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
---
title: "Advanced Concepts in Google Earth Engine (Full Course)"
subtitle: "A Deep-dive into Reducers, Joins, Regressions and Vector Data Processing in GEE."
author: "Ujaval Gandhi"
fontsize: 12pt
output:
# pdf_document:
# latex_engine: xelatex
# toc: yes
# toc_depth: 3
# fig_caption: false
# word_document:
# toc: false
# fig_caption: false
html_document:
df_print: paged
highlight: pygments
includes:
after_body: comment.html
toc: yes
toc_depth: 3
header-includes:
- \usepackage{fancyhdr}
- \pagestyle{fancy}
- \renewcommand{\footrulewidth}{0.4pt}
- \fancyhead[LE,RO]{\thepage}
- \geometry{left=1in,top=0.75in,bottom=0.75in}
- \fancyfoot[CE,CO]{{\includegraphics[height=0.5cm]{images/cc-by-nc.png}} Ujaval Gandhi http://www.spatialthoughts.com}
---
\newpage
***
```{r echo=FALSE, fig.align='center', out.width='75%', out.width='250pt'}
knitr::include_graphics('images/spatial_thoughts_logo.png')
```
***
\newpage
# Introduction
This is an advanced-level course that is suited for participants who are familiar with the Google Earth Engine API and want to learn advanced data processing techniques and understand the inner-workings in Earth Engine. This class covers the following topics:
* Reducers
* Joins *(coming soon)*
* Regressions *(coming soon)*
* Vector Data Processing and Visualization *(coming soon)*
# Sign-up for Google Earth Engine
If you already have a Google Earth Engine account, you can skip this step.
Visit our [GEE Sign-Up Guide](gee-sign-up.html) for step-by-step instructions.
# Get the Course Materials
The course material and exercises are in the form of Earth Engine scripts shared via a code repository.
1. [Click this link](https://code.earthengine.google.co.in/?accept_repo=users/ujavalgandhi/GEE-Advanced) to open Google Earth Engine code editor and add the repository to your account.
2. If successful, you will have a new repository named `users/ujavalgandhi/GEE-Advanced` in the *Scripts* tab in the *Reader* section.
3. Verify that your code editor looks like below
```{r echo=FALSE, fig.align='center', out.width='50%', fig.cap='Code Editor with Workshop Repository'}
knitr::include_graphics('images/gee_advanced/repository.png')
```
If you do not see the repository in the *Reader* section, click *Refresh repository cache* button in your *Scripts* tab and it will show up.
```{r echo=FALSE, fig.align='center', out.width='50%', fig.cap='Refresh repository cache'}
knitr::include_graphics('images/common/repository_cache.png')
```
# 1. Reducers
Reducer is an object used to compute statistics or perform aggregations. Reducers can aggregate data over time, space, bands, lists and other data structures in Earth Engine. Each reducer can take one or more input and generate one of more outputs.
[![View Presentation](images/gee_advanced/reducers.png){width="400px"}](https://docs.google.com/presentation/d/1l3C4p-mwYyDQaERn6QkixMavkKeSz8MzxK9et89ED2E/edit?usp=sharing){target="_blank"}
[View the Presentation ↗](https://docs.google.com/presentation/d/1l3C4p-mwYyDQaERn6QkixMavkKeSz8MzxK9et89ED2E/edit?usp=sharing){target="_blank"}
This module is also available as video.
[![Module 1: Reducers](images/gee_advanced/reducers_video.png){width="400px"}](https://vimeo.com/855669629){target="_blank"}
[Watch Video](https://vimeo.com/855669629){target="_blank"}
## 01. Combined Reducers
You can create a new reducer by combining multiple reducers. Combined reducers are useful to compute multiple statistics together. The resulting reducer is run in parallel and is highly efficient than running each reducer independently.
```{r echo=FALSE, fig.align='center', out.width='75%', fig.cap='Combined Reducers'}
knitr::include_graphics('images/gee_advanced/combined_reducers.png')
```
[Open in Code Editor ↗](https://code.earthengine.google.co.in/?scriptPath=users%2Fujavalgandhi%2FGEE-Advanced%3A01-Reducers%2F01b_Combined_Reducers_(complete)){target="_blank"}
```{js eval=FALSE, code=readLines('code/gee_advanced/01-Reducers/01b_Combined_Reducers_(complete)')}
```
## 02. Repeated Reducers
A reducer can be repeated multiple times to create a multi-input reducer. These are useful for computing the same statistics on different inputs.
```{r echo=FALSE, fig.align='center', out.width='75%', fig.cap='Repeated Reducers'}
knitr::include_graphics('images/gee_advanced/repeated_reducers.png')
```
[Open in Code Editor ↗](https://code.earthengine.google.co.in/?scriptPath=users%2Fujavalgandhi%2FGEE-Advanced%3A01-Reducers%2F02b_Repeated_Reducer_(complete)){target="_blank"}
```{js eval=FALSE, code=readLines('code/gee_advanced/01-Reducers/02b_Repeated_Reducer_(complete)')}
```
## 03. Grouped Reducers
You can group the output of a reducer by the value of a specified input. These are useful in computing grouped statistics (i.e. statistics by category).
```{r echo=FALSE, fig.align='center', out.width='75%', fig.cap='Grouped Reducers'}
knitr::include_graphics('images/gee_advanced/grouped_reducers.png')
```
[Open in Code Editor ↗](https://code.earthengine.google.co.in/?scriptPath=users%2Fujavalgandhi%2FGEE-Advanced%3A01-Reducers%2F03b_Grouped_Reducers_(complete)){target="_blank"}
```{js eval=FALSE, code=readLines('code/gee_advanced/01-Reducers/03b_Grouped_Reducers_(complete)')}
```
## 04. Weighted vs. Unweighted Reducers
Default calculations in Earth Engine uses weighted reducers. Weighted reducers account for fractional area of each pixel covered by the geometry. Unweighted reducers count pixels as whole if their centroid is covered by the geometry. You can choose to run any reducer in un-weighted mode using `.unweighted()`. Most software packages for remote sensing do not have support for weighted reducers, so Earth Engine users may choose to run their analysis un-weighted mode to verify and compare their results generated from other packages.
```{r echo=FALSE, fig.align='center', out.width='75%', fig.cap='Weighted vs. Unweighted Reducers'}
knitr::include_graphics('images/gee_advanced/weighted_vs_unweighted.png')
```
[Open in Code Editor ↗](https://code.earthengine.google.co.in/?scriptPath=users%2Fujavalgandhi%2FGEE-Advanced%3A01-Reducers%2F04b_Weighted_vs_Unweighted_Reducers_(complete)){target="_blank"}
```{js eval=FALSE, code=readLines('code/gee_advanced/01-Reducers/04b_Weighted_vs_Unweighted_Reducers_(complete)')}
```
## 05. Zonal Statistics - Vector
[Open in Code Editor ↗](https://code.earthengine.google.co.in/?scriptPath=users%2Fujavalgandhi%2FGEE-Advanced%3A01-Reducers%2F05b_Zonal_Statistics_Vector_(complete)){target="_blank"}
```{js eval=FALSE, code=readLines('code/gee_advanced/01-Reducers/05b_Zonal_Statistics_Vector_(complete)')}
```
## 06. Zonal Statistics - Raster
[Open in Code Editor ↗](https://code.earthengine.google.co.in/?scriptPath=users%2Fujavalgandhi%2FGEE-Advanced%3A01-Reducers%2F06b_Zonal_Statistics_Raster_(complete)){target="_blank"}
```{js eval=FALSE, code=readLines('code/gee_advanced/01-Reducers/06b_Zonal_Statistics_Raster_(complete)')}
```
# Joins
*Coming Soon...*
# Regressions
*Coming Soon...*
# Vector Data Processing and Visualization
*Coming Soon...*
----
# License
The course material (text, images, presentation, videos) is licensed under a [Creative Commons Attribution 4.0 International License](https://creativecommons.org/licenses/by/4.0/).
The code (scripts, Jupyter notebooks) is licensed under the MIT License. For a copy, see https://opensource.org/licenses/MIT
You are free to re-use and adapt the material but are required to give appropriate credit to the original author as below:
Copyright © 2023 Ujaval Gandhi [www.spatialthoughts.com](https://spatialthoughts.com)
# Citing and Referencing
You can cite the course materials as follows
* Gandhi, Ujaval, 2023. *Advanced Concepts in Google Earth Engine* course. Spatial Thoughts. https://courses.spatialthoughts.com/gee-advanced.html
***