# [Seacarb-commits] r16 - in pkg/seacarb: . R man

Sat May 2 11:06:15 CEST 2009

Author: gattuso
Date: 2009-05-02 11:06:14 +0200 (Sat, 02 May 2009)
New Revision: 16

pkg/seacarb/R/amp.R
pkg/seacarb/R/pH.R
pkg/seacarb/R/pHslope.R
pkg/seacarb/R/tris.R
pkg/seacarb/man/amp.Rd
pkg/seacarb/man/pH.Rd
pkg/seacarb/man/pHinsi.Rd
pkg/seacarb/man/pHslope.Rd
pkg/seacarb/man/tris.Rd
Removed:
pkg/seacarb/R/phinsi.R
pkg/seacarb/man/phinsi.Rd
Modified:
pkg/seacarb/DESCRIPTION
Log:

Modified: pkg/seacarb/DESCRIPTION
===================================================================
--- pkg/seacarb/DESCRIPTION	2009-05-02 08:42:27 UTC (rev 15)
+++ pkg/seacarb/DESCRIPTION	2009-05-02 09:06:14 UTC (rev 16)
@@ -1,10 +1,10 @@
Package: seacarb
Title: Calculates parameters of the seawater carbonate system
-Version: 2.1
-Date: 2009-04-21
+Version: 2.1.1
+Date: 2009-04-30
Author: Heloise Lavigne and Aurelien Proye and Jean-Pierre Gattuso. Portions of code and/or corrections were contributed by Jean-Marie Epitalon, Andreas Hofmann, Bernard Gentili, Jim Orr and Karline Soetaert
Description: Calculates parameters of the seawater carbonate system
Maintainer: Jean-Pierre Gattuso <gattuso at obs-vlfr.fr>
URL: http://www.obs-vlfr.fr/~gattuso/seacarb.php
-Packaged: Wed Apr 22 17:23:32 2009; gattuso
+Packaged: Thu Apr 30 23:25:21 2009; gattuso

===================================================================
--- pkg/seacarb/R/amp.R	                        (rev 0)
+++ pkg/seacarb/R/amp.R	2009-05-02 09:06:14 UTC (rev 16)
@@ -0,0 +1,17 @@
+# Copyright (C) 2009 Jean-Pierre Gattuso
+#
+# This file is part of seacarb.
+#
+# Seacarb is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.
+#
+# Seacarb is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with seacarb; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+#
+"amp" <-
+function(S=35,T=25){
+	amp = (111.35+5.44875*S)*1/(T+273.15)+41.6775-0.015683*S-6.20815*log(T+273.15)-log10(1-0.00106*S)
+	attr(amp,"unit") <- "mol/kg"
+	return(amp)
+}
\ No newline at end of file

Property changes on: pkg/seacarb/R/amp.R
___________________________________________________________________
Name: svn:executable
+ *

===================================================================
--- pkg/seacarb/R/pH.R	                        (rev 0)
+++ pkg/seacarb/R/pH.R	2009-05-02 09:06:14 UTC (rev 16)
@@ -0,0 +1,20 @@
+# Copyright (C) 2009 Jean-Pierre Gattuso
+#
+# This file is part of seacarb.
+#
+# Seacarb is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.
+#
+# Seacarb is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with seacarb; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+#
+"pH" <-
+function(Ex=-67,Etris=-72.4,S=35,T=25){
+	R  =  8.31447215 # J K–1 mol–1, Dickson et al. (2007)
+	F  =  96485.339924 # C mol–1, Dickson et al. (2007)
+	pH = tris(S=S, T=T) + (Etris/1000-Ex/1000)/(R*(T + 273.15)*log(10)/F)
+	attr(pH,"unit") <- "mol/kg"
+	attr(pH, "pH scale") <- "total scale"
+	return(pH)
+}
\ No newline at end of file

Property changes on: pkg/seacarb/R/pH.R
___________________________________________________________________
Name: svn:executable
+ *

===================================================================
--- pkg/seacarb/R/pHslope.R	                        (rev 0)
+++ pkg/seacarb/R/pHslope.R	2009-05-02 09:06:14 UTC (rev 16)
@@ -0,0 +1,20 @@
+# Copyright (C) 2009 Jean-Pierre Gattuso
+#
+# This file is part of seacarb.
+#
+# Seacarb is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.
+#
+# Seacarb is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with seacarb; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+#
+"pHslope" <-
+function(Etris=-72.4,Eamp=4.9,S=35,T=25){
+#	Etris=-99.4; Eamp=-18.9; S=35.1; T=1.6
+	R  =  8.31447215 # J K–1 mol–1, Dickson et al. (2007)
+	F  =  96485.339924 # C mol–1, Dickson et al. (2007)
+	pHslope = 100*(((Eamp/1000-Etris/1000)/(tris(S=S,T=T)-amp(S=S,T=T)))-(R*(T + 273.15)*log(10)/F))/(R*(T + 273.15)*log(10)/F)
+	attr(pHslope,"unit") <- "percent"
+	return(pHslope)
+}
\ No newline at end of file

