Description Usage Arguments Value Author(s) See Also Examples
Satellite time series are often affected by permanent gaps like missing observations during winter periods. Often time series methods can not deal with missing observations and require gap-free data. This function fills winter gaps with a constant fill value or according to the approach described in Beck et al. (2006).
1 2 3 4 | FillPermanentGaps(Yt,
min.gapfrac = 0.2,
lower = TRUE, fillval = NA,
fun = min, ...)
|
Yt |
univariate time series of class |
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 |
lower |
fill |
fillval |
constant fill values for gaps. If NA the fill value will be estimated from the data using |
fun |
function to be used to compute fill values. By default, minimum. |
... |
further arguments (currently not used) |
The function returns a time series with filled permanent gaps.
Matthias Forkel <matthias.forkel@tu-dresden.de> [aut, cre]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # sample some winter months to be set as gaps
winter <- (1:length(ndvi))[cycle(ndvi) == 1 | cycle(ndvi) == 2 | cycle(ndvi) == 12]
gaps <- sample(winter, length(winter)*0.3)
# introduce systematic winter gaps in time series
ndvi2 <- ndvi
ndvi2[gaps] <- NA
plot(ndvi2)
IsPermanentGap(ndvi2)
# fill winter with observed minimum
fill <- FillPermanentGaps(ndvi2)
plot(fill, col="red"); lines(ndvi)
# fill winter with mean
fill <- FillPermanentGaps(ndvi2, fun=mean)
plot(fill, col="red"); lines(ndvi)
# fill winter with 0
fill <- FillPermanentGaps(ndvi2, fillval=0)
plot(fill, col="red"); lines(ndvi)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.