UpstreamGroupSLCClasses {HYPEtools} | R Documentation |
Calculate area-weighted upstream averages of grouped SLC class fractions.
Description
Function to calculate averages of grouped SLC class fractions calculated from imported GeoData.txt and GeoClass.txt or any other user-defined grouping.
Usage
UpstreamGroupSLCClasses(
subid = NULL,
gd,
bd = NULL,
gcl = NULL,
type = c("landuse", "soil", "crop"),
group = NULL,
signif.digits = 3,
progbar = TRUE
)
Arguments
subid |
Integer vector of SUBIDs for which to calculate upstream properties (must exist in |
gd |
A data frame containing a column with SUBIDs and a column with areas, e.g. an imported 'GeoData.txt' file imported with |
bd |
A data frame, containing 'BRANCHID' and 'SOURCEID' columns, e.g. an imported 'BranchData.txt' file. Optional argument. |
gcl |
Data frame containing columns with SLCs and corresponding land use and soil class IDs, typically a 'GeoClass.txt'
file imported with |
type |
Keyword character string for use with |
group |
Integer vector, of same length as number of SLC classes in |
signif.digits |
Integer, number of significant digits to round upstream SLCs to. See also |
progbar |
Logical, display a progress bar while calculating SLC class fractions. Adds overhead to calculation time but useful when |
Details
UpstreamGroupSLCClasses
calculates area-weighted upstream averages of CropID fractions from SLC class fractions in a GeoData table and corresponding
grouping columns in a GeoClass table or a user-provided vector. Upstream calculations include branch connections in case of stream bifurcations but not
potential irrigation links or groundwater flows. Averages are weighted by sub-catchment area.
The function builds on GroupSLCClasses
, which provides grouped sums of SLC classes for several or all sub-basins in a GeoData dataframe.
Value
UpstreamGroupSLCClasses
returns a data frame with SUBIDs in the first column, and upstream group fractions in the following columns.
Note
UpstreamGroupSLCClasses
expects SLC class columns in argument gd
to be ordered in ascending order.
See Also
GroupSLCClasses
UpstreamSLCClasses
UpstreamGeoData
SumUpstreamArea
AllUpstreamSubids
Examples
# Import source data
te1 <- ReadGeoData(filename = system.file("demo_model", "GeoData.txt", package = "HYPEtools"))
te2 <- ReadGeoClass(filename = system.file("demo_model", "GeoClass.txt", package = "HYPEtools"))
# Upstream land use fractions for single SUBID
UpstreamGroupSLCClasses(subid = 63794, gd = te1, gcl = te2, type = "landuse", progbar = FALSE)
# Upstream soil fraction for all SUBIDs in GeoData
UpstreamGroupSLCClasses(gd = te1, gcl = te2, type = "soil")