[Seacarb-commits] r6 - in pkg/seacarb: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Apr 3 17:22:40 CEST 2009


Author: gattuso
Date: 2009-04-03 17:22:40 +0200 (Fri, 03 Apr 2009)
New Revision: 6

Modified:
   pkg/seacarb/ChangeLog
   pkg/seacarb/DESCRIPTION
   pkg/seacarb/R/Kf.R
Log:
Update to 2.0.6 (Kf changed, see changelog)

Modified: pkg/seacarb/ChangeLog
===================================================================
--- pkg/seacarb/ChangeLog	2009-01-06 08:53:54 UTC (rev 5)
+++ pkg/seacarb/ChangeLog	2009-04-03 15:22:40 UTC (rev 6)
@@ -1,7 +1,12 @@
+version 2.0.6, 2009-02-09
+
+Changes made thanks to comments kindly provided by Andreas Hofmann (A.Hofmann at nioo.knaw.nl):
+- Kf was modified in order to convert Kf from free scale to total scale after pressure corrections in the Dickson and Goyet Method.
+
 --------------------------
 version 2.0.5, 2008-12-08
 
-Changes made thanks to comments kindly provided by Andreas Hofman (A.Hofmann at nioo.knaw.nl):
+Changes made thanks to comments kindly provided by Andreas Hofmann (A.Hofmann at nioo.knaw.nl):
 - K2 modified to fix a bug which provided warnings when several pressures were used.
 - Khs modified to fix a bug (in coefficient a2).
 - The value of the R constant was updated according to Dickson et al. (2007). The new value is 8.314475 J/(K*mol).

Modified: pkg/seacarb/DESCRIPTION
===================================================================
--- pkg/seacarb/DESCRIPTION	2009-01-06 08:53:54 UTC (rev 5)
+++ pkg/seacarb/DESCRIPTION	2009-04-03 15:22:40 UTC (rev 6)
@@ -1,10 +1,10 @@
 Package: seacarb
 Title: Calculates parameters of the seawater carbonate system
-Version: 2.0.5
-Date: 2008-12-08
-Author: Heloise Lavigne and Aurelien Proye and Jean-Pierre Gattuso. Portions of code and/or corrections were contributed by Jean-Marie Epitalon, Bernard Gentili, Jim Orr and Karline Soetaert
+Version: 2.0.6
+Date: 2009-02-23
+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
 License: GPL version 2 or newer
-Packaged: Mon Dec  8 15:36:17 2008; gattuso
+Packaged: Wed Oct 29 00:00:34 2008; gattuso

Modified: pkg/seacarb/R/Kf.R
===================================================================
--- pkg/seacarb/R/Kf.R	2009-01-06 08:53:54 UTC (rev 5)
+++ pkg/seacarb/R/Kf.R	2009-04-03 15:22:40 UTC (rev 6)
@@ -54,14 +54,10 @@
 #
 #   (Dickson and Riley, 1979 in Dickson and Goyet, 
 #   1994, Chapter 5, p. 14)
-#   pH-scale: 'total' 
+#   pH-scale: 'free' (require to convert in total scale after pressure corrections 
 
-Ks <- Ks(S=S, T=T, P=0)
+lnKfdg = 1590.2/TK - 12.641 + 1.525*sqrt(ION);
 
-tmp1 = 1590.2/TK - 12.641 + 1.525*sqrt(ION);
-tmp2 = log(1-0.001005*S) + log(1+ST/Ks);
-lnKfdg = tmp1 + tmp2;
-
 Kfdg <- exp(lnKfdg)
 
 # ---------- Choice between methods (Perez and Dickson) ----------
@@ -120,6 +116,18 @@
 }
 
 
+## pH scale correction in case of Dickson and Goyet method
+## Passage from free scale to total scale
+Ks <- Ks(S=S, T=T, P=P)
+for(i in (1:nK)){
+if(kf[i]=='dg'){
+tmp2 = (1-0.001005*S[i])*(1+ST[i]/Ks[i]); #passage from "free scale" to "total scale"
+Kf[i] = Kf[i]*tmp2;
+}
+}
+ 
+
+
 attr(Kf,"unit")     = "mol/kg-soln"
 attr(Kf,"pH scale") = "total hydrogen ion concentration"
 return(Kf)



More information about the Seacarb-commits mailing list