Skip to contents

Logistic function to calculate weight transition between boundaries.

Usage

w_log(x, lwr, upr)

Arguments

x

Numeric value to calculate weight from

lwr

Numeric value for lower boundary. If x = lwr the function returns ~0.01 as a weight.

upr

Numeric value for upper boundary. If x = upr the function returns ~0.99 as a weight.

Examples

if (FALSE) {
# All examples below must be included in the dynamic
# rules in the management csv file to be effective.

# Low weight for days below 0 degC with a
# logistic transition from 5 degC to 0 degC:
tmp <- -5:10
weight <- logistic(tmp, 0, 5)
plot(tmp, weight)

# Low weight for days with high precipitation
# (transition range: 2 to 10 mm)
pcp <- 0:12
weight <- (1 - logistic(pcp, 0, 5))
plot(pcp, weight)

# Harvesting crop in optimum PHU fraction range 1 to 1.1
hu_fr <- seq(0.75, 1.4, 0.01)
weight <- logistic(hu_fr, 0.9, 1) * (1 - logistic(hu_fr, 1.1, 1.2))
}