EGU24-8608, updated on 08 Mar 2024
https://doi.org/10.5194/egusphere-egu24-8608
EGU General Assembly 2024
© Author(s) 2024. This work is distributed under
the Creative Commons Attribution 4.0 License.

“rswap” – an R package for automated and command-based interaction with the SWAP4.2 model.

Moritz Shore1,2 and Csilla Farkas1
Moritz Shore and Csilla Farkas
  • 1Norwegian Institute of Bioeconomy Research, Norway (moritz.shore@nibio.no)
  • 2Wageningen University & Research, Netherlands

“rswap” is an R package under development for SWAP 4.2 with the goal of simplifying, automating, and improving user interaction with the model. The package functions by detecting and translating SWAP input files into R-compatible dataframes, allowing for easy and automated modifications to parameters. Modified model inputs can then be re-written to files and run in SWAP from the R console using "rswap". SWAP model output can be automatically imported into the R environment and visualized using a variety of (interactive) graphing functions. If observational data is provided by the user, then the package can adjust output settings to match (variables and depth).  Modelled and observed data can then be graphically compared in-line and “goodness-of-fit” statistics can be generated and plotted. Additionally, model runs can be saved and interactively compared with each other, functions are thoroughly documented with runnable examples, and a baseline runnable model setup can be automatically initialized. Further planned developments to the package include support for parallel running of model runs, enabling rapid automated sensitivity analysis, scenario analysis, as well as automated “hard calibration” routines and parameter estimation. Through this functionality, “rswap” can connect the SWAP model to an integrated development environment (IDE), such as “RStudio”, allowing users to efficiently perform all their work (setup, calibration, execution, analysis) in a single environment. Importantly, the packages allows for direct use of  SWAP with the vast array of research software on the R platform. “rswap” is an open-source project originally developed for use in OPTAIN (optain.eu) and has been applied in multiple case studies and thesis projects.

How to cite: Shore, M. and Farkas, C.: “rswap” – an R package for automated and command-based interaction with the SWAP4.2 model., EGU General Assembly 2024, Vienna, Austria, 14–19 Apr 2024, EGU24-8608, https://doi.org/10.5194/egusphere-egu24-8608, 2024.