Property changes on: pkg/seacarb/R/pHslope.R
___________________________________________________________________
Name: svn:executable
+ *

Deleted: pkg/seacarb/R/phinsi.R
===================================================================
--- pkg/seacarb/R/phinsi.R	2009-05-02 08:42:27 UTC (rev 15)
+++ pkg/seacarb/R/phinsi.R	2009-05-02 09:06:14 UTC (rev 16)
@@ -1,22 +0,0 @@
-# Copyright (C) 2003 Jean-Pierre Gattuso and Aurelien Proye
-#
-# This file is part of seacarb.
-#
-# Seacarb is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.
-#
-# Seacarb is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with seacarb; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-#
-#
-"phinsi" <- function(PH=8.2, ALK=2.4e-3, Tinsi=20, Tlab=25, S=35, Pt = 0, Sit = 0, k1k2='l', kf='pf', pHscale="T") {
-	# according to Hunter (1998)
-	#si TA=0 alors calculer TA: TA=660+47.6 * S
-	dat1 <- carb(flag = 8, var1 = PH, var2 = ALK, S = S, T = Tlab, P = 0, Pt = Pt, Sit = Sit, k1k2=k1k2, kf=kf, pHscale=pHscale)
-	DIC <- dat1$DIC - dat2 <- carb(flag = 15, var1 = ALK, var2 = DIC, S = S, T = Tinsi, P = 0, Pt = Pt, Sit = Sit, k1k2=k1k2, kf=kf, pHscale=pHscale) - ph_insi <- dat2$pH
-	#utiliser DIC et TA pour calculer pH in situ (flag=15)
-	#attr(bor,"unit") <- "mol/kg"
-	return(ph_insi)
-}

===================================================================
--- pkg/seacarb/R/tris.R	                        (rev 0)
+++ pkg/seacarb/R/tris.R	2009-05-02 09:06:14 UTC (rev 16)
@@ -0,0 +1,17 @@
+# Copyright (C) 2009 Jean-Pierre Gattuso
+#
+# This file is part of seacarb.
+#
+# Seacarb is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.
+#
+# Seacarb is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with seacarb; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+#
+"tris" <-
+function(S=35,T=25){
+	tris = ((11911.08-18.2499*S-0.039336*S^2)*1/(T+273.15))-366.27059+0.53993607*S+0.00016329*S^2+((64.52243-0.084041*S)*log(T+273.15))-(0.11149858*(T+273.15))
+	attr(tris,"unit") <- "mol/kg"
+	return(tris)
+}
\ No newline at end of file

Property changes on: pkg/seacarb/R/tris.R
___________________________________________________________________
Name: svn:executable
+ *

===================================================================
--- pkg/seacarb/man/amp.Rd	                        (rev 0)
+++ pkg/seacarb/man/amp.Rd	2009-05-02 09:06:14 UTC (rev 16)
@@ -0,0 +1,38 @@
+\encoding{latin1}
+\name{amp}
+\alias{amp}
+
+\title{pH value of the AMP buffer}
+\description{pH value of the AMP buffer (on the total scale in mol/kg)}
+\usage{
+amp(S=35,T=25)
+}
+%- maybe also 'usage' for other objects documented here.
+\arguments{
+  \item{S}{Salinity, default is 35}
+  \item{T}{Temperature in degrees Celsius, default is 25oC}
+}
+
+\details{Note that the arguments can be given as a unique number or as vectors. If the lengths of the vectors are different, the longer vector is retained and only the first value of the other vectors is used. It can therefore be critical to use vectors of the same length.}
+
+\value{
+  \item{AMP}{pH value of the AMP buffer (on the total scale in mol/kg)}
+
+}
+\references{
+Dickson A. G., Sabine C. L. and Christian J. R., 2007 Guide to best practices for ocean CO2 measurements. \emph{PICES Special Publication} \bold{3}, 1-191.
+}
+
+\author{
+Jean-Pierre Gattuso \email{gattuso at obs-vlfr.fr}
+}
+
+\seealso{
+}
+
+\examples{
+	##Example from Dickson et al. (2007)
+	amp(S=35,T=25)
+}
+\keyword{utilities}

Property changes on: pkg/seacarb/man/amp.Rd
___________________________________________________________________
Name: svn:executable
+ *

