https://github.com/atsyplenkov/wbw

Whitebox Workflows for R

https://github.com/atsyplenkov/wbw

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.9%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Whitebox Workflows for R

Basic Info
  • Host: GitHub
  • Owner: atsyplenkov
  • License: other
  • Language: R
  • Default Branch: main
  • Homepage: https://wbw.anatolii.nz
  • Size: 10.3 MB
Statistics
  • Stars: 31
  • Watchers: 1
  • Forks: 3
  • Open Issues: 3
  • Releases: 0
Created over 1 year ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog Contributing License

README.md

Whitebox Workflows for R {wbw}

Project Status: WIP – Initial development is in progress, but there
has not yet been a stable, usable release suitable for the
public. WBW
Functions R-CMD-check Codecov test
coverage GitHub last
commit <!-- badges: end -->


FAQTutorialsBenchmarksInstallation

[!NOTE] {wbw} is currently in alpha. Expect breaking changes both in the API and in outputs.

The {wbw} package provides R bindings for the Whitebox Workflows for Python — a powerful and fast library for advanced geoprocessing, with focus on hydrological, geomorphometric and remote sensing analysis of raster, vector and LiDAR data.

Basic workflow

The {wbw} R package introduces several new S7 classes, including WhiteboxRaster and WhiteboxVector which serves as a bridge between Python and R.

``` r library(wbw)

rasterpath <- system.file("extdata/dem.tif", package = "wbw") dem <- wbwreadraster(rasterpath) dem

> +------------------------------------------+

> | WhiteboxRaster |

> | dem.tif |

> |..........................................|

> | bands : 1 |

> | dimensions : 726, 800 (nrow, ncol) |

> | resolution : 5.002392, 5.000243 (x, y) |

> | EPSG : 2193 (Linear_Meter) |

> | min value : 63.698193 |

> | max value : 361.020721 |

> +------------------------------------------+

```

The true power of {wbw} unleashes when there’s a need to run several operations sequentially, i.e., in a pipeline. Unlike the original Whitebox Tools, WbW stores files in memory, reducing the amount of intermediate I/O operations.

For example, a DEM can be smoothed (or filtered), and then the slope can be estimated as follows:

``` r dem |> wbwmeanfilter() |> wbw_slope(units = "d")

> +------------------------------------------+

> | WhiteboxRaster |

> | Slope (degrees) |

> |..........................................|

> | bands : 1 |

> | dimensions : 726, 800 (nrow, ncol) |

> | resolution : 5.002392, 5.000243 (x, y) |

> | EPSG : 2193 (Linear_Meter) |

> | min value : 0.005972 |

> | max value : 50.069439 |

> +------------------------------------------+

```

Yet Another RSpatial Package? Why?

The above example may remind you of the {terra} package, and it is not a coincidence. The {wbw} package is designed to be fully compatible with {terra}, and the conversion between WhiteboxRaster and SpatRaster objects happens in milliseconds (well, depending on the raster size, of course).

``` r library(terra)

wbwreadraster(rasterpath) |> wbwgaussianfilter(sigma = 1.5) |> wbwaspect() |> as_rast() |> # Conversion to SpatRaster plot(main = "Aspect") ```

Aspect calculated via wbw and plotted using terra R package

The {wbw} package is quite fast; you can see the detailed benchmarks here. In most cases, it is as fast as terra, while excelling in some more complex tasks (such as hillshading and filtering). Additionally, wbw outperforms the original {whitebox} by 2 to 3 times, as the amount of I/O operations is reduced to a minimum.

Installation

You can install the development version of {wbw} from GitHub with:

``` r

install.packages("pak")

pak::pak("atsyplenkov/wbw") ```

[!TIP] The {wbw} package requires the whitebox-workflows Python library v1.3.3+. However, you should not worry about it, as the package is designed to install all dependencies automatically on the first run.

Your machine should have Python 3.8+ installed with pip and venv configured. Usually, these requirements are met on all modern computers. However, clean Debian installs may require the installation of system dependencies:

bash apt update apt install python3 python3-pip python3-venv -y

Contributing

Contributions are welcome! Please see our contributing guidelines for details. There is an open issue for the {wbw} package here that contains a list of functions yet to be implemented. This is a good place to start.

See also

Geomorphometric and hydrological analysis in R can be also done with:

Owner

  • Name: Anatolii Tsyplenkov
  • Login: atsyplenkov
  • Kind: user
  • Location: New Zealand
  • Company: @manaakiwhenua

Scientist-Geomorphologist and Research Software Engineer, fond of all things geospatial

GitHub Events

Total
  • Create event: 2
  • Commit comment event: 40
  • Issues event: 6
  • Watch event: 28
  • Delete event: 1
  • Issue comment event: 2
  • Public event: 1
  • Push event: 41
  • Pull request event: 12
  • Fork event: 3
Last Year
  • Create event: 2
  • Commit comment event: 40
  • Issues event: 6
  • Watch event: 28
  • Delete event: 1
  • Issue comment event: 2
  • Public event: 1
  • Push event: 41
  • Pull request event: 12
  • Fork event: 3

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 6
  • Total pull requests: 11
  • Average time to close issues: about 2 hours
  • Average time to close pull requests: about 2 hours
  • Total issue authors: 1
  • Total pull request authors: 1
  • Average comments per issue: 0.17
  • Average comments per pull request: 0.09
  • Merged pull requests: 10
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 6
  • Pull requests: 11
  • Average time to close issues: about 2 hours
  • Average time to close pull requests: about 2 hours
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 0.17
  • Average comments per pull request: 0.09
  • Merged pull requests: 10
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • atsyplenkov (6)
Pull Request Authors
  • atsyplenkov (11)
Top Labels
Issue Labels
roadmap (1)
Pull Request Labels

Dependencies

.github/workflows/pkgdown.yaml actions
  • actions/checkout v4 composite
  • nwtgck/actions-netlify v3.0 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
  • r-lib/actions/setup-tinytex v2 composite
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v4 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/progress-tracker.yml actions
  • actions/github-script v6 composite
  • schneegans/dynamic-badges-action v1.6.0 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v4 composite
  • actions/upload-artifact v4 composite
  • codecov/codecov-action v4 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION cran
  • S7 >= 0.2.0 imports
  • checkmate * imports
  • cli * imports
  • grDevices * imports
  • graphics * imports
  • reticulate * imports
  • stats * imports
  • terra >= 1.7 suggests
  • testthat >= 3.0.0 suggests