RescaleSLCClasses: Re-scale SLC classes in a GeoData data frame

View source: R/function_RescaleSLCClasses.R

RescaleSLCClassesR Documentation

Re-scale SLC classes in a GeoData data frame

Description

RescaleSLCClasses re-scales several or all SLC classes for each SUBID in a GeoData data frame to a new target sum for all classes.

Usage

RescaleSLCClasses(gd, slc.exclude = NULL, target = 1, plot.box = TRUE)

Arguments

gd

A data frame containing columns 'SLC_n' (n \ge 1), typically an imported 'GeoData.txt' file.

slc.exclude

Integer, SLC class numbers. Area fractions of classes listed here are kept fixed during re-scaling. If NULL (default), all classes are re-scaled.

target

Numeric, target sum for SLC class fractions in each subbasin after re-scaling. Either a single number or a vector with one value for each row in gd.

plot.box

Logical, if TRUE, a box plot of SLC area sums is returned.

Details

RescaleSLCClasses allows to rescale SLC classes, e.g. as part of a post-processing work flow during HYPE model setup. Individual SLC classes can be excluded to protect. This can be useful e.g. for lake areas which maybe must correspond to areas a LakeData file. The function will throw a warning if excluded SLC class fractions are greater than sums provided in target, but not if they are smaller.

Value

RescaleSLCClasses returns the data frame provided in gd, with re-scaled SLC class fractions.

See Also

SumSLCClasses for inspection of SLC class fraction sums in each subbasin CleanSLCClasses for pruning of small SLC fractions.

Examples

# Import source data
te <- ReadGeoData(filename = system.file("demo_model", "GeoData.txt", package = "HYPEtools"))
# Re-scale SLC classes, protect the first two
RescaleSLCClasses(gd = te, slc.exclude = 1:2)


rcapell/RHYPE documentation built on Feb. 28, 2024, 3:11 p.m.