Skip to contents

This function provides names for the numerical navState codes used by various gliders, with the aim of making it easier to write self-explanatory code (see “Examples”).

Usage

navStateCodes(g)

Arguments

g

Either a character string or glider object. If it is a string, then it is the type of glider, which in the present version of the function must be "seaexplorer". If it is a glider object, then the value of navStateCodes in the metadata slot of that object is returned, if that exists, or else the type item in the metadata slot is used to determine the type, as in the case with g being a character string.

Value

A list of integers defining the navigation state, each given a brief name as indicated in the “Details” section.

Details

The numerical values for seaexplorer are as follows.

NameValueDescription
not_navigating105glider is being set up
surfacing115nearing the surface
at_surface116at the surface, acquiring GPS and transmitting data
inflecting_downwards110ballast being adjusted to cause descent
descending100ballast causing descent
inflecting_upwards118ballast being adjusted to cause ascent
ascending117ballast causing ascent

Note that the downward portions of profiles are roughly signalled by several inflecting_downwards codes followed by descending codes, while the upward portions have inflecting_upwards codes

The numerical values for type slocum are as follows. (These are(defined as m_depth_state in the slocum documentation; see pages 1-24 of reference 1.)

NameValueDescription
ignore99-
hover3-
climbing2-
diving1-
surface0-
none-1-

References

1.Teledyne Webb Research. Slocum G2 Glider Operators Manual, January 2012. https://gliderfs2.coas.oregonstate.edu/gliderweb/docs/slocum_manuals/Slocum_G2_Glider_Operators_Manual.pdf.

Author

Dan Kelley

Examples

# Use codes to identify upcasts, at least roughly (note the stray points)
directory <- system.file("extdata/sea_explorer/delayed_raw", package = "oceglider")
g <- read.glider.seaexplorer.delayed(directory, progressBar = FALSE)
ns <- navStateCodes(g)
plot(g, which = "p")
#> [1] "2019-07-19 15:12:15 UTC" "2019-07-19 18:02:07 UTC"
#> w: 2549
#> t[w]: 2019-07-19 18:02:07.28
#> p[w]: 3.54
ga <- subset(g, navState == ns$ascending)
#> Error in eval(substitute(subset), x@data[["payload1"]], parent.frame()): object 'ns' not found
points(ga[["time"]], ga[["pressure"]], col = 3, pch = 20)
#> Error in eval(expr, envir, enclos): object 'ga' not found
giu <- subset(g, navState == ns$inflecting_upwards)
#> Error in eval(substitute(subset), x@data[["payload1"]], parent.frame()): object 'ns' not found
points(giu[["time"]], giu[["pressure"]], col = 2, pch = 20)
#> Error in eval(expr, envir, enclos): object 'giu' not found
mtext(" red=inflecting_upwards; green=ascending", side = 3, line = -1, adj = 0)