applyQC {argoFloats} | R Documentation |
Apply Quality Control Flags
Description
This function examines the quality-control ("QC") flags within an argoFloats
object that was created by readProfiles()
. By default, it replaces all suspicious
data with NA
values, so they will not appear in plots or be considered in calculations.
This is an important early step in processing, because suspicious Argo floats commonly
report data that are suspicious based on statistical and physical measures, as
is illustrated in the “Examples” section.
See section 3.3 of Kelley et al. (2021) for more information
about this function.
Usage
applyQC(x, flags = NULL, actions = NULL, debug = 0)
Arguments
x |
an |
flags |
A list specifying flag values upon which actions will be taken. This can take two forms. In the first form, the list has named elements each containing a vector of integers. For example, salinities flagged with values of 1 or 3:9 would be specified by flags=list(salinity=c(1,3:9)). Several data items can be specified, e.g. flags=list(salinity=c(1,3:9), temperature=c(1,3:9)) indicates that the actions are to take place for both salinity and temperature. In the second form, flags is a list holding a single unnamed vector, and this means to apply the actions to all the data entries. For example, flags=list(c(1,3:9)) means to apply not just to salinity and temperature, but to everything within the data slot. If flags is NULL then it is set to
|
actions |
the actions to perform. The default, |
debug |
an integer passed to |
Details
The work is done by using oce::handleFlags,argo-method()
on each of the profiles stored within the object. In most cases, only
the object needs to be specified, for the default actions coincide with
common conventions for flags in Argo data.
Value
A copy of x
but with each of the objects within its data
slot
having been passed through oce::handleFlags,argo-method()
.
Author(s)
Dan Kelley
References
Argo Data Management. “Argo User’s Manual.” Ifremer, July 5, 2022. https://doi.org/10.13155/29825.
Kelley, D. E., Harbin, J., & Richards, C. (2021). argoFloats: An R package for analyzing Argo data. Frontiers in Marine Science, (8), 636922. doi:10.3389/fmars.2021.635922
Examples
# Demonstrate applyQC to a built-in file
library(argoFloats)
f <- system.file("extdata", "SR2902204_131.nc", package="argoFloats")
raw <- readProfiles(f)
clean <- applyQC(raw)
oldpar <- par(no.readonly=TRUE)
par(mar=c(3.3, 3.3, 1, 1), mgp=c(2, 0.7, 0))
plot(raw, col="red", which="TS")
points(clean[[1]][["SA"]], clean[[1]][["CT"]], pch=20)
legend("topleft", pch=20, cex=1,
col=c("black", "red"), legend=c("OK", "Flagged"), bg="white")
par(oldpar)