The TOPMODEL package contains an implementation of the venerable TOPMODEL, along with some other useful functions. Although the package has been tested extensively, it may contain bugs. All feedback is welcome (see the feedback page).
Thanks go to Keith Beven, who wrote the original TOPMODEL in Fortran, and Huidae Cho, for the C code base (originally implemented in GRASS GIS)
For a fully documented example, see the Running Topmodel page.
Topmodel is available from the Comprehensive R Archive Network. It can be installed directly from within R with:
Once in R you need to load the package before you can use it:
Full documentation is provided in the package, and can be opened with:
The current version contains the following functions:
- infiltration() gives direct access to the Green-Ampt infiltration routine used by topmodel
- make.classes() makes topographic index classes from a topographic index map
- NSeff() calculates the Nash-Sutcliffe efficiency
- topidx() calculates the topographic index from a raster DEM
- topmodel() implements the original model
The package is in fact a wrapper around a set of C libraries. This makes it easy to recycle the libraries and link them in C programs or other languages (Fortran, C++, Python, ...). For access to the libraries, download the source package, extract it, and look into the src/ subdirectory.
Only the file topmodel.c contains some R-specific functions (they start with R_) related to output in the R console. This file implements the monte-carlo simulation. The model itself can be found in core_topmodel.c and subroutines.