oce (version 0.9-23)

read.odf: Read an ODF file

Description

ODF (Ocean Data Format) is a format developed at the Bedford Institute of Oceanography and also used at other Canadian Department of Fisheries and Oceans (DFO) facilities. It can hold various types of time-series data, which includes a variety of instrument types. Thus, read.odf is used by read.ctd.odf for CTD data, etc. As of mid-2015, read.odf is still in development, with features being added as a project with DFO makes available more files.

Usage

read.odf(file, columns = NULL, debug = getOption("oceDebug"))

Arguments

file

the file containing the data.

columns

An optional list that can be used to convert unrecognized data names to resultant variable names. For example, columns=list(salinity=list(name="salt", unit=list(unit=expression(), scale="PSS-78")) states that a short-name of "salt" represents salinity, and that the unit is as indicated. This is passed to cnvName2oceName or ODFNames2oceNames, as appropriate, and takes precedence over the lookup table in that function.

debug

an integer specifying whether debugging information is to be printed during the processing. This is a general parameter that is used by many oce functions. Generally, setting debug=0 turns off the printing, while higher values suggest that more information be printed. If one function calls another, it usually reduces the value of debug first, so that a user can often obtain deeper debugging by specifying higher debug values.

Value

An object of class oce. It is up to a calling function to determine what to do with this object.

Caution

ODF files do not store information on the temperature or salinity scale, and read.odf assumes them to be ITS-90 and PSS-78, respectively. These scales will not be correct for old data files. Note that the temperature scale can be converted from old scales using T90fromT68 and T90fromT48, although the change will be in a fraction of a millidegree, which probably exceeds reasonable confidence in old data.

Details

Note that some elements of the metadata are particular to ODF objects, e.g. depthMin, depthMax and sounding, which are inferred from ODF items named MIN_DEPTH, MAX_DEPTH and SOUNDING, respectively. In addition, the more common metadata item waterDepth, which is used in ctd objects to refer to the total water depth, is set to sounding if that is finite, or to maxDepth otherwise.

The function ODFNames2oceNames is used to translate data names from the ODF file to standard oce names, and handles conversion for a few non-standard units. The documentation of ODFNames2oceNames should be consulted for more details.

References

[1] Anthony W. Isenor and David Kellow, 2011. ODF Format Specification Version 2.0. (This is a .doc file downloaded from a now-forgotten URL by Dan Kelley, in June 2011.)

[2] The St Lawrence Global Observatory website has information on ODF format at https://slgo.ca/app-sgdo/en/docs_reference/format_odf.html

See Also

ODF2oce will be an alternative to this, once (or perhaps if) a ODF package is released by the Canadian Department of Fisheries and Oceans.

Other things related to odf data: ODF2oce, ODFNames2oceNames, [[,odf-method, [[<-,odf-method, odf-class, plot,odf-method, read.ctd.odf, subset,odf-method, summary,odf-method

Examples

Run this code
# NOT RUN {
library(oce)
# Read a CTD cast made on the Scotian Shelf. Note that the file's metadata
# states that conductivity is in S/m, but it is really conductivity ratio,
# so we must alter the unit before converting to a CTD object. Note that
# read.odf() on this data file produces a warning suggesting that the user
# repair the unit, using the method outlined here.
odf <- read.odf(system.file("extdata", "CTD_BCD2014666_008_1_DN.ODF", package="oce"))
odf[["conductivityUnit"]] <- list(unit=expression(), scale="")
#
# Figure 1. make a CTD, and plot (with span to show NS)
plot(as.ctd(odf), span=500)
# Figure 2. highlight bad data on TS diagram
plotTS(odf, type='o') # use a line to show loops
bad <- odf[["QCFlag"]]!=0
points(odf[['salinity']][bad],odf[['temperature']][bad],col='red',pch=20)

# }

Run the code above in your browser using DataLab