TsPP {greenbrown}R Documentation

Pre-processing of time series

Description

This function can be used for pre-processing of time series before the analyzing phenology or trends. The pre-processing involves the following steps:

Usage

TsPP(Yt, fpg = FillPermanentGaps, tsgf = TSGFspline, interpolate = FALSE, 
    min.gapfrac = 0.2, lower = TRUE, fillval = NA, fun = min, 
    backup = NULL, check.seasonality = 1:3, ...)

Arguments

Yt

univariate time series of class ts.

fpg

Filling of permanent gaps: If NULL, permanent gaps will be not filled, else the function FillPermanentGaps will be applied.

tsgf

Temporal smoothing and gap filling: Function to be used for temporal smoothing, gap filling and interpolation of the time series. If NULL, this step will be not applied. Otherwise a function needs to be specified. Exisiting functions that can be applied are TSGFspline, TSGFssa, TSGFdoublelog

interpolate

Should the smoothed and gap filled time series be interpolated to daily values?

min.gapfrac

How often has an observation to be NA to be considered as a permanent gap? (fraction of time series length) Example: If the month January is 5 times NA in a 10 year time series (= 0.5), then the month January is considered as permanent gap if min.gapfrac = 0.4.

lower

For filling of permanent gaps: fill lower gaps (TRUE), upper gaps (FALSE) or lower and upper gaps (NULL)

fillval

For filling of permanent gaps: constant fill values for gaps. If NA the fill value will be estimated from the data using fun.

fun

For filling of permanent gaps: function to be used to compute fill values. By default, minimum.

backup

Which backup algorithm should be used instead of TSGFdoublelog for temporal smoothing and gap filling if the time series has no seasonality? If a time series has no seasonal pattern, the fitting of double logistic functions is not meaningful. In this case another method can be used. Default: NULL (returns NA - no smoothing), other options: "TSGFspline", "TSGFssa", "TSGFlinear"

check.seasonality

Which methods in Seasonality should indicate TRUE (i.e. time series has seasonality) in order to calculate phenology metrics? 1:3 = all methods should indicate seasonality, Set to NULL in order to not perform seasonality checks.

...

further arguments (currently not used)

Value

pre-processed time series

Author(s)

Matthias Forkel <matthias.forkel@geo.tuwien.ac.at> [aut, cre]

See Also

FillPermanentGaps

Examples

# load a time series of NDVI (normalized difference vegetation index)
data(ndvi)
plot(ndvi)

# introduce systematic gaps in winter and random gaps
gaps <- ndvi
gaps[runif(50, 1, length(ndvi))] <- NA
gaps[cycle(ndvi) == 1 | cycle(ndvi) == 2 | cycle(ndvi) == 12] <- NA
plot(gaps)

# perform pre-processing of time series using different methods 
pp.lin <- TsPP(gaps, tsgf=TSGFlinear) # linear interpolation + running median
pp.spl <- TsPP(gaps, tsgf=TSGFspline) # smoothing splines
pp.beck <- TsPP(gaps, tsgf=TSGFdoublelog, method="Beck") # Beck et al. (2006)
pp.elmore <- TsPP(gaps, tsgf=TSGFdoublelog, method="Elmore") # Elmore et al. (2012)

plot(gaps)
cols <- rainbow(5)
lines(pp.lin, col=cols[1])
lines(pp.spl, col=cols[2])
lines(pp.beck, col=cols[3])
lines(pp.elmore, col=cols[4])

data.df <- ts.union(time(gaps), orig=ndvi, pp.lin, pp.spl, pp.beck, pp.elmore)
plot(data.df)
cor(na.omit(data.df[is.na(gaps),]))


[Package greenbrown version 2.4.3 Index]