Repository navigation
Expand file tree
/
Copy pathGeoScripting_Concept_Intro.Rmd
More file actions
295 lines (207 loc) · 9.87 KB
/
Copy pathGeoScripting_Concept_Intro.Rmd
File metadata and controls
295 lines (207 loc) · 9.87 KB
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
---
title: "Geoscripting course introduction"
author: "Dainius Masiliūnas"
date: "`r format(Sys.time(), '%Y-%m-%d')`"
output:
ioslides_presentation: default
#beamer_presentation: default
urlcolor: blue
---
## What comes to mind when you think of Geoscripting?
Answer on Wooclap in the link in the chat!
## Did you know?!
Scripting can be used to process satellite data easily to monitor deforestation globally
- Google Earth Engine for global deforestation monitoring
- https://earthengine.google.org/#intro
{width=50%}
Image Credit: NASA Goddard, based on data from Hansen et al., 2013.
## Why geoscripting?

## Why geoscripting?
- Reproducible: you keep track of what you have done
- Efficient: you can write a script to do something and repeat your analysis x1000...
- Good for finding errors
Can you think of other advantages?
## Why geoscripting?
- Enable collaboration
- a huge social R and Python community

## Why geoscripting?
- Build your own tools and functions (e.g. automated web-processing, etc.)
{width=30%}
[See demos on the course website!](https://geoscripting-wur.github.io/Scripting4Geo/#why-scripting)
## What is a scripting (interpreted) language?
## What is a scripting language?
- A scripting language can interpret and automate the execution of tasks, instead of clicking!!!
- A scripting language is the glue, between different commands, functions, and objectives without the need to compile it for each OS (e.g. windows)
- This is different from a compiled language like C/C++/Fortran
- these are languages that need to compile the whole program/app first.
## Compiling
Passing the source code through a compiler, which translates the `high-level language` instructions into an `exe`.
```{r, echo=FALSE, fig.align='center', fig.width=6, strip.white=TRUE}
library(png)
library(grid)
img <- readPNG("figs/traditionalCompiler.png")
grid.raster(img)
```
## The main scripting languages for GIS and Remote sensing currently are:
- R
- Python
- Julia
- GRASS (functions are also included in QGIS)
- JavaScript (geoweb scripting)
- Matlab
- IDL (ENVI)
- ...
## Python versus R
- Python is a general purpose programming language, stronger in deep learning
- R is easier to use and is particularly strong in statistical computing and visualisation
- Syntactic differences between R and Python can be confusing
- There are many R and Python packages for spatial analyses

## R packages

## Many programs have support for Python & R
e.g.:
- QGIS
- GRASS
- PostGIS
<!--
## ...Cliffhanger!
How will you learn about all that in the course? Find out after this 5-minute break!
{width=70%}
-->
## The Geoscripting course
Goal:
- Scripting to solve spatial challenges!
- **Learn by doing**
- **Learn how to keep on learning**
A team of `R` & `Python` experts who use geo-scripting languages
every day helped to develop this course
## Who are we?
- Course coordinator: Dainius Masiliūnas
- Lecturers: Arno Timmer, Erick Chacon Montalvan
- Teaching assistants (PhD): Paolo Dal Lago, Tijmen Remijnse, Anne-Juul Welsink, Sriram Jallu
- Teaching assistants (MSc): Roos Breukel, Tomer Peled, Susanna van de Wetering
- Guest presenters: See course guide
## Geoscripting learning objectives
- Demonstrate scripting skills by writing clear, documented, and reproducible scripts to read, write and visualise spatial data
- Apply version control supporting effective collaboration in a team
- Use documentation, online tools, and contribute to discussion platforms with reproducible examples as an aid to solve scripting challenges effectively
- Be willing to use and create open-source software with an appropriate software license
- Combine functions from novel libraries to efficiently process spatial data
- Create an integrated software project that solves a spatial challenge
## How will we learn all that?
{width=70%}
<!-- Uncomment below for PDF, above for HTML
-->
## Course concept
Flipped Classroom concept:

* You will follow tutorials on your own, no lectures
* We will discuss how you managed to do exercises in class
* Experts from companies, research institutes and
university will give inspiration talks on how they use scripting in their work
## Deliverables
* Practice exercises: in pairs, not graded, but peer reviewed; assignments and exam are very similar, so good practice!
* Graded assignments: in pairs, graded (**20%**) and peer reviewed; peer review is graded too!
* Exam: individual assignment, graded (**30%**), **not** peer reviewed but receive feedback from autotests, mostly practice.
* Final project: in groups of four, graded (**50%**) and peer reviewed.
* Choose a geoscripting topic feasible within 7 half-days
## AI Traffic Light {.columns-2}
{width=100%}
<p class="forceBreak"></p>
Yellow – Restricted Use
* Students may use generative AI as a supplement or companion for writing or creating content with clear attribution, but human authorship must be primary by rewriting AI-generated text and code actively, and editing AI-generated images.
* WUR resources on Generative AI:
* {width=30%}
## Team work: set up teams of two
- Log into GitLab: [https://git.wur.nl](https://git.wur.nl)
- On https://brightspace.wur.nl > Deliverables > Practice exercises > Exercise 1 check your group and its name
- If you don't have a team member, join an existing group with one person, if none, create a new group and join it
- We will merge two groups of two for project work, but you will be allowed to change groups at that point
<div class="centered">

</div>
## Heeelp!
Confused?! Brightspace is your support hub!
- Check the course guide and other linked information. Offline support will be provided on Brightspace discussion forum.
- Use Microsoft Teams (https://teams.microsoft.com) for live support:
- Support in the Support channel! Or raising your hand in class.
- Find your teammate by messaging them in Teams! You can also create a new channel to interact with your teammate.
- Share your memes in the Other Discussion channel!
## What we will do next
* Today:
* 14:00 - 14:45: this presentation
* 15:00 - 15:30: Software licenses (Andrei Mirt)
* 15:45 - 17:15: Self-study ([geoscripting-wur.github.io](https://geoscripting-wur.github.io))
* Tomorrow:
* 14:00 - **17:15**: Use git to submit your thoughts on what you would like to work on during the course
* 16:00 - 16:30: Demo on how to use CodeGrade
* Wednesday:
* 15:50 - 16:35: Discussion about the first exercise
* 16:50 - 17:20: Presentation about Git
* Rest of the day: self-study Bash tutorial, finish peer review of the previous exercise by the end of the day
Deadlines are always **hard**!
## Learning outcomes of the rest of today and tomorrow:
- Getting started with Linux, Git version control
- Tomorrow: submit an exercise using Git!
- Think of what you would like to learn during the course and potential project topics
## Exercises
* Starter material will be made available for each group/person on GitLab: [https://git.wur.nl/geoscripting-2026](https://git.wur.nl/geoscripting-2026).
* Every change in your starter is automatically submitted to Brightspace (CodeGrade), rubrics and automatic feedback is available there.
## Peer review
- When you do peer review, check the exercise of the day on Brightspace.
- You get access to the solution of the teams you are supposed to review.
- Review according to the rubric on Brightspace (CodeGrade) and the exercise/assignment description.
- You can use in-line comments and general comments.
- Don't review the review.
- In upcoming exercises, reproducibility is a prerequisite!
## Course schedule
See detailed schedule at https://te.wur.nl:
* Every second day: an exercise ("Tutorial" on TimeEdit)
* The next day: dicussion session about the exercise, guest presentation ("Lecture"), exercise peer review and reading the tutorial ("Tutorial")
* After R and Python content: assignments ("Practical")
* Project weeks ("Group work") and final presentations ("Lecture")
## Questions?
## Summary
* Geoscripting is an essential skill in research, as well as highly sought-after in the industry
* Scripting saves you time in the long run
* Geoscripting is an intensive, half-day course where you learn best by doing
* Deliverables are all practice, little theory!
* Mind the deadlines, and don't forget to review others!
<!--- What is a "reproducible script"?
## Reproducibility
-->
<!--
```{r, fig.align='center', echo=FALSE, message=FALSE, eval=FALSE}
if (!file.exists(fn <- "figs/worldcloudRpackage.png")) {
fn <- "figs/worldcloudRpackage.png"
require(XML)
require(tm)
require(wordcloud)
require(RColorBrewer)
u = "http://cran.r-project.org/web/packages/available_packages_by_date.html"
t = readHTMLTable(u)[[1]]
cdf = data.frame(text=as.character(t[,3]))
cdf$doc_id = 1:nrow(cdf)
ap.corpus <- Corpus(DataframeSource(cdf))
ap.corpus <- tm_map(ap.corpus, removePunctuation)
# ap.corpus <- tm_map(ap.corpus, tolower)
# txt.corpus <- tm_map(txt.corpus, tolower)
# must be changed to
ap.corpus <- tm_map(ap.corpus, content_transformer(tolower))
ap.corpus <- tm_map(ap.corpus, function(x) removeWords(x, stopwords("english")))
ap.tdm <- TermDocumentMatrix(ap.corpus)
ap.m <- as.matrix(ap.tdm)
ap.v <- sort(rowSums(ap.m),decreasing=TRUE)
ap.d <- data.frame(word = names(ap.v),freq=ap.v)
table(ap.d$freq)
pal2 <- brewer.pal(8,"Dark2")
png(fn, width=1280, height=800)
wordcloud(ap.d$word,ap.d$freq, scale=c(8,.2),min.freq=3,
max.words=Inf, random.order=FALSE, rot.per=.15, colors=pal2)
dev.off()
}
```
-->