pr_transf: Transformation for precipitation values

Description Usage Arguments Value Examples

View source: R/transformation.R

Description

Transformation for precipitation values

Usage

1
pr_transf(pr_ctrl, pr_scen, ctrl_q, scen_q, pr, obs_q)

Arguments

pr_ctrl

Simulated precipitation values for the control period (must have a column named 'pr5' with five day sums)

pr_scen

Simulated precipitation values for the scenario period (must have a column named 'pr5' with five day sums)

ctrl_q

60 and 90 quantiles of the control period precipitation data

scen_q

60 and 90 quantiles of the scenario period precipitation data

pr

Observed precipitation values in the control period timeline

obs_q

60 and 90 quantiles of the observed precipitation data in the control period timeline

Value

The observed precipitation values with an added column for transformed values

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
load('data/pr_sim.rda')
pr_sim[, pr5 := 60*60*24*frollsum(pr, 5, align = 'c')]
pr_sim <- pr_sim[!is.na(pr5)]
pr_ctrl <- pr_sim[year(DTM) %in% 1981:2010]
pr_scen <- pr_sim[year(DTM) %in% 2071:2100]
ctrl_q <- quantile(pr_ctrl$pr5, c(.6,.9))
scen_q <- quantile(pr_scen$pr5, c(.6,.9))
load('data/pr.rda')
pr[, pr_o5 := frollsum(pr_o, 5)]
pr <- pr[year(DTM) %in% 1981:2010]
obs_q <- quantile(pr$pr_o5, c(.6,.9))
print(pr_transf(pr_ctrl, pr_scen, ctrl_q, scen_q, pr, obs_q))

veravavan/AdvDeltaChange documentation built on Jan. 18, 2022, 7:05 p.m.