Closed j-harbin closed 4 years ago
@j-harbin please note from https://github.com/dankelley/oce/issues/1704 that I plan to do this in 'oce' (given approval of coauthors) tomorrow, but 'll do it in argoFloats today.
Actually, it turns out that oce is set up (intentionally) to prevent the user from changing default flag-mapping schemes using oce::initializeFlagSchemeInternal()
. There is a way for argoFloats to over-ride that, but I do not think we should, because then a user would get different behaviour by using argoFloats::readProfiles("file.nc")
than they would with oce::read.argo("file.nc")
and that is not a good thing.
The only solution is that anyone wanting the solution to this issue must first update oce from github, using
devtools::install_github("dankelley/oce", ref="develop")
which is admittedly a bit of a hassle, but oce users do that all the time, so it should not be regarded as an unusual hurdle.
Once that's done, using
library(argoFloats)
argos <- readProfiles("~/data/argo/SR2902204_131.nc")
argo1 <- argos[[1]]
summary(argo1)
yields as below, the last line of which tells us that things flagged 0, 3, 4 and 9 will get set to NA
, but that all other values will be as stored in the netcdf file.
* Processing Log
- 2020-06-10 19:31:10.008 UTC: `create 'argo' object`
- 2020-06-10 19:31:10.188 UTC: `read.argo(file="/Users/kelley/Dropbox/data/argo/SR2902204_131.nc")`
- 2020-06-10 19:31:10.189 UTC: `initializeFlagScheme(object, name="argo", mapping=list(not_assessed=0,passed_all_tests=1,probably_good=2,probably_bad=3,bad=4,changed=5,not_used_6=6,not_used_7=7,estimated=8,missing=9)), default=c(0,3,4,9))`
Therefore, I think things will be ready for testing tomorrow.
As discussed in the vftf to @dankelley today, he will make argoFloats
specifically catch these flags.
I think this working now, in "develop" commit b0847fc17b0c51596c6d64556034897a89f0aaaf.
A test code is
library(argoFloats)
data(index)
s <- subset(index,1:5)
p <- getProfiles(s)
a <- readProfiles(p)
summary(a[[1]])
where you will note near the end of the summary that the oce flagScheme
has been overridden. You can see the installed scheme with
str(a[[1]][["flagScheme"]])
which should give
List of 3
$ name : chr "argo"
$ mapping:List of 10
..$ not_assessed : num 0
..$ passed_all_tests: num 1
..$ probably_good : num 2
..$ probably_bad : num 3
..$ bad : num 4
..$ changed : num 5
..$ not_used_6 : num 6
..$ not_used_7 : num 7
..$ estimated : num 8
..$ missing : num 9
$ default: num [1:4] 0 3 4 9
and I think this issue can be closed, if you get that. If you don't get that, please add a comment showing what you get, and leave the issue open.
Thanks.
I can confirm I also receive this. I will now close this issue.
Hi Team,
I realized I closed this issue prematurely. I have made diagnostics handle flags 1,2,5 and 8 in commit 2d79f942f84c4de94832ff72e437be8cc477ead7 in the develop branch.
As shown in the screenshot below, the Argo User Manual [1] states (on page 79) that 'good' data are considered to be 1, 2, 5 or 8. Flags 9 (missing) are not used, and all other flags are considered 'bad' data.
[1] Carval, Thierry, Bob Keeley, Yasushi Takatsuki, Takashi Yoshida, Stephen Loch, Claudia Schmid, Roger Goldsmith et al. "Argo User's Manual, Version 3.2. December 29th 2015.[SUPERSEDED]." (2015).