David Kaiser 2018/01/19
This function reads bottle files produced during Seabird Electronics CTD casts. It was written for data recorded during various cruises by the IOW and some adjustments might be necessary before application to data recorded elsewhere. However, the function offers optional input of identifiers for geographic position, cruise name, station name, and the station's bottom depth. The idea is that the user knows any character string that identifies these meta variables in the header of the .btl file and the function finds the corresponding position in the file using grep() and extracts the values using sub().
filename -- the file to be imported
position.identifer -- any string identifying the GPS position in the header, defaults to "GPS_Posn",
cruise.identifier -- any string identifying the curise name in the header, defaults to "ReiseNr",
station.identifier -- any string identifying the station name in the header, defaults to "StationNr",
bottom.identifier -- any string identifying the station depth in the header, defaults to "Echolote"
Currently the identifiers must have a format of ".*= (.*)" where "(.*)" contains the value.
Ex1 <- read_btl_DK("example_data/EMB.btl")
Ex2 <- read_btl_DK("example_data/POS.btl")
Each record is represented by 4 lines in the table:
- average,
- standard deviation,
- minimum,
- maximum (see column statistic)
library(pander)
pander(Ex1$data, emphasize.strong.rows = which(Ex1$data$statistic == "(avg)"))
Btl_Posn | Date | DepSM | PrDM | C0mS.cm |
---|---|---|---|---|
10 | Dec 06 2014 09:11:53 | 6.444 | 6.502 | 8.629 |
10 | Dec 06 2014 09:11:53 | 0.054 | 0.055 | 0.000143 |
10 | Dec 06 2014 09:11:53 | 6.363 | 6.42 | 8.628 |
10 | Dec 06 2014 09:11:53 | 6.547 | 6.606 | 8.629 |
11 | Dec 06 2014 09:12:01 | 6.539 | 6.598 | 8.63 |
11 | Dec 06 2014 09:12:01 | 0.089 | 0.09 | 0.001851 |
11 | Dec 06 2014 09:12:01 | 6.418 | 6.476 | 8.628 |
11 | Dec 06 2014 09:12:01 | 6.712 | 6.772 | 8.634 |
C1mS.cm | T090C | T190C | Sal00 | Sal11 | Sbeox0ML.L |
---|---|---|---|---|---|
8.629 | 8.035 | 8.034 | 7.321 | 7.321 | 7.666 |
0.000147 | 7e-04 | 7e-04 | 1e-04 | 1e-04 | 0.0058 |
8.629 | 8.034 | 8.033 | 7.321 | 7.321 | 7.654 |
8.629 | 8.036 | 8.036 | 7.321 | 7.321 | 7.671 |
8.629 | 8.041 | 8.033 | 7.321 | 7.321 | 7.662 |
0.000368 | 0.0088 | 0.002 | 2e-04 | 1e-04 | 0.0055 |
8.628 | 8.034 | 8.028 | 7.32 | 7.321 | 7.653 |
8.629 | 8.061 | 8.035 | 7.321 | 7.322 | 7.669 |
Sbeox1ML.L | Par | Spar | FlECO.AFL | TurbWETntu0 | statistic | Btl_ID |
---|---|---|---|---|---|---|
7.643 | 3.78 | 28.93 | 0.8226 | 0.1008 | (avg) | 61 |
0.0046 | 0.1193 | 1.349e-06 | 0.0428 | 0.0081 | (sdev) | 61 |
7.631 | 3.579 | 28.93 | 0.7176 | 0.0889 | (min) | 61 |
7.646 | 3.969 | 28.93 | 0.908 | 0.1182 | (max) | 61 |
7.646 | 3.775 | 28.93 | 0.7726 | 0.0928 | (avg) | 62 |
5e-04 | 0.1762 | 1.349e-06 | 0.0207 | 0.0099 | (sdev) | 62 |
7.646 | 3.497 | 28.93 | 0.7469 | 0.0742 | (min) | 62 |
7.647 | 4.015 | 28.93 | 0.8201 | 0.1084 | (max) | 62 |
pander(Ex1$meta)
- filename: example_data/EMB.btl
- cruise: EMB-91
- station: 0001
- bottom: 56.34
- position: ** GPS_Posn = 55 43.6488N 17 43.7241E
- longitude decdeg: 17.73
- longitude decdir: E
- latitude decdeg: 55.73
- latitude decdir: N
pander(subset(Ex2$data, statistic == "(avg)"))
Btl_Posn | Date | DepSM | PrDM | C0mS.cm | T090C | |
---|---|---|---|---|---|---|
1 | 1 | May 28 2014 12:46:59 | 519.2 | 523.7 | 40.52 | 11.62 |
5 | 2 | May 28 2014 12:47:04 | 519.2 | 523.7 | 40.52 | 11.63 |
9 | 3 | May 28 2014 12:47:07 | 518.6 | 523.1 | 40.52 | 11.63 |
13 | 4 | May 28 2014 12:47:14 | 518.5 | 523 | 40.52 | 11.63 |
17 | 5 | May 28 2014 12:47:16 | 518.6 | 523.1 | 40.52 | 11.63 |
21 | 6 | May 28 2014 12:47:19 | 519.1 | 523.6 | 40.52 | 11.63 |
25 | 7 | May 28 2014 12:47:21 | 519.4 | 523.9 | 40.52 | 11.63 |
29 | 8 | May 28 2014 12:47:23 | 519.4 | 523.9 | 40.52 | 11.63 |
33 | 10 | May 28 2014 12:47:29 | 518.6 | 523.1 | 40.52 | 11.63 |
37 | 11 | May 28 2014 12:47:32 | 519.2 | 523.7 | 40.52 | 11.63 |
41 | 12 | May 28 2014 12:47:35 | 519 | 523.5 | 40.52 | 11.63 |
45 | 13 | May 28 2014 12:47:37 | 518.4 | 522.9 | 40.52 | 11.63 |
49 | 14 | May 28 2014 12:47:39 | 518.6 | 523.1 | 40.52 | 11.63 |
T190C | Sal00 | Sbeox0ML.L | SvCM | OxsatML.L | FlECO.AFL | |
---|---|---|---|---|---|---|
1 | 11.63 | 35.63 | 4.389 | 1505 | 6.076 | 0.0198 |
5 | 11.63 | 35.63 | 4.389 | 1505 | 6.075 | 0.0225 |
9 | 11.63 | 35.63 | 4.394 | 1505 | 6.075 | 0.026 |
13 | 11.63 | 35.63 | 4.392 | 1505 | 6.075 | 0.0075 |
17 | 11.63 | 35.63 | 4.392 | 1505 | 6.075 | 0.0162 |
21 | 11.63 | 35.63 | 4.395 | 1505 | 6.075 | 0.0133 |
25 | 11.63 | 35.63 | 4.406 | 1505 | 6.075 | 0.0112 |
29 | 11.63 | 35.63 | 4.394 | 1505 | 6.075 | 0.0144 |
33 | 11.63 | 35.63 | 4.391 | 1505 | 6.075 | 0.0112 |
37 | 11.63 | 35.63 | 4.403 | 1505 | 6.075 | 0.0223 |
41 | 11.63 | 35.63 | 4.397 | 1505 | 6.075 | 0.0173 |
45 | 11.63 | 35.63 | 4.396 | 1505 | 6.075 | 0.0144 |
49 | 11.63 | 35.63 | 4.399 | 1505 | 6.075 | 0.0227 |
TurbWETntu0 | Latitude | Longitude | statistic | Btl_ID | |
---|---|---|---|---|---|
1 | 0.038 | 36.67 | -16.23 | (avg) | 27 |
5 | 0.0404 | 36.67 | -16.23 | (avg) | 28 |
9 | 0.0339 | 36.67 | -16.23 | (avg) | 29 |
13 | 0.0353 | 36.67 | -16.23 | (avg) | 30 |
17 | 0.0343 | 36.67 | -16.23 | (avg) | 31 |
21 | 0.0362 | 36.67 | -16.23 | (avg) | 32 |
25 | 0.0362 | 36.67 | -16.23 | (avg) | 33 |
29 | 0.0351 | 36.67 | -16.23 | (avg) | 34 |
33 | 0.0405 | 36.67 | -16.23 | (avg) | 36 |
37 | 0.0378 | 36.67 | -16.23 | (avg) | 37 |
41 | 0.0337 | 36.67 | -16.23 | (avg) | 38 |
45 | 0.0386 | 36.67 | -16.23 | (avg) | 39 |
49 | 0.0394 | 36.67 | -16.23 | (avg) | 40 |
pander(Ex2$meta)
- filename: example_data/POS.btl
- cruise: POS-470
- station: 0001
- bottom: 4027.41 m
- position: ** GPS_Posn = 36 40.2677N 16 14.0217W
- longitude decdeg: 16.23
- longitude decdir: W
- latitude decdeg: 36.67
- latitude decdir: N
Time: date and time are currently class character, need to be changed to strptime, but the user can of course do that in post Generalization: as described above, the function was build for a specific data set and should become more generally useable with time