Home

Awesome

Introduction to SWATprepR

SWATprepR

Project Status: Active - The project has reached a stable, usable
state and is being actively
developed. License:
MIT

The goal of SWATprepR is to help with the SWAT+ model input data preparation. A detailed overview is presented in the article by Plunge, Szabó, et al. (2024). Most functions were developed for the implementation of modeling tasks in the OPTAIN project. These tools are intended to fill the gaps in the SWAT+ workflow alongside the main tools developed by Christoph Schuerz. Therefore, we highly recommend trying and using these tools:

<img src="man/figures/swativerse_update.png" title="SWAT packages for R" alt="swativerse logo" width="80%" style="display: block; margin: auto;" />

Detailed information about packages, workflow steps, input data, SWAT+ parameters, model calibration, validation, etc., can be found in the SWAT+ modeling protocol by Christoph et al. (2022).

Installation

You can install the development version of SWATprepR from GitHub. Please be aware that to run the get_usersoil_table() function, the euptf2 package has to be installed. More information about this package can be found in the article by Szabó, Weynants, and Weber (2020).

# If the package 'remotes' is not installed run first:
install.packages("remotes")

# The installation of `SWATprepR`.
remotes::install_github("biopsichas/SWATprepR")
# The `euptf2` package has to be installed to utilize `get_usersoil_table()` function.
remotes::install_github("tkdweber/euptf2")

Data

All the data required to run and test the package is installed with the package in the extdata folder. The exact location on your computer can be found by running the lines below. Please run these commands on your system to locate it.

library(SWATprepR)
#> Loading required package: euptf2
#> Loading required package: plyr
#> Loading required package: stringr
#> Loading required package: data.table
#> Warning: package 'data.table' was built under R version 4.2.3
#> Loading required package: ranger
temp_path <- system.file("extdata", package = "SWATprepR")
print(temp_path)
#> [1] "C:/Users/laptop/AppData/Local/R/win-library/4.2/SWATprepR/extdata"

Templates

To use the SWATprepR package functions with your data, you should prepare your data to align with the templates provided in the extdata folder. These templates include:

Data prepared according to these templates can be directly loaded into R, allowing you to apply all the functions as described.

<br>

References

<div id="refs" class="references csl-bib-body hanging-indent" entry-spacing="0"> <div id="ref-optain2022" class="csl-entry">

Christoph, Schürz, Čerkasova Natalja, Farkas Csilla, Nemes Attila, Plunge Svajunas, Strauch Michael, Szabó Brigitta, and Piniewski Mikołaj. 2022. “<span class="nocase">SWAT+ modeling protocol for the assessment of water and nutrient retention measures in small agricultural catchments</span>.” Zenodo. https://doi.org/10.5281/zenodo.7463395.

</div> <div id="ref-plunge2024a" class="csl-entry">

Plunge, Svajunas, Christoph Schürz, Natalja Čerkasova, Michael Strauch, and Mikołaj Piniewski. 2024. “<span class="nocase">SWAT+ model setup verification tool: SWATdoctR</span>.” Environmental Modelling & Software 171: 105878. https://doi.org/10.1016/j.envsoft.2023.105878.

</div> <div id="ref-plunge2024b" class="csl-entry">

Plunge, Svajunas, Brigitta Szabó, Michael Strauch, Natalja Čerkasova, Christoph Schürz, and Mikołaj Piniewski. 2024. “<span class="nocase">SWAT + input data preparation in a scripted workflow: SWATprepR</span>.” Environmental Sciences Europe 36 (1): 53. https://doi.org/10.1186/s12302-024-00873-1.

</div> <div id="ref-szabo2020" class="csl-entry">

Szabó, Brigitta, Melanie Weynants, and Tobias K. D. Weber. 2020. “<span class="nocase">Updated European hydraulic pedotransfer functions with communicated uncertainties in the predicted variables (euptfv2)</span>.” Geoscientific Model Development 14 (1): 151–75. https://doi.org/10.5194/gmd-14-151-2021.

</div> </div>

Footnotes

  1. For access please inquire at christoph.schuerz@ufz.de.