temporal_persist_check: Temporal persistence check function

Description Usage Arguments Value Examples

View source: R/temporal_persist_check.R

Description

Check on a minimum required variability of an instantaneous value; Observations should change more than a minimum required number min.variation, during a time interval of length persist.duration; Generating a new sequence of flags, and outputting a new sequence of observations after removing failed observations.

Usage

1
2
3
4
5
6
7
temporal_persist_check(
  data,
  data.column,
  datetime.column,
  persist.duration,
  min.variation
)

Arguments

data

a data.frame that includes observation data with 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 the reporting dates and times of corresponding observations.

persist.duration

a positive number, the interval time for persistence test, the unit is 'second'.

min.variation

a positive number, the minimum required variability of observations.

Value

a new tbl_df that extends two new columns on the input data, the first added column flag_persist represents the flags (P means pass, fail.persist means fail, isolated means missing previous observations), the second added column new_data_persist represents the observation data after removing failed observations.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(tidyverse)
datetime = as.POSIXlt(seq(0,60000,600), origin = "2017-02-03 08:00:00")
test_data = tibble(datetime = datetime,
              windspeed = c(rep(10.2,5),rep(11.3,15),seq(10,15,0.1),
                            rep(9.3,20),c(NA,NA,NA,2,NA,5,7,NA,2,4)))
test_persist_check = temporal_persist_check(test_data, data.column = 'windspeed',
                                            datetime.column = 'datetime',
                                            persist.duration = 3600,
                                            min.variation = 0.1)
attributes(test_persist_check)
test_persist_check

jieyu97/QCwind documentation built on June 18, 2021, 3:37 a.m.