Skip to content

Commit 383e8a2

Browse files
committed
differences for PR #444
1 parent 273f577 commit 383e8a2

9 files changed

+86
-41
lines changed

01-raster-structure.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ source: Rmd
66
---
77

88

9+
``` warning
10+
Warning in
11+
download.file("https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/physical/ne_110m_graticules_all.zip",
12+
: cannot open URL
13+
'https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/physical/ne_110m_graticules_all.zip':
14+
HTTP status was '500 Internal Server Error'
15+
```
16+
17+
``` error
18+
Error in download.file("https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/physical/ne_110m_graticules_all.zip", : cannot open URL 'https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/physical/ne_110m_graticules_all.zip'
19+
```
920

1021
::::::::::::::::::::::::::::::::::::::: objectives
1122

@@ -463,7 +474,7 @@ raster: surface elevation in meters for one time period.
463474

464475
A raster dataset can contain one or more bands. We can use the `rast()`
465476
function to import one single band from a single or multi-band raster. We can
466-
view the number of bands in a raster using the `nlyr()` function.
477+
view the number of bands in a raster using the `nly()` function.
467478

468479

469480
``` r
@@ -474,8 +485,11 @@ nlyr(DSM_HARV)
474485
[1] 1
475486
```
476487

477-
However, raster data can also be multi-band, meaning that one raster file contains data for more than one variable or time period for each cell.
478-
Jump to a later episode in this series for information on working with multi-band rasters:
488+
However, raster data can also be multi-band, meaning that one raster file
489+
contains data for more than one variable or time period for each cell. By
490+
default the `raster()` function only imports the first band in a raster
491+
regardless of whether it has one or more bands. Jump to a later episode in
492+
this series for information on working with multi-band rasters:
479493
[Work with Multi-band Rasters in R](05-raster-multi-band-in-r/).
480494

481495
## Dealing with Missing Data

02-raster-plot.md

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ source: Rmd
66
---
77

88

9+
``` warning
10+
Warning in
11+
download.file("https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/physical/ne_110m_graticules_all.zip",
12+
: cannot open URL
13+
'https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/physical/ne_110m_graticules_all.zip':
14+
HTTP status was '500 Internal Server Error'
15+
```
16+
17+
``` error
18+
Error in download.file("https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/physical/ne_110m_graticules_all.zip", : cannot open URL 'https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/physical/ne_110m_graticules_all.zip'
19+
```
920

1021
::::::::::::::::::::::::::::::::::::::: objectives
1122

