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.

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.

Value

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

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).

TestNumberMeaning
12Platform Identification test
24Impossible Date test
38Impossible Location test
416Position on Land test
532Impossible Speed test
664Global Range test
7128Regional Global Parameter test
8256Pressure Increasing test
9512Spike test
101024Top and Bottom Spike test (obsolete)
112048Gradient test
124096Digit Rollover test
138192Stuck Value test
1416384Density Inversion test
1532768Grey List test
1665536Gross Salinity or Temperature Sensor Drift test
17131072Visual QC test
18262144Frozen profile test
19524288Deepest pressure test
201048576Questionable Argos position test
212097152Near-surface unpumped CTD salinity test
224194304Near-surface mixed air/water test
238388608Interim rtqc flag scheme for data deeper than 2000 dbar
2416777216Interim rtqc flag scheme for data from experimental sensors
2533554432MEDD test

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. doi:10.3389/fmars.2021.635922

Author

Jaimie Harbin and Dan Kelley

Examples

library(argoFloats)
a <- readProfiles(system.file("extdata", "D4900785_048.nc", package="argoFloats"))
showQCTests(a[[1]])
#> Tests performed: 2 3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20
#>      Passed all real-time tests