
Parameterise zoned parameters as an anchor value plus offsets
Source:R/zone_ratio.R
zone_offset_param.RdThe additive counterpart of zone_ratio_param(), for quantities such as
sediment temperature where a ratio is not meaningful (a ratio of degrees
Celsius is arbitrary, and shallower zones are normally warmer than deeper
ones). Zone 1 (the deepest) is calibrated directly and each shallower zone is
the next deeper zone plus an offset: zone2 = zone1 + offset2,
zone3 = zone2 + offset3. With lower >= 0 the values can only increase
towards the surface; use a negative lower (or upper <= 0) to allow or
force the opposite.
Arguments
- param
data.frame of parameters for a single zoned parameter. Either one row (the zone 1 value) or one row per zone. The row with
index == 1(or the first row ifindexis missing) is the anchor.- n_zones
integer; number of zones in the model for this parameter.
- lower, upper
numeric; bounds for the offsets, in the units of the parameter.
- start
numeric; starting value for the offsets when
paramhas a single row. Ifparamhas one row per zone, starting offsets are derived from the zone values and clipped to the bounds.
Details
Offset rows are named <name>_zoffset and are converted back to per-zone
values by expand_zone_ratios().
Examples
p <- data.frame(model = "glm_aed", file = "glm4.nml",
name = "sediment/sed_temp_mean", value = 12, min = 5,
max = 25, group = NA_character_, index = 1)
zone_offset_param(p, n_zones = 3, lower = 0, upper = 5, start = 1)
#> model file name value min max group index
#> 1 glm_aed glm4.nml sediment/sed_temp_mean 12 5 25 <NA> 1
#> 2 glm_aed glm4.nml sediment/sed_temp_mean_zoffset 1 0 5 <NA> 2
#> 3 glm_aed glm4.nml sediment/sed_temp_mean_zoffset 1 0 5 <NA> 3