[CHNOSZ-commits] r533 - in pkg/CHNOSZ: . R demo inst inst/extdata/OBIGT man/macros

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jun 29 06:55:42 CEST 2020


Author: jedick
Date: 2020-06-29 06:55:42 +0200 (Mon, 29 Jun 2020)
New Revision: 533

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/water.R
   pkg/CHNOSZ/demo/DEW.R
   pkg/CHNOSZ/inst/NEWS
   pkg/CHNOSZ/inst/extdata/OBIGT/DEW_aq.csv
   pkg/CHNOSZ/man/macros/macros.Rd
Log:
changing water model with water() changes literature references


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2020-06-27 00:51:15 UTC (rev 532)
+++ pkg/CHNOSZ/DESCRIPTION	2020-06-29 04:55:42 UTC (rev 533)
@@ -1,6 +1,6 @@
-Date: 2020-06-20
+Date: 2020-06-29
 Package: CHNOSZ
-Version: 1.3.6-9
+Version: 1.3.6-10
 Title: Thermodynamic Calculations and Diagrams for Geochemistry
 Authors at R: c(
     person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"),

Modified: pkg/CHNOSZ/R/water.R
===================================================================
--- pkg/CHNOSZ/R/water.R	2020-06-27 00:51:15 UTC (rev 532)
+++ pkg/CHNOSZ/R/water.R	2020-06-29 04:55:42 UTC (rev 533)
@@ -8,11 +8,20 @@
   if(is.null(property)) return(get("thermo", CHNOSZ)$opt$water)
   # set water option
   if(length(property)==1 & any(property %in% c("SUPCRT", "SUPCRT92", "IAPWS", "IAPWS95", "DEW"))) {
-    thermo <- get("thermo", CHNOSZ)
-    oldwat <- thermo$opt$water
-    thermo$opt$water <- property
-    assign("thermo", thermo, CHNOSZ)
-    message(paste("water: setting thermo$opt$water to", property))
+    # change references 20200629
+    if(property %in% c("SUPCRT", "SUPCRT92")) {
+      suppressMessages(mod.obigt("water", ref1 = "HGK84"))
+      suppressMessages(mod.obigt("water", ref2 = "JOH92"))
+    } else if(property %in% c("IAPWS", "IAPWS95")) {
+      suppressMessages(mod.obigt("water", ref1 = "WP02"))
+      suppressMessages(mod.obigt("water", ref2 = NA))
+    } else if(property == "DEW") {
+      suppressMessages(mod.obigt("water", ref1 = "SHA14"))
+      suppressMessages(mod.obigt("water", ref2 = NA))
+    }
+    oldwat <- thermo()$opt$water
+    thermo("opt$water" = property)
+    message(paste("water: setting water model to", property))
     return(invisible(oldwat))
   }
   # make T and P equal length

Modified: pkg/CHNOSZ/demo/DEW.R
===================================================================
--- pkg/CHNOSZ/demo/DEW.R	2020-06-27 00:51:15 UTC (rev 532)
+++ pkg/CHNOSZ/demo/DEW.R	2020-06-29 04:55:42 UTC (rev 533)
@@ -114,8 +114,9 @@
 #t1 <- quote("CHNOSZ default database"[])
 #t2 <- quote("(not recommended for high"~italic(P)*")")
 #mtitle(as.expression(c(t1, t2)))
-# make diagram using CO2, HCO3-, CO3-2, and methane data from DEW spreadsheet
-add.obigt("DEW_aq", c("CO2", "HCO3-", "CO3-2", "methane"))
+# make diagram using CO2, HCO3-, CO3-2, CH4, and acetic acid data from DEW spreadsheet
+# (the acetate field disappears if we also use the data for acetate from the spreadsheet 20200629)
+add.obigt("DEW_aq", c("CO2", "HCO3-", "CO3-2", "CH4", "acetic acid"))
 dfun()
 CO2quote <- quote(list(CO[2], HCO[3]^"-", CO[3]^"-2"))
 DEWexpr <- substitute("DEW data for"~x, list(x=CO2quote))
@@ -140,7 +141,7 @@
 water("DEW")
 # add species data for DEW
 inorganics <- c("methane", "CO2", "HCO3-", "CO3-2")
-organics <- c("formic acid", "formate", "acetic acid", "acetate", "propanoic acid", "propanoate")
+organics <- c("formic acid", "formate", "acetic acid", "acetate")
 # skip updating acetate because the new data from the DEW spreadsheet give different logK
 add.obigt("DEW", c(inorganics, organics[-4]))
 ## set basis species

Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS	2020-06-27 00:51:15 UTC (rev 532)
+++ pkg/CHNOSZ/inst/NEWS	2020-06-29 04:55:42 UTC (rev 533)
@@ -1,4 +1,4 @@
-CHANGES IN CHNOSZ 1.3.6-9 (2020-06-21)
+CHANGES IN CHNOSZ 1.3.6-10 (2020-06-29)
 --------------------------------------
 
 - OBIGT/organic_aq.csv, AkDi.csv, DEW_aq.csv: Remove "methane" as the
@@ -24,6 +24,9 @@
 
 - Install bibtex file (docs/obigt.bib) for use in logKcalc package.
 
+- Changing the water model with water() now updates the literature
+  reference in thermo()$obigt.
+
 - TODO: thermo.refs(): add current date, write 'thermo()$obigt'.
 
 - TODO: use degree sign in messages from subcrt().
@@ -36,6 +39,10 @@
 
 - TODO: change references for water for different models (IAPWS, DEW)
 
+- TODO: change \url to \doi in Rd files
+
+- TODO: use all caps OBIGT in function and variable names
+
 CHANGES IN CHNOSZ 1.3.6 (2020-03-16)
 ------------------------------------
 

Modified: pkg/CHNOSZ/inst/extdata/OBIGT/DEW_aq.csv
===================================================================
--- pkg/CHNOSZ/inst/extdata/OBIGT/DEW_aq.csv	2020-06-27 00:51:15 UTC (rev 532)
+++ pkg/CHNOSZ/inst/extdata/OBIGT/DEW_aq.csv	2020-06-29 04:55:42 UTC (rev 533)
@@ -64,7 +64,7 @@
 glutamate,GLUTAMATE,C5H8NO4-,aq,DEW17,NA,26.Sep.17,cal,-167258,0,44.4,11.11,79.71,17.46,12.34,-5.51,-3.29,50,-14.8,0.9569,-1
 "glutamic acid",GLUTAMIC,C5H9NO4,aq,DEW17,NA,26.Sep.17,cal,-173050,-234820,61.2,44.02,90.16,19.3,13.3,-4.4,-3.33,69.2,-9.22,0.7,0
 glutamine,GLUTAMINE,C5H10N2O3,aq,DEW17,NA,26.Sep.17,cal,-126280,-191860,62.41,43.78,93.72,19.8075,14.5756,-7.3834,-3.3816,33.4802,5.8825,0.18,0
-h-glutarate,GLUTARATE-,C5H7O4-,aq,DEW17,NA,26.Sep.17,cal,-170860,-223570,52.9,20.11,85.91,18.6019,13.4277,-6.4209,-3.3341,25.5789,1.0616,0.8279,-1
+H-glutarate,GLUTARATE-,C5H7O4-,aq,DEW17,NA,26.Sep.17,cal,-170860,-223570,52.9,20.11,85.91,18.6019,13.4277,-6.4209,-3.3341,25.5789,1.0616,0.8279,-1
 "glutaric acid",GLUTARIC-ACID,C5H8O4,aq,DEW17,NA,26.Sep.17,cal,-176780,-223440,73.2,64.11,99.09,20.7169,15.4414,-8.1094,-3.4173,42.815,10.0236,-0.1,0
 glycine,GLYCINE,C2H5NO2,aq,DEW17,NA,26.Sep.17,cal,-90950,-124780,39.3,9.49,43.29,10.8,1.3,7.6,-3.5,28,-8.2,0.2,0
 glycolate,GLYCOLATE,C2H3O3-,aq,DEW17,NA,26.Sep.17,cal,-121170,-154700,26.2,6.5,39.85,6.7382,13.1933,1.8519,-3.3244,21.339,-1.7106,1.2334,-1

Modified: pkg/CHNOSZ/man/macros/macros.Rd
===================================================================
--- pkg/CHNOSZ/man/macros/macros.Rd	2020-06-27 00:51:15 UTC (rev 532)
+++ pkg/CHNOSZ/man/macros/macros.Rd	2020-06-29 04:55:42 UTC (rev 533)
@@ -27,7 +27,7 @@
 \newcommand{\P}{\ifelse{latex}{\eqn{P}}{\ifelse{html}{\out{<I>P</I>}}{P}}}
 % italicize any letter
 \newcommand{\I}{\ifelse{latex}{\eqn{#1}}{\ifelse{html}{\out{<I>#1</I>}}{#1}}}
-\newcommand{\logK}{\ifelse{latex}{\eqn{\log K}}{\ifelse{html}{\out{log<i>K</i>}}{log K}}}
+\newcommand{\logK}{\ifelse{latex}{\out{log\,\emph{K}}}{\ifelse{html}{\out{log <i>K</i>}}{log K}}}
 \newcommand{\logfO2}{\ifelse{latex}{\eqn{\log f_{\mathrm{O_{2}}}}}{\ifelse{html}{\out{log<i>f</i><sub>O<sub>2</sub></sub>}}{logfO2}}}
 \newcommand{\logfH2}{\ifelse{latex}{\eqn{\log f_{\mathrm{H_{2}}}}}{\ifelse{html}{\out{log<i>f</i><sub>H<sub>2</sub></sub>}}{logfH2}}}
 \newcommand{\logaH2}{\ifelse{latex}{\eqn{\log a_{\mathrm{H_{2}}}}}{\ifelse{html}{\out{log<i>a</i><sub>H<sub>2</sub></sub>}}{logaH2}}}



More information about the CHNOSZ-commits mailing list