read.ctd.saiv() reads files that hold data acquired with a SAIV model SD204 CTD profiler (reference 1). Since no documentation on the format was available to the author, this function was written based on examination of a particular data file. This almost certainly will yield limitations for other files, in particular for those with data names that differ from those in the sample file (see “Details” for this and other limitations).

  encoding = "latin1",
  debug = getOption("oceDebug"),



a character string naming the file to be read.


a character value that indicates the encoding to be used for this data file, if it is textual. The default value for most functions is "latin1", which seems to be suitable for files containing text written in English and French.


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.






read.ctd.saiv() returns a ctd object.


Some variable names are change to the oce convention, e.g. "Sal." becomes "salinity", "Temp" becomes "temperature", etc. In the first version of the code, this renaming was done based on examination of a single file. This list was expanded after a user kindly supplied a one-page document that explains the variable names and units. As with other functions for reading oce data, read.ctd.saiv() resolves duplicate variable names by appending 2 to the second instance, 3 to the third, etc.

As with other ctd objects, the [[ operator handles both the original name from the file, and the converted oce name.

It is worth noting the following oddities that were present in the sample file upon which read.ctd.saiv() was based.

  1. The header line that names the data columns ends with a tab, indicating the presence of 12 columns (the last unnamed), but the data contain only 11 columns. Therefore, the last tab character is ignored by read.ctd.saiv().

  2. The test file lacked longitude and latitude information. This means that modern quantities like Absolute Salinity and Conservative Temperature cannot be computed. Users who know the location information ought to insert values into the object returned by read.ctd.saiv() using oceSetMetadata().

  3. Further to the previous point, it is not possible to compute pressure accurately from depth (which is what the header suggests the file contains) unless the latitude is known. In read.ctd.saiv(), latitude is assumed to be 45 degrees north, which is the default used by swPressure().




Dan Kelley, with help from the github member with the handle 'Rdescoteaux', who kindly supplied a sample file and a document listing SAIV variable names.