@@ -79,19 +90,24 @@ unique(DSM_HARV_df$fct_elevation)
7990
Levels: (305,342] (342,379] (379,416]
8091
```
8192

82-
And we can get the count of values in each group using `dplyr`'s `count()` function:
93+
And we can get the count of values in each group using `dplyr`'s `group_by()`
94+
and `count()` functions:
8395

8496

8597
``` r
8698
DSM_HARV_df %>%
87-
count(fct_elevation)
99+
group_by(fct_elevation) %>%
100+
count()
88101
```
89102

90103
``` output
104+
# A tibble: 3 × 2
105+
# Groups: fct_elevation [3]
91106
fct_elevation n
92-
1 (305,342] 418891
93-
2 (342,379] 1530073
94-
3 (379,416] 370835
107+
<fct> <int>
108+
1 (305,342] 418891
109+
2 (342,379] 1530073
110+
3 (379,416] 370835
95111
```
96112

97113
We might prefer to customize the cutoff values for these groups.
@@ -143,14 +159,18 @@ And we can get the count of values in each group in the same way we did before:
143159

144160
``` r
145161
DSM_HARV_df %>%
146-
count(fct_elevation_2)
162+
group_by(fct_elevation_2) %>%
163+
count()
147164
```
148165

149166
``` output
167+
# A tibble: 3 × 2
168+
# Groups: fct_elevation_2 [3]
150169
fct_elevation_2 n
151-
1 (300,350] 741815
152-
2 (350,400] 1567316
153-
3 (400,450] 10668
170+
<fct> <int>
171+
1 (300,350] 741815
172+
2 (350,400] 1567316
173+
3 (400,450] 10668
154174
```
155175

156176
We can use those groups to plot our raster data, with each group being a

05-raster-multi-band-in-r.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ source: Rmd
66
---
77

88

9+
``` warning
10+
Warning in
11+
download.file("https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/physical/ne_110m_graticules_all.zip",
12+
: cannot open URL
13+
'https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/physical/ne_110m_graticules_all.zip':
14+
HTTP status was '500 Internal Server Error'
15+
```
16+
17+
``` error
18+
Error in download.file("https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/physical/ne_110m_graticules_all.zip", : cannot open URL 'https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/physical/ne_110m_graticules_all.zip'
19+
```
920

1021
::::::::::::::::::::::::::::::::::::::: objectives
1122

@@ -49,7 +60,7 @@ Each RGB image is a 3-band raster. The same steps would apply to working with a
4960
multi-spectral image with 4 or more bands - like Landsat imagery.
5061

5162
By using the `rast()` function along with the `lyrs` parameter, we can read
52-
specific raster bands (i.e. the first one); omitting this parameter would read
63+
specific raster bands (i.e. the first one); omitting this parater would read
5364
instead all bands.
5465

5566

@@ -364,7 +375,7 @@ well between 0 and 255.
364375
Let's explore what happens with NoData values when working with RasterStack
365376
objects and using the `plotRGB()` function. We will use the
366377
`HARV_Ortho_wNA.tif` GeoTIFF file in the
367-
`NEON-DS-Airborne-Remote-Sensing/HARVRGB_Imagery/` directory.
378+
`NEON-DS-Airborne-Remote-Sensing/HARV/RGB_Imagery/` directory.
368379

369380
1. View the files attributes. Are there `NoData` values assigned for this file?
370381
2. If so, what is the `NoData` Value?

fig/dc-spatial-raster/GreennessOverTime.jpg

100755100644
File mode changed.

fig/dc-spatial-raster/RGBSTack_1.jpg

100755100644
File mode changed.

fig/dc-spatial-raster/UTM_zones_18-19.jpg

100755100644
File mode changed.

fig/dc-spatial-raster/spatial_extent.png

100755100644
File mode changed.

md5sum.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
"about.md" "2ae9402fd9f37560bd85430a98bf4847" "site/built/about.md" "2024-06-04"
55
"config.yaml" "8f4c7a49b9d32beef686bcd8ae3e4c5f" "site/built/config.yaml" "2024-06-04"
66
"index.md" "8704017272467874007912c316744a00" "site/built/index.md" "2024-06-04"
7-
"episodes/01-raster-structure.Rmd" "fd0024d668eb41109e4761a558c3d855" "site/built/01-raster-structure.md" "2024-06-15"
8-
"episodes/02-raster-plot.Rmd" "5de487340aa50257089b12295059018b" "site/built/02-raster-plot.md" "2024-06-15"
7+
"episodes/01-raster-structure.Rmd" "c819b6903d870befad6add128c4f9274" "site/built/01-raster-structure.md" "2024-06-15"
8+
"episodes/02-raster-plot.Rmd" "3bc30659ae4d91c31a1175ff7127531a" "site/built/02-raster-plot.md" "2024-06-15"
99
"episodes/03-raster-reproject-in-r.Rmd" "d11ff839db427f11b0f0d5e8f7825c80" "site/built/03-raster-reproject-in-r.md" "2024-06-04"
1010
"episodes/04-raster-calculations-in-r.Rmd" "a100233c7c80bcae34c0112d10980d0d" "site/built/04-raster-calculations-in-r.md" "2024-06-04"
11-
"episodes/05-raster-multi-band-in-r.Rmd" "ed98c238c11fbe7706bf924813f17d20" "site/built/05-raster-multi-band-in-r.md" "2024-06-15"
11+
"episodes/05-raster-multi-band-in-r.Rmd" "575875af5ca9a106473a84c1fc41804d" "site/built/05-raster-multi-band-in-r.md" "2024-06-15"
1212
"episodes/06-vector-open-shapefile-in-r.Rmd" "9966d5678aea06e445f5b660a079482e" "site/built/06-vector-open-shapefile-in-r.md" "2024-06-04"
1313
"episodes/07-vector-shapefile-attributes-in-r.Rmd" "726f78cdabe6ebe90a609b31127674ca" "site/built/07-vector-shapefile-attributes-in-r.md" "2024-06-04"
1414
"episodes/08-vector-plot-shapefiles-custom-legend.Rmd" "733bf768d8f27d9c7e548e7f835fda67" "site/built/08-vector-plot-shapefiles-custom-legend.md" "2024-06-04"

setup.R

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,43 @@ options(timeout = max(300, getOption('timeout')))
22
## file structure
33

44
if (! file.exists("data/NEON-DS-Site-Layout-Files")) {
5-
dest <- tempfile()
6-
download.file("https://ndownloader.figshare.com/files/3708751", dest,
7-
mode = "wb")
8-
unzip(dest, exdir = "data")
5+
dest <- tempfile()
6+
download.file("https://ndownloader.figshare.com/files/3708751", dest,
7+
mode = "wb")
8+
unzip(dest, exdir = "data")
99
}
1010

1111
if (! file.exists("data/NEON-DS-Airborne-Remote-Sensing")) {
12-
dest <- tempfile()
13-
download.file("https://ndownloader.figshare.com/files/3701578", dest,
14-
mode = "wb")
15-
unzip(dest, exdir = "data")
12+
dest <- tempfile()
13+
download.file("https://ndownloader.figshare.com/files/3701578", dest,
14+
mode = "wb")
15+
unzip(dest, exdir = "data")
1616
}
1717

1818
if (! file.exists("data/NEON-DS-Met-Time-Series")) {
19-
dest <- tempfile()
20-
download.file("https://ndownloader.figshare.com/files/3701572", dest,
21-
mode = "wb")
22-
unzip(dest, exdir = "data")
19+
dest <- tempfile()
20+
download.file("https://ndownloader.figshare.com/files/3701572", dest,
21+
mode = "wb")
22+
unzip(dest, exdir = "data")
2323
}
2424

2525
if (! file.exists("data/NEON-DS-Landsat-NDVI")) {
26-
dest <- tempfile()
27-
download.file("https://ndownloader.figshare.com/files/4933582", dest,
28-
mode = "wb")
29-
unzip(dest, exdir = "data")
26+
dest <- tempfile()
27+
download.file("https://ndownloader.figshare.com/files/4933582", dest,
28+
mode = "wb")
29+
unzip(dest, exdir = "data")
3030
}
3131

3232
if (! file.exists("data/Global/Boundaries/ne_110m_graticules_all")) {
33-
dest <- tempfile()
34-
download.file("https://naciscdn.org/naturalearth/110m/physical/ne_110m_graticules_all.zip",
35-
dest, mode = "wb")
36-
unzip(dest, exdir = "data/Global/Boundaries/ne_110m_graticules_all")
33+
dest <- tempfile()
34+
download.file("https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/physical/ne_110m_graticules_all.zip",
35+
dest, mode = "wb")
36+
unzip(dest, exdir = "data/Global/Boundaries/ne_110m_graticules_all")
3737
}
3838

3939
if (! file.exists("data/Global/Boundaries/ne_110m_land")) {
40-
dest <- tempfile()
41-
download.file("https://naciscdn.org/naturalearth/110m/physical/ne_110m_land.zip",
42-
dest, mode = "wb")
43-
unzip(dest, exdir = "data/Global/Boundaries/ne_110m_land")
40+
dest <- tempfile()
41+
download.file("https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/physical/ne_110m_land.zip",
42+
dest, mode = "wb")
43+
unzip(dest, exdir = "data/Global/Boundaries/ne_110m_land")
4444
}

0 commit comments

Comments
 (0)