Skip to content

Commit

Permalink
Fix multi- typos
Browse files Browse the repository at this point in the history
  • Loading branch information
Robinlovelace committed Sep 30, 2024
1 parent 0d0a600 commit 31807ba
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions 08-read-write-plot.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,15 @@ It is fast and flexible, but it may be worth looking at other packages such as *
### Raster data {#raster-data-read}

\index{raster!data input}
Similar to vector data, raster data comes in many file formats with some supporting multi-layerfiles.
Similar to vector data, raster data comes in many file formats with some supporting multi-layer files.
**terra**'s `rast()` command reads in a single layer when a file with just one layer is provided.

```{r 07-read-write-plot-24, message=FALSE}
raster_filepath = system.file("raster/srtm.tif", package = "spDataLarge")
single_layer = rast(raster_filepath)
```

It also works in case you want to read a multi-layerfile.
It also works in case you want to read a multi-layer file.

```{r 07-read-write-plot-25}
multilayer_filepath = system.file("raster/landsat.tif", package = "spDataLarge")
Expand Down Expand Up @@ -519,7 +519,7 @@ usa_sf = ne_countries(country = "United States of America", returnclass = "sf")
Country borders can be also accessed with other packages, such as **geodata**, **giscoR**, or **rgeoboundaries**.

A second example downloads a series of rasters containing global monthly precipitation sums with spatial resolution of 10 minutes (~18.5 km at the equator) using the **geodata** package [@R-geodata].
The result is a multi-layerobject of class `SpatRaster`.
The result is a multi-layer object of class `SpatRaster`.

```{r 07-read-write-plot-5, eval=FALSE}
library(geodata)
Expand Down
6 changes: 3 additions & 3 deletions 15-eco.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ ep = qgisprocess::qgis_run_algorithm(
```

This returns a list named `ep` containing the paths to the computed output rasters.
Let's read in catchment area as well as catchment slope into a multi-layer`SpatRaster` object (see Section \@ref(raster-classes)).
Let's read in catchment area as well as catchment slope into a multi-layer `SpatRaster` object (see Section \@ref(raster-classes)).
Additionally, we will add two more raster objects to it, namely `dem` and `ndvi`.

```{r 15-eco-7, eval=FALSE}
Expand All @@ -191,7 +191,7 @@ ep = ep[c("AREA", "SLOPE")] |>
rast()
names(ep) = c("carea", "cslope") # assign better names
origin(ep) = origin(dem) # make sure rasters have the same origin
ep = c(dem, ndvi, ep) # add dem and ndvi to the multi-layerSpatRaster object
ep = c(dem, ndvi, ep) # add dem and ndvi to the multi-layer SpatRaster object
```

Additionally, the catchment area\index{catchment area} values are highly skewed to the right (`hist(ep$carea)`).
Expand Down Expand Up @@ -534,7 +534,7 @@ autotuner_rf$predict(task)
```

The `predict` method will apply the model to all observations used in the modeling.
Given a multi-layer`SpatRaster` containing rasters named as the predictors used in the modeling, `terra::predict()` will also make spatial distribution maps, i.e., predict to new data.
Given a multi-layer `SpatRaster` containing rasters named as the predictors used in the modeling, `terra::predict()` will also make spatial distribution maps, i.e., predict to new data.

```{r 15-eco-28, cache=TRUE, cache.lazy=FALSE, eval=FALSE}
pred = terra::predict(ep, model = autotuner_rf, fun = predict)
Expand Down
2 changes: 1 addition & 1 deletion _15-ex.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ ep = ep[c("AREA", "SLOPE")] |>
names(ep) = c("carea", "cslope")
# make sure all rasters share the same origin
origin(ep) = origin(dem)
# add dem and ndvi to the multi-layerSpatRaster object
# add dem and ndvi to the multi-layer SpatRaster object
ep = c(dem, ndvi, ep)
ep$carea = log10(ep$carea)
Expand Down
2 changes: 1 addition & 1 deletion code/chapters/15-eco.R
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ knitr::include_graphics("images/15_sa_mongon_sampling.png")
## terra::rast()
## names(ep) = c("carea", "cslope") # assign proper names
## terra::origin(ep) = terra::origin(dem) # make sure rasters have the same origin
## ep = c(dem, ndvi, ep) # add dem and ndvi to the multi-layerSpatRaster object
## ep = c(dem, ndvi, ep) # add dem and ndvi to the multi-layer SpatRaster object


## ----15-eco-8, eval=FALSE---------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion code/chapters/_15-ex.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ ep = ep[c("AREA", "SLOPE")] |>
names(ep) = c("carea", "cslope")
# make sure all rasters share the same origin
origin(ep) = origin(dem)
# add dem and ndvi to the multi-layerSpatRaster object
# add dem and ndvi to the multi-layer SpatRaster object
ep = c(dem, ndvi, ep)
ep$carea = log10(ep$carea)

Expand Down

0 comments on commit 31807ba

Please sign in to comment.