adj_phenology_by_temp: Adjust a phenological pattern to a different temperature...

View source: R/sw_Vegetation.R

adj_phenology_by_tempR Documentation

Adjust a phenological pattern to a different temperature regime

Description

Extract the characteristics of seasonal (mean monthly) values of biomass, activity, etc. (i.e., phenology) that were observed for a specific (reference) climate (at a specific site), and project those characteristics to the mean monthly temperature values of a different site and/or different climate conditions.

Usage

adj_phenology_by_temp(x, ref_temp, target_temp, x_asif = NULL)

Arguments

x

A numeric vector of length 12. The values reflect the phenological pattern that occur on average under reference mean monthly temperature values ref_temp.

ref_temp

A numeric vector of length 12. Reference mean monthly temperature values in degree Celsius under which x was determined / is valid.

target_temp

A numeric vector of length 12. Mean monthly temperature values in degree Celsius of a target site / condition for which x is to be adjusted.

x_asif

A numeric vector of length 12. If not NULL, then the adjustments applied to x are based on values of x_asif.

Value

A copy of x with values that have been adjusted to represent the phenology of a target climate described by target_temp.

Details

The implementation takes a geometrical interpretation to the seasonal cycle. The time axis is represented by a standardized twelve month circle; temperature and vegetation values are standardized to lie within a band along the time circle; and warm- and cold-seasons are presumed to exist (i.e., temperate climates will work best) and are represented by ellipses with centers at the time of peak of temperature values (warm-season) below the standardized band of values and half a year earlier (cold-season) above that band. From these centers, radial expansion or contraction rates are calculated as vectors from reference towards target temperatures and these vectors are applied as adjustment rates to vegetation values. Adjusted values are destandardized before returning.

The purpose of x_asif is to adjust x based on the phenological pattern of x_asif instead of x. This may be useful, for instance, if x represents total biomass and x_asif fraction of live biomass and if we want the adjustments to reflect that the live biomass fraction predominantly influences the total biomass response to different temperatures.

Adjustments based on x_asif reflect the amount of variation in x relative to the amount of variation in x_asif. Thus, the less variation in x relative to x_asif, the less x is adjusted; and if x does not vary across months, then x is not adjusted at all regardless of the values of x_asif. This may not be desired in all cases.

Notes

Phenological adjustments applied to x will not necessarily maintain any specific characteristic of x, e.g., values in [0, 1], sum(x) == 1, max(x) == peak. Thus, post-adjustment scaling of the returned values may be required. See examples.

Examples

sw_in <- rSOILWAT2::sw_exampleData
tmp <- swProd_MonProd_grass(sw_in)
phen_reference <- data.frame(
  tmp,
  Litter_pct = tmp[, "Litter"] / max(tmp[, "Litter"]),
  Biomass_pct = tmp2 <- tmp[, "Biomass"] / max(tmp[, "Biomass"]),
  Biomass2_pct = {tmp2[6:8] <- 1; tmp2}
)

clim <- calc_SiteClimate(weatherList = rSOILWAT2::weatherData)
ref_temp <- clim[["meanMonthlyTempC"]]
temp_randomwarmer3C <- ref_temp + stats::rnorm(12, 3, 1)

phen_adj <- sapply(
  phen_reference,
  adj_phenology_by_temp,
  ref_temp = ref_temp,
  target_temp = temp_randomwarmer3C,
  x_asif = phen_reference[, "Live_pct"]
)

## Note: depending on what `x` represents, post-adjustment scaling may
## be necessary

# Maintain previous peak
rSW2utils::scale_to_reference_fun(
  x = phen_adj[, "Litter_pct"],
  x_ref = phen_reference[, "Litter_pct"],
  fun = max
)

# Maintain previous sum
rSW2utils::scale_to_reference_fun(
  x = phen_adj[, "Biomass"],
  x_ref = phen_reference[, "Biomass"],
  fun = sum
)

# Maintain previous frequency of peaks and cap the peaks at that value
rSW2utils::scale_to_reference_peak_frequency(
  x = phen_adj[, "Biomass2_pct"],
  x_ref = phen_reference[, "Biomass2_pct"],
  cap_at_peak = TRUE
)

## Plot reference and adjusted monthly values
if (interactive()) {
par_prev <- par(mfrow = c(2, 1))

plot(
  1:12,
  phen_reference[, 1],
  type = "l",
  col = "red",
  ylim = c(0, 300),
  xlab = "Month"
)
lines(1:12, phen_adj[, 1])
legend(
  "bottom",
  ncol = 2,
  legend = c("reference", "adjusted"),
  lwd = 2, lty = 1, col = c("red", "black")
)

plot(
  1:12,
  phen_reference[, 2],
  type = "l",
  col = "red",
  ylim = c(0, 1),
  xlab = "Month"
)
lines(1:12, phen_adj[, 2])

par(par_prev)
}


DrylandEcology/rSOILWAT2 documentation built on Jan. 12, 2024, 9:06 p.m.