-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathread_deployment_bottle.R
52 lines (29 loc) · 1.74 KB
/
read_deployment_bottle.R
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
read_deployment_bottle <- function (file_in_WINKLER,station,cruise) {
if (cruise == "bioargomed") {
print(file_in_WINKLER)
# Read the Winkler file of the bioargomed cruise
WINKLER=read.table(file_in_WINKLER,header=TRUE,comment="#",sep=",")
#################################################################################################
# Transformation between Winkler doxy to Winkler PPOX DOXY With WINKLER_TEMP and WINKLER_PSAL
#################################################################################################
WINKLER_DOXY=WINKLER$OXYGEN[which(WINKLER$CASTNO == station)]
WINKLER_PRES=WINKLER$CTDPRS[which(WINKLER$CASTNO == station)]
WINKLER_PSAL=WINKLER$CTDSAL[which(WINKLER$CASTNO == station)]
WINKLER_TEMP=WINKLER$CTDTMP[which(WINKLER$CASTNO == station)]
}
if (cruise == "soclim") {
# Read the Winkler file of the soclim cruise
WINKLER=read.table(file_in_WINKLER,header=TRUE,comment="#",sep="\t")
#################################################################################################
# Transformation between Winkler doxy to Winkler PPOX DOXY With WINKLER_TEMP and WINKLER_PSAL
#################################################################################################
WINKLER_DOXY=WINKLER$O2winkler[which(WINKLER$Station == station)]
WINKLER_PRES=WINKLER$Pressure[which(WINKLER$Station == station)]
WINKLER_PSAL=WINKLER$Salinity[which(WINKLER$Station == station)]
WINKLER_TEMP=WINKLER$Temperature[which(WINKLER$Station == station)]
# in soclim DOXY is given in micromol/l let's convert it in umol/kg
swRho_DOXY=swRho(WINKLER_PSAL,WINKLER_TEMP , WINKLER_PRES)
WINKLER_DOXY=WINKLER_DOXY*1000/swRho_DOXY # en micromol / kg
}
return(list(PRES=WINKLER_PRES,DOXY=WINKLER_DOXY,PSAL=WINKLER_PSAL,TEMP=WINKLER_TEMP))
}