Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@

### Lesson Maintainers:

- [Jemma Stachelek][stachelek_jemma]
- [Ivo Arrey][arreyves]
- [Jon Jablonski][jonjab]
- Drake Asberry
- [Braden Owsley][owsleybc]

[stachelek_jemma]: https://carpentries.org/instructors/#jsta
[arreyves]: https://carpentries.org/instructors/#arreyves
[jonjab]: https://carpentries.org/instructors/#jonjab
[owsleybc]: https://carpentries.org/instructors/#owsleybc
37 changes: 31 additions & 6 deletions episodes/04-raster-calculations-in-r.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ DTM_HARV <-

DTM_HARV_df <- as.data.frame(DTM_HARV, xy = TRUE)

# DSM data for SJER
# DSM (treetop) data for SJER
DSM_SJER <-
rast("data/NEON-DS-Airborne-Remote-Sensing/SJER/DSM/SJER_dsmCrop.tif")

DSM_SJER_df <- as.data.frame(DSM_SJER, xy = TRUE)

# DTM data for SJER
# DTM (bare-earth) data for SJER
DTM_SJER <-
rast("data/NEON-DS-Airborne-Remote-Sensing/SJER/DTM/SJER_dtmCrop.tif")

Expand All @@ -64,6 +64,35 @@ See the [lesson homepage](.) for detailed information about the software,
data, and other prerequisites you will need to work through the examples in
this episode.

### Load the Data

For this episode, we will use the DTM and DSM from the NEON Harvard Forest
Field site and San Joaquin Experimental Range. If you don't still have
them loaded, do so now and turn them into dataframes:

# DSM (tree top) data for Harvard Forest
DSM_HARV <-
rast("data/NEON-DS-Airborne-Remote-Sensing/HARV/DSM/HARV_dsmCrop.tif")

DSM_HARV_df <- as.data.frame(DSM_HARV, xy = TRUE)

# DTM (bare earth) data for Harvard Forest
DTM_HARV <-
rast("data/NEON-DS-Airborne-Remote-Sensing/HARV/DTM/HARV_dtmCrop.tif")

DTM_HARV_df <- as.data.frame(DTM_HARV, xy = TRUE)

# DSM data for SJER
DSM_SJER <-
rast("data/NEON-DS-Airborne-Remote-Sensing/SJER/DSM/SJER_dsmCrop.tif")

DSM_SJER_df <- as.data.frame(DSM_SJER, xy = TRUE)

# DTM data for SJER
DTM_SJER <-
rast("data/NEON-DS-Airborne-Remote-Sensing/SJER/DTM/SJER_dtmCrop.tif")

DTM_SJER_df <- as.data.frame(DTM_SJER, xy = TRUE)

::::::::::::::::::::::::::::::::::::::::::::::::::

Expand Down Expand Up @@ -95,11 +124,7 @@ with the influence of ground elevation removed.

::::::::::::::::::::::::::::::::::::::::::::::::::

### Load the Data

For this episode, we will use the DTM and DSM from the NEON Harvard Forest
Field site and San Joaquin Experimental Range, which we already have loaded
from previous episodes.

::::::::::::::::::::::::::::::::::::::: challenge

Expand Down
51 changes: 5 additions & 46 deletions episodes/05-raster-multi-band-in-r.Rmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Work with Multi-Band Rasters
teaching: 40
exercises: 20
teaching: 30
exercises: 15
source: Rmd
---

Expand Down Expand Up @@ -77,6 +77,8 @@ ggplot() +
coord_quickmap()
```

To import the green band, we would use `lyrs = 2`.

::::::::::::::::::::::::::::::::::::::: challenge

## Challenge
Expand Down Expand Up @@ -124,51 +126,8 @@ represent pixels with less red in them (less red was reflected). To plot an RGB
image, we mix red + green + blue values into one single color to create a full
color image - similar to the color image a digital camera creates.

### Import A Specific Band

We can use the `rast()` function to import specific bands in our raster object
by specifying which band we want with `lyrs = N` (N represents the band number we
want to work with). To import the green band, we would use `lyrs = 2`.

```{r read-specific-band}
RGB_band2_HARV <-
rast("data/NEON-DS-Airborne-Remote-Sensing/HARV/RGB_Imagery/HARV_RGB_Ortho.tif",
lyrs = 2)
```

We can convert this data to a data frame and plot the same way we plotted the red band:

```{r}
RGB_band2_HARV_df <- as.data.frame(RGB_band2_HARV, xy = TRUE)
```


```{r rgb-harv-band2}
ggplot() +
geom_raster(data = RGB_band2_HARV_df,
aes(x = x, y = y, alpha = HARV_RGB_Ortho_2)) +
coord_equal()
```

::::::::::::::::::::::::::::::::::::::: challenge

## Challenge: Making Sense of Single Band Images

Compare the plots of band 1 (red) and band 2 (green). Is the forested area
darker or lighter in band 2 (the green band) compared to band 1 (the red band)?

::::::::::::::: solution

## Solution

We'd expect a *brighter* value for the forest in band 2 (green) than in band 1
(red) because the leaves on trees of most often appear "green" - healthy leaves
reflect MORE green light than red light.



:::::::::::::::::::::::::

::::::::::::::::::::::::::::::::::::::::::::::::::

## Raster Stacks in R

Expand Down
Loading