showQCTests: Show Real-Time QC Test Results For an Argo Object

View source: R/qc.R

showQCTestsR Documentation

Show Real-Time QC Test Results For an Argo Object

Description

showQCTests prints a summary of the quality-control (QC) tests (if any) that were performed on an Argo profile in real-time (Caution: any tests completed and/or failed on delayed mode data are not recorded. This function also assumes tests performed or failed are recorded once, otherwise it produces a warning). It uses hexToBits() to decode the hexadecimal values that may be stored in historyQCTest. From there it pairs the determined test values with the appropriate actions, QC Tests performed or QC Tests failed, found in historyAction within the metadata slot of an individual Argo profile, as read directly with oce::read.argo() or indirectly with readProfiles(), the latter being illustrated in the “Examples” section below. The “Details” section provides an explanation of how showQCTests works at a low level, as an adjunct to the Argo documentation. See section 3.3 of Kelley et al. (2021) for more on this function.

Usage

showQCTests(x, style = "brief")

Arguments

x

an oce::argo object, as read directly with oce::read.argo() or as extracted from the return value of a call to readProfiles(), as in the “Examples”.

style

a character value governing the output printed by showQCFlags, either "brief" (the default) for a single line stating all the tests by numbers, followed by lines giving the number and description of all failed tests, or "full" for a listing of each test that was performed, with an indication of whether x passes or fails it.

Details

The format used in the historyQCTest and historyAction elements of the metadata slot of an oce::argo object is mentioned in Sections 2.2.7, 2.3.7, 5.1, 5.3 and 5.4 of reference 1, in which they are called HISTORY_QCTEST and HISTORY_ACTION, respectively. Both of these things are vectors of character values, with the entries within historyAction providing names for the entries within historyQCTest.

In the context of showQCTests, the focus is on the element of historyAction that equals "QCP$" (which maps to the element of historyQCTest that specifies the QC tests that were performed) and "QCF$" (which maps to the results of those tests). These mapped elements are character values providing hexadecimal digits that are decoded with hexToBits(), possibly after lengthening the historyQCTest value matching"QCF$" by adding "0" digits on the left to make the length be the same as that of the historyQCTest value matching '"QCP$".

The bits decoded from the relevant elements of historyQCTest correspond to QC tests as indicated in the following table. This is based on Table 11 of reference 1, after correcting the "Number" for test 18 from 261144 to 262144, because the former is not an integral power of 2, suggesting a typo in the manual (since the whole point of the numerical scheme is that the individual bits map to individual tests).

Test Number Meaning
1 2 Platform Identification test
2 4 Impossible Date test
3 8 Impossible Location test
4 16 Position on Land test
5 32 Impossible Speed test
6 64 Global Range test
7 128 Regional Global Parameter test
8 256 Pressure Increasing test
9 512 Spike test
10 1024 Top and Bottom Spike test (obsolete)
11 2048 Gradient test
12 4096 Digit Rollover test
13 8192 Stuck Value test
14 16384 Density Inversion test
15 32768 Grey List test
16 65536 Gross Salinity or Temperature Sensor Drift test
17 131072 Visual QC test
18 262144 Frozen profile test
19 524288 Deepest pressure test
20 1048576 Questionable Argos position test
21 2097152 Near-surface unpumped CTD salinity test
22 4194304 Near-surface mixed air/water test
23 8388608 Interim rtqc flag scheme for data deeper than 2000 dbar
24 16777216 Interim rtqc flag scheme for data from experimental sensors
25 33554432 MEDD test

Value

This function returns nothing; its action is in the printing of results.

Author(s)

Jaimie Harbin and Dan Kelley

References

  1. Carval, Thierry, Bob Keeley, Yasushi Takatsuki, Takashi Yoshida, Stephen Loch, Claudia Schmid, and Roger Goldsmith. Argo User's Manual V3.3. Ifremer, 2019. doi:10.13155/29825

  2. Kelley, D. E., Harbin, J., & Richards, C. (2021). argoFloats: An R package for analyzing Argo data. Frontiers in Marine Science, (8), 636922. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.3389/fmars.2021.635922")}

Examples

library(argoFloats)
a <- readProfiles(system.file("extdata", "D4900785_048.nc", package="argoFloats"))
showQCTests(a[[1]])


argoFloats documentation built on Oct. 18, 2023, 1:06 a.m.