Skip to contents

This function handles a CSV format used by some files made available to the author at some time in the 2010s. In the meantime, the community has settled on other formats, such as NetCDF (see read.glider.netcdf() for how to read such files). For that reason, there are no plans to extend or even maintain this function.

Usage

read.glider.slocum.csv(
  file,
  nameMap = list(conductivity = "sci_water_cond", temperature = "sci_water_temp",
    pressure = "sci_water_pressure", longitude = "lon", latitude = "lat", depth =
    "i_depth", debug = getOption("gliderDebug", default = 0))
)

Arguments

file

A connection or a character string giving the name of the file to load.

nameMap

List used to rename data columns. See “Details”.

debug

integer controlling the amount of debugging output printed. Use 0 for no output, 1 for some.

Value

An oce object holding the data, with variables renamed as described in “Details”, and with salinity added, as calculated by oce::swSCTp() which uses the UNESCO algorithm and assumes that the conductivity values are stored in S/m units.

Author

Dan Kelley

Examples

library(oceglider)
if (file.exists("~/slocum.csv")) {
    g <- read.glider.slocum.csv("~/slocum.csv")
    summary(g)

    # 1. Plot time-depth trace, colour-coded for temperature
    par(mar = c(3, 3, 1, 1), mgp = c(2, 0.7, 0)) # thin margins
    cm <- colormap(z = g[["temperature"]])
    drawPalette(colormap = cm, cex.axis = 3 / 4)
    t <- g[["time"]]
    p <- g[["depth"]]
    plot(t, p,
        ylim = rev(range(p, na.rm = TRUE)),
        xlab = "Time", ylab = "Pressure [dbar]",
        col = cm$zcol, cex = 1 / 2, pch = 20
    )
    mtext(paste("Temperature, from", t[1]), cex = 3 / 4)

    # 2. Plot distance-depth trace, colour-coded for temperature
    dist <- geodDist(g[["longitude"]], g[["latitude"]], alongPath = TRUE)
    par(mar = c(3, 3, 1, 1), mgp = c(2, 0.7, 0)) # thin margins
    cm <- colormap(z = g[["temperature"]])
    drawPalette(colormap = cm, cex.axis = 3 / 4)
    p <- g[["depth"]]
    plot(dist, p,
        ylim = rev(range(p, na.rm = TRUEp)),
        xlab = "Distance [km]", ylab = "Pressure [dbar]",
        col = cm$zcol, cex = 1 / 2, pch = 20
    )
    mtext(paste("Temperature, from", t[1]), cex = 3 / 4)
}