Description Usage Arguments Value Author(s) Examples
View source: R/wtss_time_series.R
Converts data from a wtss tibble to a time series "ts". A WTSS tibble contains data retrieved from a WTSS server. These data sets are time series with irregular intervals. Given that of many functions that use the R "ts" format, this function converts a WTSS time series (a tibble with data and metadata) to the "ts" format. Since "ts" requires regular time series, it interpolates the original irregular time series to a regular time series. To do this, the user needs to specify a period which is recognised by the "ts" format. This period can be either "year", "quarter", "month", "week", "day", "years", "quarters", "months", "weeks", "days" or 1, 4, 12, 52. This function creates a new time series with the required frequency and intepolates the missing values using spline interpolation from the "zoo" package (zoo::na.spline).
1 | wtss_to_ts(data, band = NULL, period = "week")
|
data |
A sits tibble with time series. |
band |
Name of the band to be exported (optional if series has only one band) |
period |
One of c("year", "quarter", "month", "week", "day"), c("years", "quarters", "months", "weeks", "days") or c(1, 4, 12, 52) |
A time series in the ts format.
Gilberto Camara, gilberto.camara@inpe.br
1 2 3 4 5 6 7 8 9 10 | {
# connect to a WTSS server
wtss <- wtss::WTSS("http://www.esensing.dpi.inpe.br/wtss/")
# retrieve a time series
ts_wtss <- wtss::time_series(wtss, "MOD13Q1", c("ndvi","evi"),
longitude = -45.00, latitude = -12.00,
start_date = "2000-02-18", end_date = "2016-12-18")
# convert to ts
ts <- wtss::wtss_to_ts(ts_wtss, band = "ndvi")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.