Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
^\.Rproj\.user$
^LICENSE\.md$
^README\.Rmd$
^\.github$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
53 changes: 53 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:

name: R-CMD-check.yaml

permissions: read-all

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true
extra-repositories: 'https://txwri.r-universe.dev'

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check
- run: Rscript -e 'whitebox::install_whitebox()'

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: SELECTRshed
Type: Package
Title: Catchment and Subcatchment Delineation
Version: 0.1.0
Version: 0.1.1
Authors@R:
person(given = "Michael", family = "Schramm", email = "mpschramm@gmail.com", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-1876-6592"))
Expand Down
11 changes: 11 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SELECTRshed 0.1.1

## Minor changes

* add tests
* add additional checks for SpatVectors, valid `wbt_results` and terra object.
* add CI infrastructure

# SELECTRshed 0.1.0

* Initial release.
6 changes: 3 additions & 3 deletions R/create_D8_.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#' @export
#' @examplesIf whitebox::check_whitebox_binary()
#' # example code
#' dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTR")
#' dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata")
#' dem <- terra::rast(dem)
#' create_d8_pointer(dem)
#'
Expand All @@ -27,7 +27,7 @@ create_d8_pointer <- function(dem,

## need to check whitebox tools is installed
whitebox_bin()

## check args
# dem should be terra obj, does not have to be file backed object since {whitebox} takes care of that when using `wbt()`
# output should be valid file path
Expand Down Expand Up @@ -77,7 +77,7 @@ create_d8_pointer <- function(dem,
#' @export
#' @examplesIf whitebox::check_whitebox_binary()
#' # example code
#' dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTR")
#' dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata")
#' dem <- terra::rast(dem)
#' D8pointer <- create_d8_pointer(dem)
#' create_d8_fa(D8pointer)
Expand Down
2 changes: 1 addition & 1 deletion R/create_breach_depression_.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ create_breach_depression_lc <- function(dem,
#' @return A SpatRaster object.
#' @export
#' @examplesIf whitebox::check_whitebox_binary()
#' dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTR")
#' dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata")
#' dem <- terra::rast(dem)
#' create_breach_depression(dem)
#'
Expand Down
2 changes: 1 addition & 1 deletion R/create_fill_depressions.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#'
#' @examplesIf whitebox::check_whitebox_binary()
#' # example code
#' dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTR")
#' dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata")
#' dem <- terra::rast(dem)
#' create_fill_depressions(dem)
#'
Expand Down
2 changes: 1 addition & 1 deletion R/create_single_pit_fill.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#' @return A SpatRaster object
#' @export
#' @examplesIf whitebox::check_whitebox_binary()
#' dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTR")
#' dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata")
#' dem <- terra::rast(dem)
#' create_single_pit_fill(dem)
create_single_pit_fill <- function(dem,
Expand Down
2 changes: 1 addition & 1 deletion R/create_streams.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#' @export
#' @examplesIf whitebox::check_whitebox_binary()
#' # example code
#' dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTR")
#' dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata")
#' dem <- terra::rast(dem)
#' D8pointer <- create_d8_pointer(dem)
#' D8fa <- create_d8_fa(D8pointer)
Expand Down
2 changes: 1 addition & 1 deletion R/create_streams_vector.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#' @export
#' @examplesIf whitebox::check_whitebox_binary()
#' # example code
#' dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTR")
#' dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata")
#' dem <- terra::rast(dem)
#' D8pointer <- create_d8_pointer(dem)
#' D8fa <- create_d8_fa(D8pointer)
Expand Down
2 changes: 1 addition & 1 deletion R/create_subbasins.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' @return SpatRaster
#' @export
#' @examplesIf whitebox::check_whitebox_binary()
#' dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTR")
#' dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata")
#' dem <- terra::rast(dem)
#' D8pointer <- create_d8_pointer(dem)
#' D8fa <- create_d8_fa(D8pointer)
Expand Down
2 changes: 1 addition & 1 deletion R/create_watershed.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#' @return A SpatRaster or wbt_result object.
#' @export
#' @examplesIf whitebox::check_whitebox_binary()
#' dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTR")
#' dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata")
#' dem <- terra::rast(dem)
#' gpkg <- system.file("extdata", "thompsoncreek.gpkg", package = "SELECTRdata")
#' pourpoint <- terra::vect(gpkg, layer = "pourpoint", crs = terra::crs(dem))
Expand Down
1 change: 1 addition & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ knitr::opts_chunk$set(

<!-- badges: start -->
[![](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![R-CMD-check](https://github.com/TxWRI/SELECTRshed/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/TxWRI/SELECTRshed/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

Delineate watersheds using whitebox tools and terra objects.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<!-- badges: start -->

[![](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![R-CMD-check](https://github.com/TxWRI/SELECTRshed/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/TxWRI/SELECTRshed/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

Delineate watersheds using whitebox tools and terra objects. These
Expand Down
2 changes: 1 addition & 1 deletion man/create_D8_fa.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/create_breach_depression.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/create_d8_pointer.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/create_fill_depressions.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/create_single_pit_fill.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/create_streams.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/create_streams_vector.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/create_subbasins.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/create_watershed.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tests/testthat/test-create_D8.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
test_that("create_d8_* returns expected types", {
testthat::skip_on_cran()
testthat::skip_if_not(whitebox::check_whitebox_binary(), "whitebox binary not installed")
dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata")
dem <- terra::rast(dem)
breached <- create_breach_depression_lc(dem, dist = 10)
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-create_breach_depression_.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
test_that("create_breach_depression_lc returns expected types", {
testthat::skip_on_cran()
testthat::skip_if_not(whitebox::check_whitebox_binary(), "whitebox binary not installed")
dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata")
dem <- terra::rast(dem)
breached <- create_breach_depression_lc(dem, dist = 10)
Expand All @@ -15,6 +16,7 @@ test_that("create_breach_depression_lc returns expected types", {

test_that("create_breach_depression returns expected types", {
testthat::skip_on_cran()
testthat::skip_if_not(whitebox::check_whitebox_binary(), "whitebox binary not installed")
dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata")
dem <- terra::rast(dem)
breached <- create_breach_depression(dem)
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-create_fill_depressions.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
test_that("create_fill_depressions returns expected types", {
testthat::skip_on_cran()
testthat::skip_if_not(whitebox::check_whitebox_binary(), "whitebox binary not installed")
dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata")
dem <- terra::rast(dem)
x <- create_fill_depressions(dem)
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-create_single_pit_fill.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
test_that("create_single_pit_fill returns expected types", {
testthat::skip_on_cran()
testthat::skip_if_not(whitebox::check_whitebox_binary(), "whitebox binary not installed")
dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata")
dem <- terra::rast(dem)
x <- create_single_pit_fill(dem)
Expand Down
3 changes: 2 additions & 1 deletion tests/testthat/test-create_streams_.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
test_that("create_streams_ returns expected types", {
testthat::skip_on_cran()
dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTR")
testthat::skip_if_not(whitebox::check_whitebox_binary(), "whitebox binary not installed")
dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata")
dem <- terra::rast(dem)
D8pointer <- create_d8_pointer(dem)
D8fa <- create_d8_fa(D8pointer)
Expand Down
3 changes: 2 additions & 1 deletion tests/testthat/test-create_subbasins.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
test_that("create_subbasins_ returns expected types", {
testthat::skip_on_cran()
dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTR")
testthat::skip_if_not(whitebox::check_whitebox_binary(), "whitebox binary not installed")
dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata")
dem <- terra::rast(dem)
D8pointer <- create_d8_pointer(dem)
D8fa <- create_d8_fa(D8pointer)
Expand Down
3 changes: 2 additions & 1 deletion tests/testthat/test-create_watershed.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
test_that("create_watershed_ returns expected types", {
testthat::skip_on_cran()
dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTR")
testthat::skip_if_not(whitebox::check_whitebox_binary(), "whitebox binary not installed")
dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata")
dem <- terra::rast(dem)
gpkg <- system.file("extdata", "thompsoncreek.gpkg", package = "SELECTRdata")
pourpoint <- terra::vect(gpkg, layer = "pourpoint", crs = terra::crs(dem))
Expand Down
3 changes: 2 additions & 1 deletion tests/testthat/test-snap_pour_point.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
test_that("snap_pour_point_ returns expected types", {
testthat::skip_on_cran()
dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTR")
testthat::skip_if_not(whitebox::check_whitebox_binary(), "whitebox binary not installed")
dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata")
dem <- terra::rast(dem)
gpkg <- system.file("extdata", "thompsoncreek.gpkg", package = "SELECTRdata")
pourpoint <- terra::vect(gpkg, layer = "pourpoint", crs = terra::crs(dem))
Expand Down