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

rinvest

R-CMD-check Lifecycle: experimental

Installation

Requires that Anaconda (or Miniconda) be installed and that it can be detected by the reticulate package. Check if this is the case with:

nchar(reticulate::conda_binary()) > 0

You can install rinvest with:

# install.packages("devtools")
devtools::install_github("jsta/rinvest")
rinvest::install_invest()

Example

library(rinvest)

data_dir <- system.file("extdata/NDR", package = "rinvest")
args <- list(
  "workspace_dir" = "workspace",
  "dem_path" = paste0(data_dir, "/DEM_gura.tif"),
  "lulc_path" = paste0(data_dir, "/land_use_gura.tif"),
  "runoff_proxy_path" = paste0(data_dir, "/precipitation_gura.tif"),
  "watersheds_path" = paste0(data_dir,  "/watershed_gura.shp"),
  "biophysical_table_path" = paste0(data_dir,  "/biophysical_table_gura.csv"),
  "calc_p" = TRUE,
  "calc_n" = FALSE,
  "threshold_flow_accumulation" = 1000,
  "k_param" = 2,
  "subsurface_eff_p" = 0.5,
  "subsurface_critical_length_p" = 25
)

ndr_file_paths <- ndr(args, overwrite = TRUE)
ndr_file_paths
library(raster)

plot(raster("workspace/p_surface_export.tif"), main = "P export")

Links

http://releases.naturalcapitalproject.org/invest-userguide/latest/

https://community.naturalcapitalproject.org/

https://github.com/natcap/invest



jsta/rinvest documentation built on March 17, 2023, 6:15 a.m.