https://github.com/jsta/rinvest
R wrapper for Python invest
https://github.com/jsta/rinvest
python rstats
Last synced: about 1 year ago
JSON representation
R wrapper for Python invest
- Host: GitHub
- URL: https://github.com/jsta/rinvest
- Owner: jsta
- Created: 2020-12-07T13:40:23.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-03-14T19:52:13.000Z (about 3 years ago)
- Last Synced: 2025-04-13T12:28:00.052Z (about 1 year ago)
- Topics: python, rstats
- Language: R
- Homepage: https://jsta.github.io/rinvest
- Size: 1.09 MB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.Rmd
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%"
)
```
# rinvest
[](https://github.com/jsta/rinvest/actions) [](https://www.tidyverse.org/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:
```{r }
nchar(reticulate::conda_binary()) > 0
```
You can install `rinvest` with:
```{r, eval=FALSE}
# install.packages("devtools")
devtools::install_github("jsta/rinvest")
rinvest::install_invest()
```
## Example
```{r example, eval=TRUE}
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)
```
```{r, eval=TRUE}
ndr_file_paths
```
```{r, eval=FALSE, message=FALSE}
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