internal_check_wind: Internal consistency check function (specifically for wind...

Description Usage Arguments Value Examples

View source: R/internal_check_wind.R

Description

Checking the internal consistency of wind data, wind speed should be no larger than wind gust; Generating a new sequence of flags, where a P means that observation passes the internal check, and a pre-defined flag name fail.flag means that observation fails the internal check; Also outputting two new sequences of wind speed and gust observations after removing failed observations.

Usage

1
internal_check_wind(data, speed.column, gust.column, fail.flag)

Arguments

data

a data.frame that includes observation data with information.

speed.column

a character, the selected column name in the data.frame that represents wind speed data.

gust.column

a character, the selected column name in the data.frame that represents wind gust data.

fail.flag

a character/string that represents the name of flag where an observation fails the internal check.

Value

a new tbl_df that extends three new columns on the input data, the first added column flag represents the flags (P means pass, fail.flag means fail, missing means missing values of observations), the second added column new_windspeed represents the wind speed observations after removing failed observations, the third added column new_windgust represents the wind gust observations after removing failed observations.

Examples

1
2
3
4
5
6
7
8
9
library(tidyverse)
datetime = as.POSIXlt(seq(0,60000,600), origin = "2017-02-03 08:00:00")
test = tibble(datetime = datetime,
              windspeed = c(0:20,20:1,1:20,20:1,1:20),
              windgust = c(1:50,50:0))
test_internal_check = internal_check_wind(test, speed.column = 'windspeed',
                                          gust.column = 'windgust', fail.flag = 'IN')
attributes(test_internal_check)
test_internal_check

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