Package 'presens'

Title: Interface for PreSens Fiber Optic Data
Description: Makes output files from select PreSens Fiber Optic Oxygen Transmitters easier to work with in R. See <http://www.presens.de> for more information about PreSens (Precision Sensing GmbH). Note: this package is neither created nor maintained by PreSens.
Authors: Matthew A. Birk
Maintainer: Matthew A. Birk <[email protected]>
License: GPL-3
Version: 2.1.0
Built: 2025-02-26 03:14:02 UTC
Source: https://github.com/cran/presens

Help Index


Import data from PreSens O2 transmitter

Description

Imports the standard txt file output from most PreSens fiber optic O2 transmitters and converts the data into a data frame.

Usage

import_o2(file, o2_unit = "percent_a.s.", date = "%d/%m/%y",
  salinity = 35)

Arguments

file

a character string. The filepath for the file to be read.

o2_unit

a character string. The unit of O2 measurement to be output in the data.frame. Options are:

percent_a.s. (percent air saturation)
percent_o2
hPa
kPa
torr
mmHg
inHg
mg_per_l
umol_per_l
ml_per_l
date

a character string. The date format to be passed to strptime.

salinity

salinity of water sample (psu). Default is 35 psu.

Details

The following PreSens fiber optic O2 transmitters are supported:

Fibox 3
Fibox 3 trace
Fibox 3 LCD trace
Microx TX3
Microx TX3 trace
OXY-4 mini
OXY-4 micro
OXY-4 trace
OXY-10 mini
OXY-10 micro
OXY-10 trace

It is very important to note that the PreSens fiber optics O2 transmitters that are supported with this function DO NOT account for salinity (i.e. they assume salinity = 0 ppt). If the water sample measured was not fresh water, the oxygen concentrations (e.g. mg per liter or umol per liter) are incorrect in the PreSens txt file. This function corrects these O2 concentrations based on the salinity value defined by the salinity argument. Absolute partial pressures (i.e. hPa and torr) will also be slightly different due to the slight influence of salinity on water's vapor pressure. This difference is typically ~0.05% of the recorded value.

Value

A data frame with seven columns is returned.

TIME

Date and time, POSIXct format.

DURATION

Duration of measurement trial (minutes).

oxygen

Oxygen measurement in desired unit. Column name changes based on o2_unit argument.

PHASE

Phase recorded. Phase is inversely related to O2.

AMPLITUDE

Amplitude recorded. Amplitude is an indicator of the quality of the signal. A low amplitude warning is produced by the transmitter below 2500.

TEMPERATURE

Temperature recorded or defined at beginning of measurement trial.

ERROR_CODE

Error code from transmitter. See PreSens user manual for translation of error code.

Note

Conversions are estimates based on the marelac package and therefore differ slightly from the conversions provided by PreSens.

Author(s)

Matthew A. Birk, [email protected]

See Also

last_o2

Examples

## Not run: 
file <- system.file('extdata', 'all_o2_units.txt', package = 'presens')
import_o2(file, o2_unit = 'umol_per_l', salinity = 25)

## End(Not run)

Extract latest O2 values

Description

Extracts the last O2 values from a PreSens text file.

Usage

last_o2(file, n_last = 10)

Arguments

file

a character string. The filepath for the file to be read.

n_last

integer. The number of O2 values to extract and return. Default is 10.

Value

A vector of numeric O2 values with a length of n_last.

Author(s)

Matthew A. Birk, [email protected]

See Also

import_o2

Examples

## Not run: 
file <- system.file('extdata', 'all_o2_units.txt', package = 'presens')
last_o2(file)
last_o2(file, n_last = 5)

## End(Not run)

Convert units of dissolved oxygen

Description

Given a measurement of dissolved O2, a list of commonly used units of oxygen partial pressures and concentrations are returned.

Usage

o2_unit_conv(o2 = 100, from = "percent_a.s.", to = "all", salinity = 35,
  temp = 25, air_pres = 1.013253)

Arguments

o2

a numeric vector of the O2 value(s). Default is 100.

from

a string describing the unit used to measure o2. Default is "percent_a.s." Options are:

percent_a.s. (percent air saturation)
percent_o2
hPa
kPa
torr
mmHg
inHg
mg_per_l
umol_per_l
ml_per_l
to

a single string either describing the unit to which the conversion should be conducted (options are the same as in from), or the string "all" to return all units.

salinity

salinity of water sample (psu). Default is 35 psu.

temp

temperature of water sample (°C). Default is 25 °C.

air_pres

pressure of air overlying water sample (bar). Default is 1.013253 bar.

Details

Conversions are based on relationships and values from the package marelac.

Author(s)

Matthew A. Birk, [email protected]

Examples

o2_unit_conv(o2 = 50)
o2_unit_conv(o2 = 1:50, from = "umol_per_l", to = "ml_per_l", salinity = 0, temp = 10,
	air_pres = 1.2)
o2_unit_conv()[c('mmHg','kPa')]

Interface for PreSens Fiber Optic Data

Description

Makes output files from select PreSens Fiber Optic Oxygen Transmitters easier to work with in R. See www.presens.de for more information about PreSens (Precision Sensing GmbH). Note: this package is neither created nor maintained by PreSens.

Author(s)

Matthew A. Birk, [email protected]