An open API service indexing awesome lists of open source software.

https://github.com/brownag/rgeomorphon

A lightweight implementation of the geomorphon terrain form classification algorithm of Jasiewicz and Stepinski (2013)
https://github.com/brownag/rgeomorphon

classification cpp elevation geomorphometry geomorphon r terrain

Last synced: about 21 hours ago
JSON representation

A lightweight implementation of the geomorphon terrain form classification algorithm of Jasiewicz and Stepinski (2013)

Awesome Lists containing this project

README

          

---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# rgeomorphon

[![CRAN version](https://www.r-pkg.org/badges/version/rgeomorphon)](https://CRAN.R-project.org/package=rgeomorphon)
[![CRAN status](https://badges.cranchecks.info/worst/rgeomorphon.svg)](https://cran.r-project.org/web/checks/check_results_rgeomorphon.html)
[![Development Version](https://brownag.r-universe.dev/badges/rgeomorphon)](https://brownag.r-universe.dev/)
[![R-CMD-check Build Status](https://github.com/brownag/rgeomorphon/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/brownag/rgeomorphon/actions)
[![rgeomorphon Manual](https://img.shields.io/badge/docs-HTML-informational)](https://humus.rocks/rgeomorphon/)

A lightweight implementation of the geomorphon terrain form classification
algorithm of [Jasiewicz and Stepinski (2013)](https://doi.org/10.1016/j.geomorph.2012.11.005)
based largely on the GRASS GIS [r.geomorphon](https://grass.osgeo.org/grass-stable/manuals/r.geomorphon.html)
module.

This implementation employs a novel algorithm written in C++ and {RcppParallel}.

For the sake of simplicity, some GRASS-specific implementation details have not
been added. See `?geomorphons` for details.

## Installation

You can install {rgeomorphon} from CRAN:

``` r
install.packages("rgeomorphon")
```

And you can install the development version from GitHub:

``` r
# install.packages("remotes")
remotes::install_github("brownag/rgeomorphon")
```

## Volcano Example

This is a basic example using the classic R `volcano` dataset and {terra}
SpatRaster object as input.

`volcano` is a 10m by 10m grid of elevation values from Maunga Whau in the
Auckland volcanic field of New Zealand.

```{r volcano}
library(terra)
library(rgeomorphon)

# PARAMETERS
SEARCH = 7 # outer search radius (cells)
SKIP = 0 # inner skip radius (cells)
FLAT = 1 # flat angle threshold (degrees)

## classic volcano elevation data
data("volcano", package = "datasets")

# construct and georeference a SpatRaster object
dem <- terra::flip(terra::rast(volcano))
terra::crs(dem) <- terra::crs("EPSG:27200")
terra::ext(dem) <- c(2667400, 2668010, 6478700, 6479570)
names(dem) <- "Elevation (meters)"

# calculate geomorphons "forms"
system.time({
rg <- geomorphons(
dem,
search = SEARCH,
skip = SKIP,
flat = FLAT
)
})

# inspect result
plot(c(dem, rg),
plg = list(x = "bottomleft",
bty = "o",
bg = "white"))
```

## Salton Sea Example

Now we will do a bathymetry example using the built in Salton Sea dataset (`salton`).

See `help("salton")` for details.

```{r salton}
library(terra)
library(rgeomorphon)

# PARAMETERS
SEARCH = 10 # outer search radius (cells)
SKIP = 3 # inner skip radius (cells)
FLAT = 0.1 # flat angle threshold (degrees)

# salton sea bathymetry sample data
data("salton", package = "rgeomorphon")

# construct and georeference a SpatRaster object
dem <- terra::rast(salton)
terra::crs(dem) <- attr(salton, "crs")
terra::ext(dem) <- attr(salton, "extent")
names(dem) <- "Elevation (feet)"

# calculate bathymorphons using 6-form system
system.time({
rg <- geomorphons(
dem,
search = SEARCH,
skip = SKIP,
flat = FLAT,
forms = "forms6"
)
})

# inspect result
plot(c(dem, rg),
plg = list(x = "bottomleft",
bty = "o",
bg = "white",
cex = 0.85))
```

# Citation

```{r}
citation("rgeomorphon")
```