handleGliderFlags | R Documentation |
This function may be used to set suspicious data to NA
, or some other
value, based on the values of corresponding data-quality flags.
handleGliderFlags(
object,
flags = NULL,
actions = NULL,
where = "payload1",
debug = getOption("gliderDebug", 0)
)
object |
An object of glider. |
flags |
A |
actions |
An optional |
where |
An optional string that permits data and flags to be stored
indirectly, e.g. with data in |
debug |
An optional integer specifying the degree of debugging, with
value 0 meaning to skip debugging and 1 or higher meaning to print some
information about the arguments and the data. It is usually a good idea to
set this to 1 for initial work with a dataset, to see which flags are being
handled for each data item. If not supplied, this defaults to the value of
|
The flags are stored within the object as a list named payload1
, which
is stored within a list named flags
that is stored in the object's
metadata
slot. Both flags
and flags$payload1
are set up when the
object is created, but values are inserted into flags$payload1
are
inserted later, when the data are read by one of the read.glider*
functions.
For example, read.glider.seaexplorer.raw()
sets flags$payload1$salinity
to be a vector of length matching the data stored in
data$payload1$salinity
, and does the same for temperature and some other
things that are typically assessed as part of quality-assessment procedures.
When these things are set up, they are also assigned numerical values, one
for each element in the data set. The initial value is set to value 2,
which means not_evaluated
in the IOOS 2017 quality-control scheme (see
table 2 of reference 1).
These numerical values provide a way to edit a dataset in an convenient and
traceable way, through the appropriate setting of the flags
and actions
arguments. Flag values may be altered with setGliderFlags()
, as
illustrated in the “Examples” section.
Dan Kelley
U.S. Integrated Ocean Observing System. "Manual for Real-Time Oceanographic Data Quality Control Flags, Version 1.2,"
https://cdn.ioos.noaa.gov/media/2020/07/QARTOD-Data-Flags-Manual_version1.2final.pdf.
Other functions relating to data-quality flags:
setGliderFlags()
library(oceglider)
directory <- system.file("extdata/sea_explorer/delayed_raw", package = "oceglider")
g <- read.glider.seaexplorer.raw(directory, "pld1.raw", progressBar = FALSE)
# The histogram motivates a crude limit for anomalously low salinity.
par(mfrow = c(1, 2), mar = c(3, 3, 1, 1), mgp = c(2, 0.75, 0))
hist(g[["salinity"]], breaks = 100, xlab = "Original Salinity", main = "")
abline(v = 31, col = 2)
# Flag value 3 means 'suspect' in the IOOS scheme [1, table]; other
# flags are pass=1, not_evaluated=2 (the default as read), fail=4, and missing=9.
g2 <- setGliderFlags(g, "salinity", g[["salinity"]] < 31, 3)
g3 <- handleGliderFlags(g2, c(3, 4, 9)) # use default action, which is "NA"
hist(g3[["salinity"]], breaks = 100, xlab = "Trimmed Salinity", main = "")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.