README.md

rSOILWAT2: An Ecohydrological Ecosystem-Scale Water Balance Simulation Model

R build status github release DOI license codecov status

Table of contents

  1. How to get started
    1. Installation
    2. Documentation
  2. Overview of rSW2
  3. How to contribute
    1. Code guidelines
    2. Code documentation
    3. Code linting
    4. Code tests
    5. Code versioning
  4. Additional notes

How to get started

Installation

Install rSOILWAT2

Please not that rSOILWAT2 compiles C source code of SOILWAT2 -- see section on binary version below for alternatives. Your computer must be set up adequately (see below for requirements).

Binary package

If you require a binary version of the 'rSOILWAT2' package (e.g., to distribute to someone without development tools) for a platform to which you do not have access, then you may consider using one of the cloud services (no endorsements), e.g., - rhub offers different Linux, Windows, and macOS flavors as targets

Minimal requirements

Example instructions for a minimal latex installation

Documentation

rSOILWAT2 offers documentation and code examples of exported functions help(package = "rSOILWAT2"), in particular ?sw_exec, and several vignettes vignette(package = "rSOILWAT2"), in particular vignette("rSOILWAT2_demo", package = "rSOILWAT2").

Overview of rSW2

The DrylandEcology team hosts a group of related repositories and R packages.

They are organized around two simulation models, i.e., SOILWAT2, an dryland ecosystem water balance simulation model, and STEPWAT2, an individual-based model for dryland plant communities. They are both written in compiled languages.

We developed a family of R packages to support SOILWAT2 and STEPWAT2 simulation experiments: rSW2utils provides miscellaneous utility tools rSW2st provides spatiotemporal tools including functions to create and interact with netCDF files rSW2data provides input data preparation rSW2exter provides access to external data rSOILWAT2 is a R package that directly connects to SOILWAT2 in memory, i.e., without writing/reading input and output files to/from disk rSW2funs calculates new response variables from rSOILWAT2 output rSFSW2 manages large rSOILWAT2 simulation experiment rSFSTEP2 manages large STEPWAT2 simulation experiment

How to contribute

You can help us in different ways:

  1. Reporting issues
  2. Contributing code and sending a pull request

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Follow our guidelines as detailed here

Tests, documentation, and code

We develop code on development branches and, after they are reviewed and pass our checks, merge them into the main branch for release: * Create a development branch * Set the package version number (DESCRIPTION) to a development version (ending in -9000) * Start a new section in NEWS * Develop, document and test code and create a pull request * Finalize code development * Once code is reviewed, sufficiently tested, and ready for merging into main * Decide on a package version number for the new release * Set the package version number in DESCRIPTION * Finalize NEWS * Merge pull request into main and create new rSOILWAT2 release

Code documentation

Code linting

Code tests and package checks

Debugging compiled code * Compile C code in src/ and src/SOILWAT2/ in 'debugging' mode. This will define SWDEBUG in SOILWAT2 source code (see the README of SOILWAT2): * Install package on the command line: MAKEFLAGS="PKG_DEBUG=-DRSWDEBUG" R CMD INSTALL --preclean --clean . * Using R package devtools (e.g., while running R interactively): {r} Sys.setenv(PKG_DEBUG="-DRSWDEBUG") devtools::clean_dll() # if you debug in `src/SOILWAT2` devtools::load_all(compile = TRUE) * For a more formal approach using gdb/lldb, please see the section 'Debugging-compiled-code' in the 'R-exts' manual

How to update the submodule 'SOILWAT2' to the latest commit

git submodule update --remote #--remote: uses the latest commit; without --remote: uses the previously defined commit
git commit -am "Pulled down latest commit 'COMMIT-FLAG' for submodule SOILWAT2"
git push

Change the branch of submodule SOILWAT2

open .gitmodules # and change branch = <branch> to the desired <branch>

git submodule init
git submodule update --remote #--remote: uses the latest commit; without --remote: uses the previously defined commit
git commit -am "Changed to branch 'branch' commit 'COMMIT-FLAG' for submodule SOILWAT2"
git push

Run the script ./data-raw/prepare_testInput_objects.R from within rSOILWAT2/ if the SOILWAT2 updated included changes to the input files.

Version numbers

We base our versions on the guidelines of semantic versioning with version numbers of MAJOR.MINOR.PATCH.

We create a new release for each update to the main branch; a new release is identified by the package version (DESCRIPTION) and by a github release that also creates a git tag of the same name. The main branch is updated via pull requests from development branches after they are reviewed and pass required checks.

If the version numbers changes, then the following files must be updated DESCRIPTION: adjust lines 'Version' NEWS: add a new section describing pertinent changes to a package user (see section 'NEWS' of the book 'R packages' by Wickham and tidyverse news style)

Notes

Citation

Please cite the package if you publish results based on simulations carried out with our package, see citation("rSOILWAT2"), and we would like to hear about your publication.

Some other references

References for the original version of Soilwat

Considerations and Caveats

We haven't really published the code yet nor prepared it for sharing (though through our use of github made it openly accessible), it is actively and gradually being developed by the Lauenroth lab and affiliates, and there is no manual either - we cannot give you individual support in setting up and running the model except if we agreed on a collaboration or similar agreement.

Not every part of the code has been extensively tested or is in a stable state. Similarly, not every combination of model inputs and options has been evaluated in depth and there is not guarantee for anything to work. The code comes with no warranty and no guarantees, expressed or implied, as to suitability, completeness, accuracy, and whatever other claim you would like to make.

There is no graphical user interface, help pages and available documentation may be out of date, and you will need to write your own tools to analyze outputs.

Funding

Work on this package has been supported by various funds managed by Dr. John Bradford (USGS), Dr. Bill Lauenroth (Yale University), Dr. Kyle Palmquist (Marshall University), and Dr. Daniel Schlaepfer.

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.



Burke-Lauenroth-Lab/rSOILWAT2 documentation built on Dec. 9, 2023, 1:46 a.m.