Description Usage Arguments Value Examples
Citizen weather observations do not have uniform standards, this function converts the time series of observations by various citizen weather stations into the same unified form.
1 2 3 4 5 6 7 8 9 | uniform_data(
data,
data.column,
datetime.column,
timeseq,
freq = 600,
method = "average",
position = "past"
)
|
data |
a data.frame that includes observation data with datetime information. |
data.column |
a character, the selected column name in the data.frame that represents observation data to be checked. |
datetime.column |
a character, the selected column name in the data.frame that represents dates and times of observations to be checked. |
timeseq |
a date and time vector, indicating the standard reporting timestamps.
|
freq |
a number, the standard reporting interval time, the unit is "second". We typically use 10 (min) for forecast use, and 60 (min) for analysis use. |
method |
the matching method, choosing from "average", "maximum", "nearest", or "angle.average".
"average": the average value of observations in each time interval with length |
position |
the time window considered to match the standard 10-min timestamps: "centre" means the time window is centred at the standard timestamps; "past" means the time window is the past 10-min interval of the standard timestamps. |
a new matched time series, with standard reporting time every interval
minutes.
1 2 3 4 5 6 7 8 9 10 11 | library(tidyverse)
datetime = as.POSIXlt(seq(0,30000,300), origin = "2017-02-03 08:00:00")
datetime_seq_standard = as.POSIXlt(seq(0,30000,600), origin = "2017-02-03 08:00:00")
test = tibble(datetime = datetime,
windspeed = c(rep(10.2,5),seq(10,15,0.1),rep(9.3,45)))
standard_ts = uniform_data(data = test, data.column = 'windspeed',
datetime.column = 'datetime',
timeseq = datetime_seq_standard,
method = "average")
str(standard_ts)
head(standard_ts)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.