===================================================================
--- pkg/seacarb/man/pH.Rd	                        (rev 0)
+++ pkg/seacarb/man/pH.Rd	2009-05-02 09:06:14 UTC (rev 16)
@@ -0,0 +1,41 @@
+\encoding{latin1}
+\name{pH}
+\alias{pH}
+
+\title{Potentiometric pH}
+\description{Calculation of potentiometric pH}
+\usage{
+	pH(Ex=-67,Etris=-72.4,S=35,T=25)
+	%- maybe also 'usage' for other objects documented here.
+}
+
+\arguments{
+	\item{Ex}{e.m.f. of the seawater sample in mV, default is 67}
+	\item{Etris}{e.m.f. of the TRIS buffer in mV, default is -72.4}
+	\item{S}{Salinity, default is 35}
+	\item{T}{Temperature in degrees Celsius, default is 25oC}
+}
+
+\details{Note that the arguments can be given as a unique number or as vectors. If the lengths of the vectors are different, the longer vector is retained and only the first value of the other vectors is used. It can therefore be critical to use vectors of the same length.}
+
+\value{
+  \item{pH}{Potentiometric pH (in mol/kg on the total scale)}
+
+}
+\references{
+Dickson A. G., Sabine C. L. and Christian J. R., 2007 Guide to best practices for ocean CO2 measurements. \emph{PICES Special Publication} \bold{3}, 1-191.
+}
+
+\author{
+Jean-Pierre Gattuso \email{gattuso at obs-vlfr.fr}
+}
+
+\seealso{
+}
+
+\examples{
+	##Example from Dickson et al. (2007)
+	pH(Ex=-67,Etris=-72.4,S=35,T=25)
+}
+\keyword{utilities}

Property changes on: pkg/seacarb/man/pH.Rd
___________________________________________________________________
Name: svn:executable
+ *

===================================================================
--- pkg/seacarb/man/pHinsi.Rd	                        (rev 0)
+++ pkg/seacarb/man/pHinsi.Rd	2009-05-02 09:06:14 UTC (rev 16)
@@ -0,0 +1,40 @@
+\encoding{latin1}
+\name{pHinsi}
+\alias{pHinsi}
+\title{pH at in situ temperature}
+\description{pH at in situ temperature}
+\usage{
+pHinsi(PH=8.2, ALK=2.4e-3, Tinsi=20, Tlab=25, S=35, Pt=0, Sit=0, k1k2 = "l", kf = "pf", pHscale = "T")
+}
+%- maybe also 'usage' for other objects documented here.
+\arguments{
+  \item{PH}{pH measured in the laboratory}
+  \item{ALK}{ALK, total alkalinity (mol/kg)}
+  \item{Tinsi}{In situ temperature in degrees Celsius}
+  \item{Tlab}{Measurement temperature in degrees Celsius}
+  \item{S}{Salinity}
+  \item{Pt}{value of the concentration of total phosphate in mol/kg}
+  \item{Sit}{the value of the total silicate in mol/kg}
+	\item{k1k2}{"l" for using K1 and K2 from Lueker et al. and "r" for using K1 and K2 from Roy et al. , default is "l"}
+	\item{kf}{"pf" for using Kf from Perez and Fraga (1987) and "dg" for using Kf from Dickson and Goyet (1979), default is "pf"}
+	\item{pHscale}{choice of pH scale: "T" for the total scale, "F" for the free scale and "SWS" for using the seawater scale, default is "T" (total scale)}}
+
+\value{
+  \item{pH}{pH at in situ temperature}
+}
+
+\references{
+Hunter K. A., 1998. The temperature dependence of pH in surface seawater. \emph{Deep-Sea Research (Part I, Oceanographic Research Papers)} \bold{45}(11):1919-1930.
+}
+
+\author{
+Jean-Pierre Gattuso, \email{gattuso at obs-vlfr.fr}
+}
+
+
+\examples{
+  pHinsi(8.2,2.4e-3,25,25,35,0,0)
+}
+
+\keyword{utilities}

Property changes on: pkg/seacarb/man/pHinsi.Rd
___________________________________________________________________
Name: svn:executable
+ *

===================================================================
--- pkg/seacarb/man/pHslope.Rd	                        (rev 0)
+++ pkg/seacarb/man/pHslope.Rd	2009-05-02 09:06:14 UTC (rev 16)
@@ -0,0 +1,41 @@
+\encoding{latin1}
+\name{pHslope}
+\alias{pHslope}
+
+\title{Slope of the calibration curve of a pH electrode}
+\description{Slope of the calibration curve of a pH electrode (percent of theoretical slope)}
+\usage{
+pHslope(Etris=-72.4,Eamp=4.9,S=35,T=25)
+%- maybe also 'usage' for other objects documented here.
+}
+
+\arguments{
+  \item{Etris}{e.m.f. of the TRIS buffer in mV, default is -72.4}
+  \item{Eamp}{e.m.f. of the AMP buffer in mV, default is 4.9}
+  \item{S}{Salinity, default is 35}
+  \item{T}{Temperature in degrees Celsius, default is 25oC}
+}
+
+\details{Note that the arguments can be given as a unique number or as vectors. If the lengths of the vectors are different, the longer vector is retained and only the first value of the other vectors is used. It can therefore be critical to use vectors of the same length.}
+
+\value{
+  \item{pHslope}{Slope of the calibration curve (in percent of theoretical slope)}
+
+}
+\references{
+Dickson A. G., Sabine C. L. and Christian J. R., 2007 Guide to best practices for ocean CO2 measurements. \emph{PICES Special Publication} \bold{3}, 1-191.
+}
+
+\author{
+Jean-Pierre Gattuso \email{gattuso at obs-vlfr.fr}
+}
+
+\seealso{
+}
+
+\examples{
+	##Example from Dickson et al. (2007)
+	pHslope(Etris=-72.4,Eamp=4.9,S=35,T=25)
+}
+\keyword{utilities}

