read.rsk | R Documentation |
Read an RBR rsk or txt file, e.g. as produced by an RBR logger, producing an
object of class rsk
.
read.rsk(
file,
from = 1,
to,
by = 1,
type,
encoding = NA,
tz = getOption("oceTz", default = "UTC"),
tzOffsetLocation,
patm = FALSE,
allTables = TRUE,
processingLog,
debug = getOption("oceDebug")
)
file |
a connection or a character string giving the name of the RSK file to
load. Note that |
from |
indication of the first datum to read. This can a positive integer
to indicate sequence number, the POSIX time of the first datum, or a character
string that can be converted to a POSIX time. (For POSIX times, be careful
about the |
to |
an indication of the last datum to be read, in the same format as
|
by |
an indication of the stride length to use while walking through the
file. If this is an integer, then |
type |
optional file type, presently can be |
encoding |
ignored. |
tz |
the timezone assumed for the time values stored in the
data file. Unless the user has set an alternative value in the
|
tzOffsetLocation |
offset, in hours, between the CTD clock and
the clock in the controlling computer/tablet/phone (if one was used during
the sampling). This offset is required to relate location information from the
controller to hydrographic information from the CTD, using timestamps as an
index (see "A note on location information" in “Details”).
If the user supplies a value for |
patm |
controls the handling of atmospheric pressure, an important issue for RBR instruments that record absolute pressure; see “Details”. |
allTables |
logical value, TRUE by default, indicating whether to save
all the non-empty tables in the database (pruned of |
processingLog |
if provided, the action item to be stored in the log. This is typically only provided for internal calls; the default that it provides is better for normal calls by a user. |
debug |
a flag that can be set to |
This can read files produced by several RBR instruments. At the moment, five
styles are understood: (1) text file produced as an export of an RBR hex
or rsk
file; (2) text file with columns for temperature and pressure
(with sampling times indicated in the header); (3) text file with four columns,
in which the date the time of day are given in the first two columns, followed
by the temperature, and pressure; (4) text file with five columns, in which
depth in the water column is given after the pressure; (5) an SQLite-based
database format. The first four options are provided mainly for historical
reasons, since RBR instruments at the date of writing commonly use the SQLite
format, though the first option is common for all instruments that produce a
hex
file that can be read using Ruskin.
Options 2-4 are mostly obsolete, and will be removed from future versions.
A note on location information.
It is possible to couple RBR CTD devices with smart phones or tablets
(see RBR-global, 2020), with the location data from the latter being stored
in the output .rsk
file. The format does not seem to be documented by RBR,
but read.rsk()
attempts to infer location nevertheless.
The procedure involves comparing the tstamp
(time-stamp)
field from the hydrographic part of the dataset (which is in a database
table named data
) with the tstamp
field in the geographical part of the
dataset (in a table named geodata
). (The geodata
entries are filtered to
those for which the origin
field equals "auto"
. This seems to align
with times shown for "LOCATION" data in RBR-provided viewing software.)
The connection between the two fields is done with approx()
, after
adding tzOffsetLocation
(with units converted appropriately) to the
time inferred from geodata$tstamp
field, to account for the fact that phones and tablets
may be set to local time. If the procedure succeeds, then longitude
and
latitude
are inserted into the metadata
slot of the return value, in the
form of vectors with the same length as pressure
in the data
slot.
A note on conductivity.
RBR devices record conductivity in mS/cm, and it
is this value that is stored in the object returned by read.rsk
. This can
be converted to conductivity ratio (which is what many other instruments report)
by dividing by 42.914 (see Culkin and Smith, 1980) which will be necessary in
any seawater-related function that takes conductivity ratio as an argument (see
“Examples”).
A note on pressure.
RBR devices tend to record absolute pressure (i.e.
sea pressure plus atmospheric pressure), unlike most oceanographic instruments
that record sea pressure (or an estimate thereof). The handling of pressure
is controlled with the patm
argument, for which there are three
possibilities. (1) If patm
is FALSE
(the default), then
pressure read from the data file is stored in the data
slot of return
value, and the metadata
item pressureType
is set to the string
"absolute"
. (2) If patm
is TRUE
, then an estimate of
atmospheric pressure is subtracted from the raw data. For data files in the
SQLite format (i.e. *.rsk
files), this estimate will be the value read
from the file, or the “standard atmosphere” value 10.1325 dbar, if the file
lacks this information. (3) If patm
is a numerical value (or list of
values, one for each sampling time), then 'patm' is subtracted from the
raw data. In cases 2 and 3, an additional column named
'pressureOriginal' is added to the 'data' slot to store the value
contained in the data file, and 'pressureType' is set to a string
starting with '"sea"'. See as.ctd()
for details of how this
setup facilitates the conversion of rsk objects to
ctd objects.
An rsk object.
Dan Kelley and Clark Richards
Culkin, F., and Norman D. Smith, 1980. Determination of the concentration of potassium chloride solution having the same electrical conductivity, at 15 C and infinite frequency, as standard seawater of salinity 35.0000 ppt (Chlorinity 19.37394 ppt). IEEE Journal of Oceanic Engineering, 5, pp 22-23.
RBR-global.com, 2020. "Ruskin User Guide." RBR, August 18, 2020. Revision RBR#0006105revH.
The documentation for rsk explains the structure of
rsk
objects, and also outlines other functions dealing with them. Since
RBR has a wide variety of instruments, rsk
datasets can be quite general,
and it is common to coerce rsk
objects to other forms for specialized
work, e.g. as.ctd()
can be used to create CTD object, so that the
generic plot obeys the CTD format.
Other things related to rsk data:
[[,rsk-method
,
[[<-,rsk-method
,
as.rsk()
,
ctdFindProfilesRBR()
,
plot,rsk-method
,
rsk
,
rsk-class
,
rskPatm()
,
rskToc()
,
subset,rsk-method
,
summary,rsk-method
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.