Closed dankelley closed 4 months ago
The first step was to get the original names stored! That was not being done right. The problem is the separation of things into 'glider' and 'payload1', I think. Anyway, I now have that working, as below. This is not pushed to GH. I won't push until I clear the issues opened lately.
PS. note that salinity
does not have an original name listed. That's because here, as in oce, we construct salinity if we have conductivity. I am a bit divided on whether we should do that, so I'll think about whether to also include salinity as from the file, and then this constructed one with no original name. The idea is that salinity might not have been printed with sufficient digits and maybe (who knows) the formula was not correct.
library(oceglider)
#> Loading required package: oce
#> Loading required package: gsw
directory <- system.file("extdata/seaexplorer/sub", package = "oceglider")
g <- read.glider.seaexplorer.realtime(directory = directory, yo = 2, progressBar = FALSE)
summary(g)
#> Glider Summary
#> --------------
#>
#> * Input file:
#> /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library/oceglider/extdata/seaexplorer/sub/sea021.71.gli.sub.2.gz;/Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library/oceglider/extdata/seaexplorer/sub/sea021.71.pld1.raw.2.gz
#> * Type: seaexplorer
#> * Subtype: realtime
#> * Time ranges from 2023-04-11 13:56:32 to 2023-04-11 14:26:55 with 1763 samples and mean increment 1.034259 s
#> * Data Overview (of the "payload1" stream):
#> Min. Mean Max. Dim. OriginalName
#> backscatter 0.00018149 0.00043433 0.00091013 1763 FLBBCD_BB_700_SCALED
#> backscatterCount 116 210.73 389 1763 FLBBCD_BB_700_COUNT
#> cdom 0.5418 1.1278 1.806 1763 FLBBCD_CDOM_SCALED
#> cdomCount 51 57.489 65 1763 FLBBCD_CDOM_COUNT
#> chlorophyll 0.1936 0.73339 1.7424 1763 FLBBCD_CHL_SCALED
#> chlorophyllCount 56 100.61 184 1763 FLBBCD_CHL_COUNT
#> conductivity 2.7353 2.761 2.8098 1763 GPCTD_CONDUCTIVITY
#> conductivity2 27.306 27.603 28.101 1763 LEGATO_CONDUCTIVITY
#> conductivityTemperature 1.6931 2.184 2.5327 1763 LEGATO_CONDTEMP
#> latitude [°N] 44.491 44.492 44.493 1763 NAV_LATITUDE
#> LEGATO_TEMPERATURE 1.5852 2.0128 2.229 1763 LEGATO_TEMPERATURE
#> longitude [°E] -63.387 -63.386 -63.386 1763 NAV_LONGITUDE
#> navState 100 114.96 118 1763 NAV_RESOURCE
#> oxygenFrequency 3259.4 3886.4 4335.9 1763 GPCTD_DOF
#> pressure [dbar] 1.15 16.045 47.22 1763 GPCTD_PRESSURE
#> pressure2 0.8606 15.863 47.059 1763 LEGATO_PRESSURE
#> pressureNav -0.1 16.722 45.9 1763 NAV_DEPTH
#> salinity [PSS-78] 30.869 31.025 31.463 1763 -
#> salinity2 30.495 31.017 31.467 1763 LEGATO_SALINITY
#> temperature [°C, ITS-90] 1.5838 2.0129 2.2243 1763 GPCTD_TEMPERATURE
#> yoNumber 2 2 2 1763 yoNumber
#>
#> * Data-quality Flag Scheme
#>
#> name "IOOS"
#> mapping list(pass=1, not_evaluated=2, suspect=3, fail=4, missing=9)
#> default NULL
#>
#> * Data-quality Flags
#>
#> time: "2" 1763
#> navState: "2" 1763
#> longitude: "2" 1763
#> latitude: "2" 1763
#> pressureNav: "2" 1763
#> conductivity2: "2" 1763
#> LEGATO_TEMPERATURE: "2" 1763
#> pressure2: "2" 1763
#> salinity2: "2" 1763
#> conductivityTemperature: "2" 1763
#> chlorophyllCount: "2" 1763
#> chlorophyll: "2" 1763
#> backscatterCount: "2" 1763
#> backscatter: "2" 1763
#> cdomCount: "2" 1763
#> cdom: "2" 1763
#> conductivity: "2" 1763
#> temperature: "2" 1763
#> pressure: "2" 1763
#> oxygenFrequency: "2" 1763
#> yoNumber: "2" 1763
#> salinity: "2" 1763
#>
#> * Processing Log
#>
#> - 2024-06-21 13:08:59 UTC: `create 'glider' object`
#> - 2024-06-21 13:08:59 UTC: `initializeFlagScheme(object, name="IOOS", mapping=list(pass=1,not_evaluated=2,suspect=3,fail=4,missing=9)), default=c())`
#> - 2024-06-21 13:08:59 UTC: `read.glider.seaexplorer.realtime(directory="/Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library/oceglider/extdata/seaexplorer/sub",yo=c(2),missingValue=9999)`
Created on 2024-06-21 with reprex v2.1.0
This works now in "develop" commit 2b56efaa992166758c21a59015c940313a6eebb5, as shown below. Note that commit does not pass the test suite so I don't recommend using it. Most likely the test suite will fail until Monday. Also, the vignette will need rewriting. Some of this is due to a change in the built-in dataset but part is also due to what might be confusion on my part about just what realtime datasets contain.
PS. the graph shows the mismatch between pressures from two instruments. I suspect if I colour coded for the nav-state, the pattern would be clarified. But my goal right now is to clean up some issues so I can use the main code next week.
library(oceglider)
#> Loading required package: oce
#> Loading required package: gsw
directory <- system.file("extdata/seaexplorer/sub", package = "oceglider")
g <- read.glider.seaexplorer.realtime(directory, progressBar = FALSE)
plot(g[["pressure"]], g[["pressure"]] - g[["LEGATO_PRESSURE"]], cex = 0.5)
Created on 2024-06-22 with reprex v2.1.0
"develop" commit 1f59e6d5cf6c55cc459a87a2440f38f27d06f8ea now has a test suite that checks this, so I'm closing the issue now.
See a note at the end of the test suite about navState
confusion between glider
and payload1
. I don't have the understanding of file formats to speculate on the difference. I'm not even sure these files are 'realtime' ... but that's another fish to fry.
This relates a bit to #103, the practical answer to which is to choose the order (say temperature, temperature2, temperature3 or whatever) based on column order but to ensure that
[[
can handle original names so the user can work with that. Users are likely to know which they prefer.Right now,
[[
does not work on original names. From the code, it looks like it never did. (This package borrows ideas from oce but does not use it at a deep level. That's because of fundamental differences, e.g. a ctd object has no equivalent to glider and payload streams.)