Skip to content

Commit

Permalink
Merge pull request #21 from adamlilith/upgrade_to_grass78
Browse files Browse the repository at this point in the history
Upgrade to grass78
  • Loading branch information
Adam B. Smith authored Oct 7, 2020
2 parents ce0cdcf + a6e3d57 commit da6c4b3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This package uses the stand-alone installer of Open Source Geospatial's [GRASS G
To use **fasterRaster** Version 7.8 of GRASS must be installed on the local system you are using.

To install `fasterRaster` and its dependencies, just do the following:
`remotes::install_github('adamlilith/fasterRaster')`
`remotes::install_github('adamlilith/fasterRaster', dependencies=TRUE)`

NB: If for some reason this command does not work, you can install the package by downloading the latest zip/tar file from the `zipTarFiles` directory and installing the package manually.

Expand Down Expand Up @@ -65,15 +65,15 @@ That was easy enough. Under the hood, many of the `faster` functions are:

Note that you really probably aren't interested in steps 1 and 4, but they create a computing overhead. Thus, it is possible to chain operations together so that they use the same GRASS session by keeping the rasters/vectors in GRASS and then exporting them when you need them in the end.

Here's an example in which we'll chain the `fasterVectToRastDistance` and `fasterQuantile` functions together. The latter will return
Here's an example in which we'll chain the `fasterVectToRastDistance` and `fasterQuantile` functions together.

`distToRiver <- fasterVectToRastDistance(madForest2000, madRivers, grassDir=grassDir, grassToR=FALSE, outGrassName='distToVect')`
`quants <- fasterQuantile('distToVect', probs=c(0.05, 0.5, 0.95), grassDir=grassDir, alreadyInGrass=TRUE)`
`quants`

This was faster because we told `fasterVectToRastDistance` *not* to export the raster to **R**. We then told `fasterQuantile` to look in the current GRASS session and use the raster named `distToVect`.
The first function imports the raster and vector, does its calculations, but does not export the output raster to R. Rather, the output raster stays in the GRASS session and is named `distToVect`. In the second function we set the argument `alreadyInGrass` to `TRUE` so it knows the raster is already in GRASS, and we tell it to use `distToVect` so it know under what name to find the raster.

You can see that by chaining a series of `faster~` functions together, the process can be made faster because all of the operations are done in GRASS with less back-and-forth between GRASS and R. The one exception to this is that some **faster~** functions do not use GRASS (e.g., `fasterFragmentation`, `fasterFocal`, and `fasterCalc`), so you can't use this trick.
You can see that by chaining a series of `faster~` functions together, the process can be made faster because all of the operations are done in GRASS with less back-and-forth between GRASS and R. The one exception to this is that some `faster~` functions do not use GRASS (e.g., `fasterFragmentation`, `fasterFocal`, and `fasterCalc`), so you can't use this trick.

### The generic *faster* function ###
The `faster` function is a generic wrapper for GRASS modules. You can use it to call many of the modules in GRASS. It may not always work, but it simplifies the task of initiating a GRASS instance, importing the raster/vector, and executing the call:
Expand Down
Binary file added images/fasterRaster.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/images.pptx
Binary file not shown.

0 comments on commit da6c4b3

Please sign in to comment.