Description Usage Arguments Value Projection Temporal resampling Output options
View source: R/project_climate.R
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.
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)
|
defaults |
the output from |
params |
the calculated quantile fit parameters of the
projecting model, taken directly from the output of
|
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 -
|
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
|
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= |
see "Output options" section above.
The base.data
time series is projected by the
distributional changes from a model, estimated through
get.quantiles
, using the following p
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)
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)
)
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)
Match base period data points in the time series to be projected to quantiles in the projecting model data
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
Un-normalize the now projected time series
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:
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.
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].
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.
NOT YET IMPLEMENTED
(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
)
an xts object with just the projected time series
a numeric vector with just the projected time series
(generated from as.numeric([xts])
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.