Soil and Chemical Substance Emission and Transport Model
Overview
An enhanced version of the semi-empirical, spatially distributed emission and transport model PhosFate implemented in 'R' and 'C++'. It is based on the D-infinity, but also supports the D8 flow method. The currently available substances are suspended solids (SS) and particulate phosphorus (PP). A major feature is the allocation of substance loads entering surface waters to their sources of origin, which is a basic requirement for the identification of critical source areas and in consequence a cost-effective implementation of mitigation measures. References: Hepp et al. (2022) doi:10.1016/j.jenvman.2022.114514; Hepp and Zessner (2019) doi:10.3390/w11102161; Kovacs (2013) http://hdl.handle.net/20.500.12708/9468.
This version introduces a new flow method, but also comes with several breaking changes.
Overview
- Use of the D-infinity (Tarboton, 1997) instead of the D8 flow method, however, the D8 flow method can still be mimicked by rounding D-infinity flow directions to the nearest multiple of 45 degrees.
- Weighted flow accumulations are no longer supported for the time being.
- The basis for the calculation of the D-infinity slopes is the original digital elevation model and not the breached one with reversed stream burning as it used to be for the calculation of the D8 slopes.
- The default value for the parameter holding the minimum bounding slope _(ns\_slp\_min)_ is now 1 instead of 0.001%.
- The L factor is now calculated using equation\ (9) as published by Desmet and Govers (1996) and not as modified by Kovacs (2013).
- The channel retentions of the substance outlet loads of subsurface drainages are now calculated analogous to the overland retentions of the local emissions, i.e. by using half of the respective flow path length.
RPhosFatenow utilises theterrainstead of therasterpackage.- Ceased the support for _ERDAS IMAGINE_ (\*.img) raster files and added
img2tif()function can be used to convert all _ERDAS IMAGINE_ raster files in a directory and its subdirectories into _GeoTIFF_ raster files. - Dropped backward compatibility to major version zero.
Technical details
Show all changes in 2.0.1Hide the rest of the changes in 2.0.1
- Input data changes:
- Removed the layers holding the (weighted) D8 flow accumulations (_acc_ and _acc\_wtd_) and added _acc\_inf_ holding the D-infinity flow accumulations.
- Removed the layer holding the D8 flow directions _(dir)_ and added _dir\_inf_ holding the D-infinity flow directions.
- Removed the layer holding the D8 slopes _(slp)_ and added _slp\_inf_ holding the D-infinity slopes.
DEMrelatedInput()function changes:- Considerable adjustments to reflect the aforementioned input data changes.
- Addition of
ns_chaargument: allows for specifying the minimum D8 flow accumulation determining a channel. - Addition of
ls_mD8argument: allows for mimicking D8 flow directions by rounding the D-infinity flow directions to the nearest multiple of 45 degrees. Please note that this treatment is always applied to channel cells independently of this argument. - Removal of the
cs_wgsandcs_dirarguments: These input data are no longer supported for the time being. - Switched to utilising the
SpatRasterandSpatVectorclasses from theterrapackage instead of theRasterLayerclass from therasterand theSpatial*DataFrameclasses from thesppackages. - Added
is_thsargument to theRPhosFate()andcatchment()constructors: allows for specifying the number of threads to use for processing, where applicable. - Removed the layer holding the hydraulic radii _(rhy),_ as the calculation of the hydraulic radii is now integrated into the
transport()method. This implies that thetransportPrerequisites()method does not save it to disk any longer. - Removed the parameter holding the D8 outflow direction vector _(iv\_fDo)._ Existing parameter files containing it can still be used, but the parameter will definitely be lost upon saving the project's state.
- Removed the
transportCalcOrder()method, as the determination of the cell transport calculation order is now integrated into thetransport()method. This implies that thefirstRun()as well assubsequentRun()methods do not call it and thesaveState()method does not save it to disk any longer. - The
calibrationQuality()method now returns its return value invisibly. - Considerably revised the internal
RPhosFateHelpersclass. - Removed
spatstat.geomfrom the imported packages list (utilised functionality is now also provided byterra). - Bumped the minimum tested R version from 4.2.3 to 4.3.2 using the corresponding _Posit_ public package manager snapshot.
- Slightly improved the documentation.
- Major internal code improvements.
From NEWS.md in the release
Install
Health
- OK13 OK2026-09-08
- ERROR12 OK, 1 ERROR2026-09-07
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK14 OK2026-04-22
Show 2 earlier changesHide 2 earlier changes
- ERROR13 OK, 1 ERROR2026-04-18
- OK14 OK2026-03-10
Documentation
- Help pages
- 20
- Examples that run
- 28%5 run in a plain check · 12 only when donttest examples are enabled (R CMD check --as-cran) · 1 never run
- Exported functions with examples
- 95%
- Documented parameters
- 70%
- Return-value docs
- 100%
- Help pages citing references
- 25%
Downloads
Repository
- PRs merged (all time)
- 100%
- Median days to close, 50 most recently updated closed issues
- 7
- Median days to close, 50 most recently updated closed PRs
- 0
Stars over time
Releases over time
Issues over time
PRs over time
14 development-tooling and community-health practices detected across 6 families in the upstream repository
Checks run against github.com/gisler/rphosfate on 2026-10-21.
The R CMD check workflow runs on Linux and Windows, and on R-devel
GitHub Pages site last deployed 2026-05-31 · The repository has a site deploy workflow
pkgdown site last built 2025-03-24
Show all practicesHide 2 practices
Dependencies
Installing RPhosFate adds 6 packages (6 with compiled code, 4.7 MB of source tarballs). Heaviest: Rcpp 1.8 MB, terra 1.5 MB, RcppArmadillo 1.0 MB.
Code & Tests
People & History
Package metadata
- First published
- 2022-09-21
- Total releases
- 4 / 4 yrs
- License
- AGPL (>= 3) OSI
- Minimum R
- ≥ 3.5.0
- Download size
- 1.3 MB
Cite
Cite this package
Run in R for the authors' entry:
citation("RPhosFate")The package provides a citation file, so citation() returns the authors' own entry.
It points to 10.1016/j.jenvman.2022.114514, 10.3390/w11102161.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-24, which the citation names so these numbers can be found later. More on citing and the projects behind them.