[CHNOSZ-commits] r361 - in pkg/CHNOSZ: . R inst man tests/testthat

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jan 21 16:40:26 CET 2019


Author: jedick
Date: 2019-01-21 16:40:26 +0100 (Mon, 21 Jan 2019)
New Revision: 361

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/info.R
   pkg/CHNOSZ/inst/NEWS
   pkg/CHNOSZ/man/solubility.Rd
   pkg/CHNOSZ/tests/testthat/test-info.R
Log:
info(): messages display mineral names instead of "cr"


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2019-01-21 03:48:17 UTC (rev 360)
+++ pkg/CHNOSZ/DESCRIPTION	2019-01-21 15:40:26 UTC (rev 361)
@@ -1,6 +1,6 @@
 Date: 2019-01-21
 Package: CHNOSZ
-Version: 1.1.3-68
+Version: 1.1.3-69
 Title: Thermodynamic Calculations and Diagrams for Geo(bio)chemistry
 Authors at R: c(
     person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"),

Modified: pkg/CHNOSZ/R/info.R
===================================================================
--- pkg/CHNOSZ/R/info.R	2019-01-21 03:48:17 UTC (rev 360)
+++ pkg/CHNOSZ/R/info.R	2019-01-21 15:40:26 UTC (rev 361)
@@ -136,6 +136,8 @@
     mystate <- thermo$obigt$state[ispecies.out]
     ispecies.other <- ispecies[!ispecies %in% ispecies.out]
     otherstates <- thermo$obigt$state[ispecies.other]
+    # substitute the mineral name for "cr" 20190121
+    otherstates[otherstates=="cr"] <- thermo$obigt$name[ispecies.other[otherstates=="cr"]]
     transtext <- othertext <- ""
     # we count, but don't show the states for phase transitions (cr2, cr3, etc)
     istrans <- otherstates %in% c("cr2", "cr3", "cr4", "cr5", "cr6", "cr7", "cr8", "cr9")
@@ -144,9 +146,12 @@
       ntrans <- sum(istrans)
       if(ntrans == 1) transtext <- paste(" with", ntrans, "phase transition")
       else if(ntrans > 1) transtext <- paste(" with", ntrans, "phase transitions")
+      # substitute the mineral name for "cr" 20190121
+      mystate <- thermo$obigt$name[ispecies.out]
     }
     otherstates <- otherstates[!istrans]
-    if(length(otherstates) > 0) othertext <- paste0(", also available in ", paste(otherstates, collapse=", "))
+    if(length(otherstates) == 1) othertext <- paste0("; other available phase is ", otherstates)
+    if(length(otherstates) > 1) othertext <- paste0("; other available phases are ", paste(otherstates, collapse=", "))
     if(transtext != "" | othertext != "") {
       starttext <- paste0("info.character: found ", species, "(", mystate, ")")
       message(starttext, transtext, othertext)

Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS	2019-01-21 03:48:17 UTC (rev 360)
+++ pkg/CHNOSZ/inst/NEWS	2019-01-21 15:40:26 UTC (rev 361)
@@ -1,4 +1,4 @@
-CHANGES IN CHNOSZ 1.1.3-68 (2019-01-21)
+CHANGES IN CHNOSZ 1.1.3-69 (2019-01-21)
 ---------------------------------------
 
 BUG FIXES
@@ -195,7 +195,8 @@
 - Change internal variable names in subcrt() for better readability
   (sinfo -> ispecies, inpho -> iphases, sinph -> phasespecies).
 
-- TODO: fix overly long message for info("SiO2").
+- info(): display mineral names instead of just "cr" in messages (e.g.
+  with info("SiO2")).
 
 - Add C implementation of counting occurrences of all letters in a
   string (src/count_letters.c) to speed up operation of count.aa().

Modified: pkg/CHNOSZ/man/solubility.Rd
===================================================================
--- pkg/CHNOSZ/man/solubility.Rd	2019-01-21 03:48:17 UTC (rev 360)
+++ pkg/CHNOSZ/man/solubility.Rd	2019-01-21 15:40:26 UTC (rev 361)
@@ -129,11 +129,12 @@
 lines(a$vals[[1]], sm0$loga.balance, lty=2)
 legend("topright", c("I = 0", "I = calculated", "mosaic method"),
        col = c("pink", "lightblue", "black"), lwd = c(5, 5, 1), lty = c(1, 1, 2))
+title(main = "Solubility of calcite: Ionic strength and mosaic method")
 # the two methods give nearly equivalent results
 stopifnot(all.equal(sa0$loga.balance, sm0$loga.balance))
 stopifnot(all.equal(saI$loga.balance, smI$loga.balance, tolerance = 0.003))
 ## NOTE: the second method (using mosaic) takes longer, but is
-## more flexible; complexes with Ca+2 could be included
+## more flexible; e.g. complexes with Ca+2 could be included
 }
 
 \references{

Modified: pkg/CHNOSZ/tests/testthat/test-info.R
===================================================================
--- pkg/CHNOSZ/tests/testthat/test-info.R	2019-01-21 03:48:17 UTC (rev 360)
+++ pkg/CHNOSZ/tests/testthat/test-info.R	2019-01-21 15:40:26 UTC (rev 361)
@@ -4,7 +4,7 @@
   expect_equal(info.character("acetate", "cr"), NA)
   expect_message(info.character("acetate", "cr"), "only 'aq' is available")
   expect_message(info.character("methane", "cr"), "only 'aq' 'liq' 'gas' are available")
-  expect_message(info.character("methane"), "also available in liq, gas")
+  expect_message(info.character("methane"), "other available phases are liq, gas")
   # H2O is a special case
   expect_equal(info.character("H2O", "aq"), info.character("H2O", "liq"))
 })



More information about the CHNOSZ-commits mailing list