Description Usage Arguments Value Author(s) See Also Examples
Takes vector (typically seasonal data such as rainfall time series) makes phases or seasons, and returns an object of class phases or seasons. phases, are here defined as a cycle of some sort that can be distinguished in the time series. The only important difference between phases and seasons is that seasons are phases having a peak.
1 2 3 4 5 6 7 8 9 10 |
x |
a numeric vector which names are dates at which the data were acquired. |
type |
character string. either |
n_criticals |
Numeric. The number of points to be considered. Default to 1. |
steps |
Integer. The minimum number of points at either sides of each v-like point to be considered higher for it to qualify as v-like point. Default to 3 |
ts_freq |
The frequence of time series (see frequency argument in |
returned |
character string either |
an object of class phases comprise a list of:
"phases" list of phases
"criticals"index of the points separating the phases
Issoufou Liman
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | ## 2 years of a uni-modal pixel with complete without NAs
nam<- seq.Date(from = as.Date('2016-01-01'), to = as.Date ('2018-12-31'), by = 16)
dx11 <- c(1.30, 1.15, 1.50, 2.00, 2.01, 3.00, 3.20, 4.76, 3.50, 3.00, 2.40, 2.00, 1.50)
dx12 <-c(1.29, 1.1, 1.49, 1.99, 2, 3.1, 4.5, 4, 2.8, 2.5, 2.3, 1.6, 1.59)
dx1 <- c(dx11, dx12)
names(dx1) <- nam[1:length(dx1)]
## plotting the data
default_par <- par(no.readonly=TRUE)
layout(rbind(c(1, 1), c(2, 3)))
par(mar = c(2, 2, 1, 1))
plot(dx1, type = 'o', main = 'raw data') # note 2 phases = 2 years and the starting point.
## returning the phases as seasonal data.
y1 <- phases(dx1, ts_freq = 12)
y1
lapply (X = y1$phases, FUN = plot, type = 'o',
main = 'phases extracted as a seasoanal component of ts object')
## returning the phases as original data
y2 <- phases(dx1, ts_freq = 12, returned = 'original')
y2
lapply (X = y2$phases, FUN = plot, type = 'o',
main = 'phases extracted as raw')
par(default_par)
## 2 years of uni-modal pixel with many Nas towards the end.
dx2 <- dx1
dx2[21:length(dx2)] <- NA
default_par <- par(no.readonly=TRUE)
layout(rbind(c(1, 1), c(2, 3)))
par(mar = c(2, 2, 1, 1))
plot(dx2, type = 'o')
## returning the phases as seasonal data.
y1 <- phases(dx2, ts_freq = 12)
y1
lapply (X = y1$phases, FUN = plot, type = 'o')
## returning the phases as original data
y2 <- phases(dx2, ts_freq = 12, returned = 'original')
y2
lapply (X = y2$phases, FUN = plot, type = 'o') # note 1 phase and the starting point
par(default_par)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.