DO.unit.convert: Convert Between Different Common Units of DO Concentration

Description Usage Arguments Value Note Author(s) References See Also Examples

View source: R/rMR.R

Description

Converts between different different units of DO concentration. Takes into account ambient temperature, pressure and salinity.

Usage

1
2
3
DO.unit.convert(x, DO.units.in, DO.units.out, bar.units.in,
bar.press, temp.C, bar.units.out = "mmHg",
salinity = 0, salinity.units = "pp.thou")

Arguments

x

Value or object of class numeric to be converted.

DO.units.in

Units of dissolved oxygen concentration measured, i.e. to be converted from. Must be "mg/L", "PP" (partial pressure), or "pct" (percent). If "PP", the units of partial pressure must be equal to bar.units.in.

DO.units.out

Units of dissolved oxygen concentration desired, i.e. to be converted to. Must be "mg/L", "PP", or "pct".

bar.units.in

Units of barometric pressure of user specified barometric pressure measurement. Must take value of "atm", "kpa", or "mmHg".

bar.press

Ambient barometric pressure measurement

temp.C

Water temperature measured in degrees C

bar.units.out

Used in internal calculation, only visible if output DO.units.out = "PP". Must take value of "atm", "kpa", or "mmHg".

salinity

Salinity, either reported in parts per thousand ("pp.thou") or microsiemens/cm ("us")

salinity.units

Salinity units, must be "pp.thou" or "us"

Value

Numeric object representing dissolved oxygen concentration in the units specified by DO.units.out.

Note

Use this function on entire data columns to convert them to desired units before analysing with functions like MR.loops and get.pcrit.

Author(s)

Tyler L. Moulton

References

Mechtly, E. A., 1973: The International System of Units, Physical Constants and Conversion Factors. NASA SP-7012, Second Revision, National Aeronautics and Space Administration, Washington, D.C. https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19730018242.pdf.

U.S. Geological Survey (2011). Change to solubility equations for oxygen in water: Office of Water Quality Technical Memorandum 2011.03, accessed July 15, 2011, at http://water.usgs.gov/admin/memo/QW/qw11.03.pdf.

See Also

plot, plotRaw, cbind, Eq.Ox.conc, DO.saturation,

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
## on a single value ##

DO.pct<- DO.unit.convert(x= 125.6863, DO.units.in = "PP",
                DO.units.out = "pct",
                bar.units.in = "mmHg", bar.press = 750, temp.C =15)

## Apply to a column in a 'data.frame' class object ## 

## load data ##
data(fishMR)

## create time variable in POSIXct format ##
fishMR$std.time <- as.POSIXct(fishMR$Date.time,
                    format = "%d/%m/%Y %I:%M:%S %p")

head(fishMR)

#note that DO data are in mg/L (DO.mgL) and
#that there is an instantaneous temperature column
#(temp.C) and a pressure column (Bar.Pressure.hpa)

DO.pct.col.a <- DO.unit.convert(fishMR$DO.mgL, DO.units.in = "mg/L",
                DO.units.out = "pct",
                bar.units.in = "kpa", bar.press = 101.3,
                temp.C = fishMR$temp.C,
                bar.units.out = "kpa")
DO.pct.col.b<- DO.unit.convert(fishMR$DO.mgL, DO.units.in = "mg/L",
                DO.units.out = "pct",
                bar.units.in = "kpa", bar.press = 101.3,
                temp.C = fishMR$temp.C)
head(DO.pct.col.a)
head(DO.pct.col.b)

# Now with df #

fishMR2 <- as.data.frame(cbind(fishMR, DO.pct.col.a))

par(mfrow = c(1,2))
plotRaw(data = fishMR, DO.var.name = "DO.mgL",
          start.time = "2015-07-03 06:15:00",
          end.time = "2015-07-03 08:05:00",
          main = "DO (mg/L) vs time",
          xlab = "time",
          ylab = "DO (mg/L)")
          

plotRaw(data = fishMR2, DO.var.name = "DO.pct.col.a",
          start.time = "2015-07-03 06:15:00",
          end.time = "2015-07-03 08:05:00",
          main = "DO (percent saturation) vs time",
          xlab = "time",
          ylab = "DO (percent saturation)")

Example output

Loading required package: biglm
Loading required package: DBI
              Date.time      times Bar.Pressure.hpa Phase temp.C DO.mgL
1 02/07/2015 3:57:59 PM 3518711879             1013 29.87  23.49  7.852
2 02/07/2015 3:58:00 PM 3518711880             1013 29.88  23.43  7.864
3 02/07/2015 3:58:01 PM 3518711881             1013 29.88  23.43  7.864
4 02/07/2015 3:58:02 PM 3518711882             1013 29.90  23.42  7.853
5 02/07/2015 3:58:03 PM 3518711883             1013 29.87  23.46  7.862
6 02/07/2015 3:58:04 PM 3518711884             1013 29.87  23.48  7.856
             std.time
1 2015-07-02 15:57:59
2 2015-07-02 15:58:00
3 2015-07-02 15:58:01
4 2015-07-02 15:58:02
5 2015-07-02 15:58:03
6 2015-07-02 15:58:04
[1] 92.40910 92.44578 92.44578 92.29907 92.47452 92.43877
[1] 92.40910 92.44578 92.44578 92.29907 92.47452 92.43877

rMR documentation built on May 2, 2019, 6:51 a.m.