Property changes on: pkg/seacarb/man/pHslope.Rd
___________________________________________________________________
Name: svn:executable
+ *

Deleted: pkg/seacarb/man/phinsi.Rd
===================================================================
--- pkg/seacarb/man/phinsi.Rd	2009-05-02 08:42:27 UTC (rev 15)
+++ pkg/seacarb/man/phinsi.Rd	2009-05-02 09:06:14 UTC (rev 16)
@@ -1,40 +0,0 @@
-\encoding{latin1}
-\name{phinsi}
-\alias{phinsi}
-\title{pH at in situ temperature}
-\description{pH at in situ temperature}
-\usage{
-phinsi(PH=8.2, ALK=2.4e-3, Tinsi=20, Tlab=25, S=35, Pt=0, Sit=0, k1k2 = "l", kf = "pf", pHscale = "T")
-}
-%- maybe also 'usage' for other objects documented here.
-\arguments{
-  \item{PH}{pH measured in the laboratory}
-  \item{ALK}{ALK, total alkalinity (mol/kg)}
-  \item{Tinsi}{In situ temperature in degrees Celsius}
-  \item{Tlab}{Measurement temperature in degrees Celsius}
-  \item{S}{Salinity}
-  \item{Pt}{value of the concentration of total phosphate in mol/kg}
-  \item{Sit}{the value of the total silicate in mol/kg}
-	\item{k1k2}{"l" for using K1 and K2 from Lueker et al. and "r" for using K1 and K2 from Roy et al. , default is "l"}
-	\item{kf}{"pf" for using Kf from Perez and Fraga (1987) and "dg" for using Kf from Dickson and Goyet (1979), default is "pf"}
-	\item{pHscale}{choice of pH scale: "T" for the total scale, "F" for the free scale and "SWS" for using the seawater scale, default is "T" (total scale)}}
-
-\value{
-  \item{pH}{pH at in situ temperature}
-}
-
-\references{
-Hunter K. A., 1998. The temperature dependence of pH in surface seawater. \emph{Deep-Sea Research (Part I, Oceanographic Research Papers)} \bold{45}(11):1919-1930.
-}
-
-\author{
-Jean-Pierre Gattuso, \email{gattuso at obs-vlfr.fr}
-}
-
-
-\examples{
-  phinsi(8.2,2.4e-3,25,25,35,0,0)
-}
-
-\keyword{utilities}

===================================================================
--- pkg/seacarb/man/tris.Rd	                        (rev 0)
+++ pkg/seacarb/man/tris.Rd	2009-05-02 09:06:14 UTC (rev 16)
@@ -0,0 +1,39 @@
+\encoding{latin1}
+\name{tris}
+\alias{tris}
+
+\title{pH value of the TRIS buffer}
+\description{pH value of the TRIS buffer (on the total scale in mol/kg)}
+\usage{
+tris(S=35,T=25)
+%- maybe also 'usage' for other objects documented here.
+}
+
+\arguments{
+  \item{S}{Salinity, default is 35}
+  \item{T}{Temperature in degrees Celsius, default is 25oC}
+}
+
+\details{Note that the arguments can be given as a unique number or as vectors. If the lengths of the vectors are different, the longer vector is retained and only the first value of the other vectors is used. It can therefore be critical to use vectors of the same length.}
+
+\value{
+  \item{tris}{pH value of the TRIS buffer (on the total scale in mol/kg)}
+
+}
+\references{
+Dickson A. G., Sabine C. L. and Christian J. R., 2007 Guide to best practices for ocean CO2 measurements. \emph{PICES Special Publication} \bold{3}, 1-191.
+}
+
+\author{
+Jean-Pierre Gattuso \email{gattuso at obs-vlfr.fr}
+}
+
+\seealso{
+}
+
+\examples{
+	##Example from Dickson et al. (2007)
+	tris(S=35,T=25)
+}
+\keyword{utilities}

Property changes on: pkg/seacarb/man/tris.Rd
___________________________________________________________________
Name: svn:executable
+ *