R package for basic Simstrat model running. SimstratR
holds the version compiled or downloaded from the website on 2021-04-23 (version 3.0.1) and should run virtually on any Windows, Linux and macOS system. This package does not contain the source code for the model, only the executable. This package was inspired by GLMr.
You can install SimstratR from Github with:
```{r gh-installation, eval = FALSE}
devtools::install_github("aemon-j/SimstratR")
## Usage
Compatible with Windows, Linux (tested on Ubuntu 18.04.3 LTS) and macOS X.
### Run
```{r example, eval=FALSE}
library(SimstratR)
sim_folder <- system.file('extdata', package = 'SimstratR')
run_simstrat(sim_folder, par_file = 'simstrat.par')
```{r example, eval = FALSE} library(LakeEnsemblR) par_file <- file.path(sim_folder, 'simstrat.par')
out_file <- file.path(sim_folder, 'Results', 'T_out.dat')
sim_out <- read.table(out_file, header = T, sep=",", check.names = F)
timestep <- get_json_value(par_file, "Simulation", "Timestep s") reference_year <- get_json_value(par_file, "Simulation", "Start year")
sim_out[,1] <- as.POSIXct(sim_out[,1] * 3600 * 24, origin = paste0(reference_year, "-01-01"))
sim_out[,1] <- lubridate::round_date(sim_out[,1], unit = lubridate::seconds_to_period(timestep))
sim_out <- sim_out[,c(1,ncol(sim_out):2)]
sim_out <- sim_out[,colSums(is.na(sim_out))<nrow(sim_out)]
depths <- abs(as.numeric(colnames(sim_out)[-1])) colnames(sim_out) <- c("datetime", paste0('wtr_',abs(depths)))
rLakeAnalyzer::wtr.heat.map(sim_out)
```
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.