project.climate: Project climate distribution changes with resampling

Description Usage Arguments Value Projection Temporal resampling Output options

View source: R/project_climate.R

Description

project.climate projects a climate timeseries by the distributional changes estimated by get.quantiles, with several temporal projection options, including resampling an existing time period by day or year.

Usage

1
2
3
4
project.climate(defaults, params, base.data, output.years, norm.x = numeric(),
  bulk.x = numeric(), tail.x = numeric(), norm.x.base = numeric(),
  output = "full", index.type = "resampling",
  resampling.timescale = "day", rand.seed.set = 42)

Arguments

defaults

the output from various_defaults; for base.norm.x.df, aux.dir, and base.year.range

params

the calculated quantile fit parameters of the projecting model, taken directly from the output of get.quantiles

base.data

the time series to be projected, MUST BE AN "XTS" OBJECT (this is to reduce the number of parameters that have to input into this function - the xts object carries the time information as well).

output.years

the desired time frame (in years) for the output, projected climate time series. THIS MUST INCLUDE EVERY DESIRED FUTURE YEAR - not just the range - output.years=c(2011,2099) will result in an output time series, with two years, 2011 and 2099.

norm.x, bulk.x, tail.x, norm.x.base

For each basis function, if empty, the code first attempts to load it from file. If the file is missing, the basis function is calculated through get.predictors. Degrees of freedom (and whether or not to include the volcanic CO2 forcing) for the basis functions are taken from the norm.x.df, bulk.x.df, tail.x.df, and get.volc parameters in the params input (to ensure the quantile surfaces are constructed using the same inputs as they were estimated); base.norm.x.df is taken from defaults.

output

set the output options as explained the "Output options" section below.

index.type, resampling.timescale

set the temporal resampling options as explained in the "Temporal resampling" section below.

rand.seed.set

set random seed for resampling (default=42)

Value

see "Output options" section above.

Projection

The base.data time series is projected by the distributional changes from a model, estimated through get.quantiles, using the following p

  1. The estimated model quantiles are unpacked by evaluating the quantile regression model using the quantile fit parameters (params) and the bases (either loaded or calculated)

  2. The data to be projected is normalized by fitting the normalizing quantiles given by defaults$base.norm.x.df (subtracting the second element, and dividing by the difference between the third and first element; by default, defaults$base.norm.x.df=c(0.1,0.5,0.9))

  3. The projecting indices are found - for each day in the projected time series, which day is to be used as a base for comparison (see section on "Temporal resampling", below)

  4. Match base period data points in the time series to be projected to quantiles in the projecting model data

  5. For each projected day, apply the change in the matched quantile in the (normalized) projecting data time series between the projected day and the set base day to the time series to be projected

  6. Un-normalize the now projected time series

Temporal resampling

To generate a new, projected, climate time series over the time period given by output.years, the base inputted climate time series must be projected in some temporal mapping - say, if the base climate time series spans 1979 - 2010, and the desired output.years are 2011 - 2099, for each of the future years, a corresponding 'base' year must be chosen to compare against. project.climate offers three options for this projection:

resample_rep

resampling with replacement (the default). For resampling.timescale="year" (the default), for each projected year in output.years, a random year is chosen from the base input time frame, and projected by the change in the model distribution between the corresponding output year and that chosen base year. For resampling.timescale="day", for each day of year in output.years, that same day of year is chosen from a random year in the base input time frame.

raw

If output.years spans the same length as the base input time frame, it is just wholesale projected forward (i.e. 1979-2010 is projected to 2011-2042 year-by-year). If output.years is shorter, just the first years are chosen up to the span of output.years. If output.years is longer, the projection wraps around - i.e. 2011-2050 is projected from [1979-2010 1979-1987].

raw_mean

The behvavior is identical to that of the raw option above, but the model quantiles are averaged across the time periods before the change is applied - in other words, each matched base quantile is projected by the change in the average quantile between the base and projecting time periods.

resample

NOT YET IMPLEMENTED

Output options

full

(default) a list object giving the projected time series as an xts object (proj.data), the coefficients of the quantiles used for normalizing the base climate time series (base.norm.coef), the lat and lon of the pixel, the output.years, and the linear indices (in the base period) used a the reference year/days in the projected period (base.idxs)

xts

an xts object with just the projected time series

vec

a numeric vector with just the projected time series (generated from as.numeric([xts]))


ks905383/quantproj documentation built on Nov. 1, 2020, 9:12 p.m.