flag_periods: Flag Affected Periods

View source: R/Quality_checking.R

flag_periodsR Documentation

Flag Affected Periods

Description

Identify and flag values obtained during periods when measurements were not reliable (e.g. instrument maintenance based on field notes).

Usage

flag_periods(x, start, end, name_out = "-")

Arguments

x

A POSIXt vector providing timestamp of measurements.

start, end

A POSIXt vector marking the start and end of the periods to be flagged. They must be of the same length.

name_out

A character string providing varnames attribute value of the output.

Details

Flagging is done according to the 0 - 2 quality control flag scheme.

Value

An integer vector with the same length as x. Its varnames and units attributes are set to name_out and "-" values, respectively.

Examples

# alternative style: as.POSIXct("2000-01-01 12:15:00", tz = "GMT")
timestamp <- seq(ISOdatetime(2000, 1, 1, 12, 15, 0, tz = "GMT"),
                 ISOdatetime(2000, 1, 1, 18, 15, 0, tz = "GMT"),
                 by = "30 mins")
periods <- data.frame(
start = c(ISOdatetime(2000, 1, 1, 13, 15, 0, tz = "GMT"),
          ISOdatetime(2000, 1, 1, 16, 15, 0, tz = "GMT")),
end = c(ISOdatetime(2000, 1, 1, 14, 15, 0, tz = "GMT"),
        ISOdatetime(2000, 1, 1, 17, 15, 0, tz = "GMT"))
)
(flags <- flag_periods(x, periods$start, periods$end, "qc_ALL_periods"))
data.frame(x, qc_ALL_periods = flags)


lsigut/openeddy documentation built on Aug. 5, 2023, 12:25 a.m.