temporal_step_check: Temporal step check function

Description Usage Arguments Value Examples

View source: R/temporal_step_check.R

Description

Check on a maximum allowed variability of an instantaneous value; Observations should change less than a maximum allowed number max.variation, during a time interval of length step.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_step_check(
  data,
  data.column,
  datetime.column,
  step.duration,
  max.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.

step.duration

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

max.variation

a positive number, the maximum allowed variability of observations.

Value

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(tidyverse)
datetime = as.POSIXct(seq(0,60000,600), origin = "2017-02-03 08:00:00")
test_data = tibble(datetime = datetime, windspeed = c(rep(10.2,5),rep(NA,5),rep(9.3,35),rep(20,5),
                                                rep(3.5,40),c(1,3,NA,2,NA,5,6,7,NA,2,4)))
test_step_check = temporal_step_check(test_data, data.column = 'windspeed',
                                      datetime.column = 'datetime',
                                      step.duration = 660,
                                      max.variation = 5)
attributes(test_step_check)
test_step_check

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