generated from carpentries/workbench-template-rmd
-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
121 changed files
with
14,983 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
--- | ||
title: "Intro to Geospatial Raster Data with R" | ||
author: | ||
- "Claudiu Forgaci" | ||
- "Daniele Cannatella" | ||
format: | ||
revealjs: | ||
# logo: assets/img/TUDelft_logo_rgb.png | ||
# css: logo.css | ||
footer: "Data Carpentry for Geospatial Data" | ||
chalkboard: true | ||
incremental: true | ||
theme: [default, custom.scss] | ||
--- | ||
|
||
|
||
```{r} | ||
#| label: setup | ||
#| include: false | ||
knitr::opts_chunk$set( | ||
cache = FALSE, | ||
echo = TRUE, | ||
message = FALSE, | ||
warning = FALSE, | ||
error = FALSE | ||
) | ||
``` | ||
|
||
|
||
## Outline | ||
|
||
1. Intro to raster data: packages, metadata (CRS, resolution) | ||
2. Plotting raster data | ||
3. Reprojecting raster data | ||
4. Raster calculations | ||
5. Working with multi-band rasters | ||
|
||
|
||
## `raster` package for spatial raster data | ||
|
||
![](fig/tudlib-green.png){fig-align="center"} | ||
|
||
|
||
## Challenge 1: `r emo::ji("clock")` **2 mins** | ||
|
||
Use `GDALinfo()` to determine the following about the `tud-dsm-hill.tif` file: | ||
|
||
1. Does this file have the same CRS as `DSM_TUD`? | ||
2. What is resolution of the raster data? | ||
3. How large would a 5x5 pixel area be on the Earth’s surface? | ||
4. Is the file a multi- or single-band raster? | ||
|
||
``` {r} | ||
#| echo: false | ||
#| cache: false | ||
countdown::countdown(minutes = 2) | ||
``` | ||
|
||
|
||
|
||
## Challenge 2: `r emo::ji("clock")` **5 mins** | ||
|
||
Create a plot of the TU Delft Digital Surface Model (`DSM_TUD`) that has: | ||
|
||
1. Six classified ranges of values (break points) that are evenly divided among the range of pixel values. | ||
2. Axis labels. | ||
3. A plot title. | ||
|
||
``` {r} | ||
#| echo: false | ||
#| cache: false | ||
countdown::countdown(minutes = 5) | ||
``` | ||
|
||
|
||
|
||
## Challenge 3: `r emo::ji("clock")` **8 mins** | ||
|
||
Use the `tud-dtm.tif` and `tud-dtm-hill.tif` files from the `data` directory to create a Digital Terrain Model map of the TU Delft area. | ||
|
||
Make sure to: | ||
|
||
- include hillshade in the maps, | ||
- label axes, | ||
- include a title for each map, | ||
- experiment with various alpha values and color palettes to represent the data. | ||
|
||
``` {r} | ||
#| echo: false | ||
#| cache: false | ||
countdown::countdown(minutes = 8) | ||
``` | ||
|
||
## Challenge 4: `r emo::ji("clock")` **2 mins** | ||
|
||
View the CRS for each of these two datasets. What projection does each use? | ||
|
||
``` {r} | ||
#| echo: false | ||
#| cache: false | ||
countdown::countdown(minutes = 2) | ||
``` | ||
|
||
## Challenge 5: `r emo::ji("clock")` **5 mins** | ||
|
||
It’s often a good idea to explore the range of values in a raster dataset just like we might explore a dataset that we collected in the field. | ||
|
||
1. What is the min and maximum value for the Canopy Height Model `CHM_TUD` that we just created? | ||
2. What are two ways you can check this range of data for `CHM_TUD`? | ||
3. What is the distribution of all the pixel values in the CHM? | ||
4. Plot a histogram with 6 bins instead of the default and change the color of the histogram. | ||
5. Plot the `CHM_TUD` raster using breaks that make sense for the data. Include an appropriate color palette for the data, plot title and no axes ticks / labels. | ||
|
||
``` {r} | ||
#| echo: false | ||
#| cache: false | ||
countdown::countdown(minutes = 5) | ||
``` |
7 changes: 7 additions & 0 deletions
7
instructors/3-raster-slides_files/libs/clipboard/clipboard.min.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
144 changes: 144 additions & 0 deletions
144
instructors/3-raster-slides_files/libs/countdown-0.4.0/countdown.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
.countdown { | ||
background: inherit; | ||
position: absolute; | ||
cursor: pointer; | ||
font-size: 3rem; | ||
line-height: 1; | ||
border-color: #ddd; | ||
border-width: 3px; | ||
border-style: solid; | ||
border-radius: 15px; | ||
box-shadow: 0px 4px 10px 0px rgba(50, 50, 50, 0.4); | ||
-webkit-box-shadow: 0px 4px 10px 0px rgba(50, 50, 50, 0.4); | ||
margin: 0.6em; | ||
padding: 10px 15px; | ||
text-align: center; | ||
z-index: 10; | ||
-webkit-user-select: none; | ||
-moz-user-select: none; | ||
-ms-user-select: none; | ||
user-select: none; | ||
} | ||
.countdown { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
.countdown .countdown-time { | ||
background: none; | ||
font-size: 100%; | ||
padding: 0; | ||
} | ||
.countdown-digits { | ||
color: inherit; | ||
} | ||
.countdown.running { | ||
border-color: #2A9B59FF; | ||
background-color: #43AC6A; | ||
} | ||
.countdown.running .countdown-digits { | ||
color: #002F14FF; | ||
} | ||
.countdown.finished { | ||
border-color: #DE3000FF; | ||
background-color: #F04124; | ||
} | ||
.countdown.finished .countdown-digits { | ||
color: #4A0900FF; | ||
} | ||
.countdown.running.warning { | ||
border-color: #CEAC04FF; | ||
background-color: #E6C229; | ||
} | ||
.countdown.running.warning .countdown-digits { | ||
color: #3A2F02FF; | ||
} | ||
|
||
.countdown.running.blink-colon .countdown-digits.colon { | ||
opacity: 0.1; | ||
} | ||
|
||
/* ------ Controls ------ */ | ||
.countdown:not(.running) .countdown-controls { | ||
display: none; | ||
} | ||
|
||
.countdown-controls { | ||
position: absolute; | ||
top: -0.5rem; | ||
right: -0.5rem; | ||
left: -0.5rem; | ||
display: flex; | ||
justify-content: space-between; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
.countdown-controls > button { | ||
font-size: 1.5rem; | ||
width: 1rem; | ||
height: 1rem; | ||
display: inline-block; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
font-family: monospace; | ||
padding: 10px; | ||
margin: 0; | ||
background: inherit; | ||
border: 2px solid; | ||
border-radius: 100%; | ||
transition: 50ms transform ease-in-out, 150ms opacity ease-in; | ||
--countdown-transition-distance: 10px; | ||
} | ||
|
||
.countdown .countdown-controls > button:last-child { | ||
transform: translate(calc(-1 * var(--countdown-transition-distance)), var(--countdown-transition-distance)); | ||
opacity: 0; | ||
color: #002F14FF; | ||
background-color: #43AC6A; | ||
border-color: #2A9B59FF; | ||
} | ||
|
||
.countdown .countdown-controls > button:first-child { | ||
transform: translate(var(--countdown-transition-distance), var(--countdown-transition-distance)); | ||
opacity: 0; | ||
color: #4A0900FF; | ||
background-color: #F04124; | ||
border-color: #DE3000FF; | ||
} | ||
|
||
.countdown.running:hover .countdown-controls > button, | ||
.countdown.running:focus-within .countdown-controls > button{ | ||
transform: translate(0, 0); | ||
opacity: 1; | ||
} | ||
|
||
.countdown.running:hover .countdown-controls > button:hover, | ||
.countdown.running:focus-within .countdown-controls > button:hover{ | ||
transform: translate(0, calc(var(--countdown-transition-distance) / -2)); | ||
box-shadow: 0px 2px 5px 0px rgba(50, 50, 50, 0.4); | ||
-webkit-box-shadow: 0px 2px 5px 0px rgba(50, 50, 50, 0.4); | ||
} | ||
|
||
.countdown.running:hover .countdown-controls > button:active, | ||
.countdown.running:focus-within .countdown-controls > button:active{ | ||
transform: translate(0, calc(var(--coutndown-transition-distance) / -5)); | ||
} | ||
|
||
/* ----- Fullscreen ----- */ | ||
.countdown.countdown-fullscreen { | ||
z-index: 0; | ||
} | ||
|
||
.countdown-fullscreen.running .countdown-controls { | ||
top: 1rem; | ||
left: 0; | ||
right: 0; | ||
justify-content: center; | ||
} | ||
|
||
.countdown-fullscreen.running .countdown-controls > button + button { | ||
margin-left: 1rem; | ||
} |
Oops, something went wrong.