[CHNOSZ-commits] r700 - in pkg/CHNOSZ: . R inst man vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Feb 7 06:26:18 CET 2022


Author: jedick
Date: 2022-02-07 06:26:17 +0100 (Mon, 07 Feb 2022)
New Revision: 700

Removed:
   pkg/CHNOSZ/R/eqdata.R
   pkg/CHNOSZ/man/eqdata.Rd
Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/NAMESPACE
   pkg/CHNOSZ/inst/NEWS.Rd
   pkg/CHNOSZ/man/CHNOSZ-package.Rd
   pkg/CHNOSZ/vignettes/anintro.Rmd
   pkg/CHNOSZ/vignettes/mklinks.sh
   pkg/CHNOSZ/vignettes/vig.bib
Log:
Remove eqdata()


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2022-02-07 04:38:29 UTC (rev 699)
+++ pkg/CHNOSZ/DESCRIPTION	2022-02-07 05:26:17 UTC (rev 700)
@@ -1,6 +1,6 @@
 Date: 2022-02-07
 Package: CHNOSZ
-Version: 1.4.1-25
+Version: 1.4.1-26
 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/NAMESPACE
===================================================================
--- pkg/CHNOSZ/NAMESPACE	2022-02-07 04:38:29 UTC (rev 699)
+++ pkg/CHNOSZ/NAMESPACE	2022-02-07 05:26:17 UTC (rev 700)
@@ -45,7 +45,7 @@
   "DGinf", "SD", "pearson", "shannon", "CV", "logact",
   "EOSlab", "EOScalc",
   "basis.elements", "element.mu", "ibasis",
-  "water.SUPCRT92", "eqdata", "plot_findit",
+  "water.SUPCRT92", "plot_findit",
   "nonideal", "uniprot.aa",
 # added 20170301 or later
   "GHS_Tr", "calculateDensity", "calculateGibbsOfWater",

Deleted: pkg/CHNOSZ/R/eqdata.R
===================================================================
--- pkg/CHNOSZ/R/eqdata.R	2022-02-07 04:38:29 UTC (rev 699)
+++ pkg/CHNOSZ/R/eqdata.R	2022-02-07 05:26:17 UTC (rev 700)
@@ -1,211 +0,0 @@
-# eqdata.R
-# extract data from EQ6 output files
-# 20091028 just for aqueous species
-# 20110410 also get results for solid phases
-# 20110516 use grand summary of solid phases, handle data blocks
-#   with blank rows, add progress messages, get activity of water
-# 20110805 add mineral saturation states and speciation summaries
-# 20190415 add detection of version 7 or 8
-
-eqdata <- function(file, species, property="log act", outfile=TRUE) {
-
-  # first read the entire file
-  lines <- readLines(file)
-  cat(paste("eqdata: read", length(lines), "lines from", file, "\n"))
-  # detect version 7 or 8
-  # grep for "ersion" to match "version" or "Version"
-  vline <- lines[grep("ersion", lines)[1]]
-  version <- strsplit(vline, "ersion ")[[1]][2]
-  v <- substr(version, 1, 1)
-  if(!v %in% c("7", "8")) stop("EQ3/6 version", version, "is unsupported")
-
-  if(v=="7") {
-    # the available properties for different types of data:
-    # solid phases, aqueous species, mineral saturation states, speciation summary
-    props <- list(
-      solid = c("product", "log moles", "moles", "grams", "volume, cc"),
-      aqueous = c("species", "moles", "grams", "conc", "log conc", "log g", "log act"),
-      mineral = c("affinity, kcal"),
-      speciation = c("molal conc", "per cent")
-    )
-    # header lines that begin the result block for this data type
-    headers <- list(
-      # summary of solid product phases
-      #solid = " product                    log moles        moles",
-      # grand summary of solid phases
-      solid = "      phase/end-member       log moles        moles",
-      aqueous = "   species                moles        grams",
-      mineral = "   mineral        affinity, kcal    state",
-      speciation = paste("aqueous species accounting for 99% or more of",species)
-    )
-    # lines that let us know the data block has ended
-    enders <- list(
-      solid = "--- mineral saturation state summary ---",
-      aqueous = "--- major aqueous species contributing to mass balances ---",
-      mineral = "--- summary of gas species ---",
-      speciation = "- - - - - - - - - - - - - - - - - - - - - - -"
-    )
-  }
-
-  # This code does not completely support version 8.
-  # TODO: add headers for solid, mineral, and speciation blocks
-  # FIXME: getziT() does not work
-  if(v=="8") {
-    props <- list(
-      aqueous = c("Species", "Molality", "Log Molality", "Log Gamma", "Log Activity")
-    )
-    headers <- list(
-      aqueous = "    Species                  Molality"
-    )
-    enders <- list(
-      aqueous = "Species with molalities less than"
-    )
-    # change the default property="log act" to "Log Activity"
-    if(property=="log act") property <- "Log Activity"
-  }
-
-  ## process the 'property' argument to
-  ## figure out the data type for the requested property
-  # match property to each list element of props
-  iprops <- sapply(props, function(x,y) match(y,x), y=property)
-  # is this property available?
-  iok <- which(!is.na(iprops))
-  if(length(iok) == 0) stop(paste('property "', property, 
-    '" is not available for any data type',sep=''))
-  # only take the first match
-  # (moles and grams will be matched to solid but not aqueous)
-  itype <- iok[1]
-  # the position (column number) of this property in the data block
-  iprop <- iprops[itype]
-  # the name of our data type (solid, aqueous, mineral, or speciation)
-  mytype <- names(iprop)
-  cat(paste("eqdata: data type for", property, "is", mytype, "\n"))
-  # if we're extracting speciation data, can only do it for one basis species
-  if(mytype == "speciation") {
-    if(length(species) > 1) 
-      stop("speciation data can only be had for a single basis species")
-  }
-  header <- headers[[itype]]
-  ender <- enders[[itype]]
-  ## done processing 'property' argument
-
-  # string constants that show up in the file
-  zistring <- " stepping to zi="
-  Tstring <- "                     temperature    ="
-  H2Ostring <- "                              activity of water ="
-
-  # to find the lines identifying each step of xi
-  zilines <- function(lines) grep(zistring, lines)
-  # to find the lines indicating the temperature
-  Tlines <- function(lines) grep(Tstring, lines)
-  # to find the lines with activity of water
-  H2Olines <- function(lines) grep(H2Ostring, lines)
-
-  # to read the moles etc of aqueous species or solid phases
-  getdata <- function(lines, ihead, property, species) {
-    # the property of a species is NA unless we find it
-    # so we make a list with an entry for each species
-    # the entries are NAs repeated to length of ihead
-    prop.out <- lapply(1:length(species),function(x) rep(NA,length(ihead)))
-    names(prop.out) <- species
-    # loop over each header line
-    for(i in 1:length(ihead)) {
-      # the line number of the header
-      n <- ihead[i]
-      # start reading two lines below the header
-      dn <- 2
-      # or starting 4 lines below the header for 'speciation'
-      if(mytype == "speciation") dn <- 4
-      myline <- lines[n+dn]
-      # read until we reach the end of the block
-      while( length(grep(ender, myline)) == 0 ) {
-        # read all the values that occur on this line
-        myvalues <- strsplit(myline, " ")[[1]]
-        myvalues <- myvalues[!myvalues==""]
-        # logic below depdends on the data type
-        if(mytype == "mineral") {
-          # look for names of minerals whose saturation states are desired
-          jspecies <- which(myvalues %in% species)
-          if(length(jspecies) > 0) {
-            # a loop, in case two desired minerals are on the same line
-            for(j in 1:length(jspecies)) {
-              ispecies <- match(myvalues[jspecies[j]],species)
-              prop.out[[ispecies]][i] <- as.numeric(myvalues[jspecies[j]+1])
-            }
-          }
-        } else if(mytype == "speciation") {
-          # speciation summary
-          # what's the name of this species and value of the property?
-          myspec <- myvalues[[1]]
-          myval <- myvalues[[iprop + 1]]
-          # if this is the first line of the first data block,
-          # then this is the first species in prop.out
-          if(i==1 & dn==4) names(prop.out)[1] <- myspec
-          else if(!myspec %in% names(prop.out)) {
-            # if this species isn't already in prop.out, add it
-            prop.new <- list(rep(NA, length(ihead)))
-            names(prop.new) <- myspec
-            prop.out <- c(prop.out, prop.new)
-          }
-          # save the value for this species
-          ispec <- match(myspec, names(prop.out))
-          prop.out[[ispec]][i] <- as.numeric(myval)
-        } else {
-          # properties of aqueous species or solid phases
-          ispecies <- match(myvalues[1], species)
-          # did we hit one of the desired species or phases?
-          if(!is.na(ispecies)) prop.out[[ispecies]][i] <- as.numeric(myvalues[iprop])
-        }
-        # go to the next line
-        dn <- dn + 1
-        myline <- lines[n+dn]
-      }
-    }
-    prop.out <- data.frame(prop.out, check.names=FALSE)
-    return(prop.out)
-  }
-
-  # to get the values of zi or T for each of the data blocks identified by ihead
-  getziT <- function(lines, iziT, ihead, Astring, Bstring=NULL) {
-    # the linenumbers of zi/T before each of the data blocks
-    myziT <- sapply(ihead,function(x, y) {max(iziT[x > y])}, iziT)
-    # to get values of zi/T:
-    # first split at Astring (beginning of line)
-    # then at Bstring (after value)
-    # then convert to numeric
-    if(is.null(Bstring)) ziT <- sapply(myziT,function(x) {
-      as.numeric(strsplit(lines[x], Astring)[[1]][2]) } )
-    else ziT <- sapply(myziT,function(x) {
-      as.numeric(strsplit(strsplit(lines[x], Astring)[[1]][2], Bstring)[[1]][1]) } )
-    return(ziT)
-  }
-
-  # put it all together
-  # get the line numbers where the data blocks start
-  # without fixed=TRUE this fails for e.g. zn+2 !!
-  ihead <- grep(header, lines, fixed=TRUE)
-  if(length(ihead)==0) stop(paste("no data blocks found for", mytype))
-  cat(paste("eqdata: found", length(ihead), "data blocks starting at line", ihead[1], "\n"))
-  # get values of zi for these data blocks
-  izi <- zilines(lines)
-  zi <- getziT(lines, izi, ihead, zistring, ",")
-  # get values of T for these data blocks
-  iT <- Tlines(lines)
-  T <- getziT(lines, iT, ihead, Tstring, " degrees")
-  # get activity of water
-  iH2O <- H2Olines(lines)
-  aH2O <- getziT(lines, iH2O, ihead, H2Ostring)
-  # get properties of aqueous species or solid phases
-  mydata <- getdata(lines, ihead, property, species)
-  # make a single table
-  out <- cbind(zi, T, aH2O, mydata)
-  # save it to a file
-  if(isTRUE(outfile) | is.character(outfile)) {
-    if(!is.character(outfile)) outfile <- paste(file, property, "csv", sep=".")
-    write.csv(out, outfile, row.names=FALSE)
-    cat(paste("eqdata: saved results to", outfile, "\n"))
-  } 
-  # done!
-  return(invisible(out))
-
-}

Modified: pkg/CHNOSZ/inst/NEWS.Rd
===================================================================
--- pkg/CHNOSZ/inst/NEWS.Rd	2022-02-07 04:38:29 UTC (rev 699)
+++ pkg/CHNOSZ/inst/NEWS.Rd	2022-02-07 05:26:17 UTC (rev 700)
@@ -10,7 +10,7 @@
 \newcommand{\s}{\ifelse{latex}{\eqn{_{#1}}}{\ifelse{html}{\out{<sub>#1</sub>}}{#1}}}
 \newcommand{\S}{\ifelse{latex}{\eqn{^{#1}}}{\ifelse{html}{\out{<sup>#1</sup>}}{^#1}}}
 
-\section{Changes in CHNOSZ version 1.4.1-25 (2022-02-07)}{
+\section{Changes in CHNOSZ version 1.4.1-26 (2022-02-07)}{
 
   \subsection{PLANNED API CHANGE}{
     \itemize{
@@ -82,19 +82,31 @@
 
       \item Tests are now run using the \CRANpkg{tinytest} package.
 
-      \item Remove \code{maxdiff()} and \code{expect_maxdiff()}.
+      \item In \file{vignettes/multi-metal.Rmd} (\dQuote{Diagrams with multiple
+        metals}), add a link to the associated paper
+      (\href{https://doi.org/10.1016/j.acags.2021.100059}{Dick, 2021}).
 
+    }
+  }
+
+  \subsection{REMOVED FUNCTIONS}{
+    \itemize{
+
+      \item Remove \code{maxdiff()} and \code{expect_maxdiff()}, previously
+      used in tests.
+
       \item Remove \code{read.blast()}, \code{id.blast()},
       \code{write.blast()}, \code{def2gi()}, and example files in
       \file{extdata/bison}.
+
+      \item Remove \code{eqdata()}, a script for extracting data from EQ3/6
+      output files.
       
-      \item In \file{vignettes/multi-metal.Rmd} (\dQuote{Diagrams with multiple
-        metals}), add a link to the associated paper
-      (\href{https://doi.org/10.1016/j.acags.2021.100059}{Dick, 2021}).
-
     }
   }
 
+
+
 }
 
 \section{Changes in CHNOSZ version 1.4.1 (2021-04-08)}{

Modified: pkg/CHNOSZ/man/CHNOSZ-package.Rd
===================================================================
--- pkg/CHNOSZ/man/CHNOSZ-package.Rd	2022-02-07 04:38:29 UTC (rev 699)
+++ pkg/CHNOSZ/man/CHNOSZ-package.Rd	2022-02-07 05:26:17 UTC (rev 700)
@@ -25,7 +25,7 @@
   \item Thermodynamic calculations: \code{\link{util.formula}}, \code{\link{makeup}}, \code{\link{util.units}}, \code{\link{eos}}, \code{\link{Berman}}, \code{\link{nonideal}}, \code{\link{util.misc}}
   \item Water properties: \code{\link{water}}, \code{\link{util.water}}, \code{\link{DEW}}, \code{\link{IAPWS95}}
   \item Protein properties: \code{\link{protein.info}}, \code{\link{add.protein}}, \code{\link{util.fasta}}, \code{\link{util.protein}}, \code{\link{util.seq}}, \code{\link{ionize.aa}}
-  \item Other tools: \code{\link{examples}}, \code{\link{eqdata}}, \code{\link{taxonomy}}
+  \item Other tools: \code{\link{examples}}, \code{\link{taxonomy}}
   \item Utility functions: \code{\link{util.expression}}, \code{\link{util.plot}}, \code{\link{util.array}}, \code{\link{util.list}}, \code{\link{palply}}
 }
 These concept entries are visible to \code{\link{help.search}} (aka \code{??}).

Deleted: pkg/CHNOSZ/man/eqdata.Rd
===================================================================
--- pkg/CHNOSZ/man/eqdata.Rd	2022-02-07 04:38:29 UTC (rev 699)
+++ pkg/CHNOSZ/man/eqdata.Rd	2022-02-07 05:26:17 UTC (rev 700)
@@ -1,58 +0,0 @@
-\encoding{UTF-8}
-\name{eqdata}
-\alias{eqdata}
-\title{Read data from an EQ6 output file}
-\description{
-Extract computational results for aqueous species, solid phases, mineral saturation states, or speciation summaries at each step of reaction progress in an EQ6 output file.
-The results are written to a comma-separated value file that can be read by other programs.
-The function has been tested with output files generated by EQ3/6 version 7.1 running on a Unix platform.
-Currently there is only partial support for version 8.0a (reading data from aqueous species blocks).
-}
-
-\usage{
-  eqdata(file, species, property = "log act", outfile = TRUE)
-}
-
-\arguments{
-  \item{file}{character, path to EQ6 output file}
-  \item{species}{character, name(s) of species or minerals}
-  \item{property}{character, property to get}
-  \item{outfile}{logical or character, file for saving results}
-}
-
-\details{
-
-  The first argument, \code{file}, is the name of the EQ6 (Wolery, 1992; Wolery and Daveler, 1992) output file. \code{species} indicates the aqueous species, solid phases, minerals, or basis species for which you want values; multiple names can be provided except for basis species, which can be a single value. \code{property} indicates the property to retrieve. Specifying a value other than one listed below will cause an error.
-
-  \itemize{
-    \item Aqueous species: \samp{conc}, \samp{log conc}, \samp{log g}, or \samp{log act}
-    \item Solid phases: \samp{log moles}, \samp{moles}, \samp{grams}, or \samp{volume, cc}
-    \item Minerals (saturation states): \samp{affinity, kcal}
-    \item Basis species (speciation): \samp{molal conc} or \samp{per cent}
-  }
-
-
-  The result of the function is a data frame (returned invisibly), with columns \code{zi} (reaction progress), \code{T} (temperature in \degC, \code{aH2O} (activity of water) and one column for each of the requested \code{species} or, for speciation of basis species, one column for each unique species found in all of the speciation summary blocks for that basis species. Values are listed as NA (not available) for species or phases that are not present in the EQ6 output at any of the increments of reaction progress. 
-
-  If \code{outfile} is TRUE, the result is saved in a file named like \samp{file}.\samp{property}.\code{csv}, in the same directory as \code{file}. The name of the \code{outfile} can be provided to override this naming scheme, or this argument can be set to FALSE or NULL, to turn off writing the result to a file.
-
-  Thanks to Peter Canovas and Everett Shock for helping to test the code and offering ideas for improvements.
-}
-
-\references{
-  Wolery, T. J. (1992) EQ3/6, A Software Package for Geochemical Modeling of Aqueous Systems: Package Overview and Installation Guide (Version 7.0). Lawrence Livermore National Laboratory, UCRL-MA-110662 PT I. \url{https://www.wipp.energy.gov/library/cra/2009_cra/references/Others/Wolery_1992_EQ36_A_Software_Package_for_Geochemical_Modeling_of_Aqueous_Systems_ERMS241375.pdf}
-
-  Wolery, T. J. and Daveler, S. A. (1992) EQ6, A Computer Program for Reaction Path Modeling of Aqueous Geochemical Systems: Theoretical Manual, User's Guide, and Related Documentation (Version 7.0). Lawrence Livermore National Laboratory, UCRL-MA-110662 PT IV. \url{https://www.wipp.energy.gov/library/cra/2009_cra/references/Others/Wolery_Daveler_1992_EQ36_A_Computer_Program_for_Reaction_Path_Modeling_of_Aqueous_Geochemical_Systems_ERMS241379.pdf}
-
-}
-
-\examples{
-\dontrun{
-# if an EQ6 output file named "rainbow2.6o" is in the current 
-# working directory, the following command will output values 
-# of log act (logarithm of activity) for the selected aqueous 
-# species to a file named rainbow2.6o.log act.csv
-eqdata("rainbow2.6o",c("h+","sio2,aq","h2,aq"),"log act") }
-}
-
-\concept{Other tools}

Modified: pkg/CHNOSZ/vignettes/anintro.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/anintro.Rmd	2022-02-07 04:38:29 UTC (rev 699)
+++ pkg/CHNOSZ/vignettes/anintro.Rmd	2022-02-07 05:26:17 UTC (rev 700)
@@ -1762,8 +1762,6 @@
 
 * <span style="color:green">`EOSregress()`</span> and related functions can be used to regress "equation of state" parameters (e.g. coefficients in the HKF equations) from heat capacity and volumetric data. See <span style="color:blue">`?EOSregress`</span> and the vignette [<span style="color:blue">*Regressing thermodynamic data*</span>](eos-regress.html).
 
-* <span style="color:green">`eqdata()`</span> reads data, including concentrations of aqueous species, numbers of moles of solid phases, and mineral saturation states (affinities), from an EQ6 output file [@Wol92].
-
 * Some functions are available (see <span style="color:blue">`?taxonomy`</span>) to read data from [NCBI taxonomy files](https://www.ncbi.nlm.nih.gov/taxonomy), traverse taxonomic ranks, and get scientific names of taxonomic nodes.
 
 # Citation and contact information

Modified: pkg/CHNOSZ/vignettes/mklinks.sh
===================================================================
--- pkg/CHNOSZ/vignettes/mklinks.sh	2022-02-07 04:38:29 UTC (rev 699)
+++ pkg/CHNOSZ/vignettes/mklinks.sh	2022-02-07 05:26:17 UTC (rev 700)
@@ -71,7 +71,6 @@
 sed -i '120,$s/<code>equil.reaction()<\/code>/<code><a href="..\/html\/equilibrate.html" style="background-image:none;">equil.reaction()<\/a><\/code>/g' anintro.html
 sed -i '120,$s/<code>EOSregress()<\/code>/<code><a href="..\/html\/EOSregress.html" style="background-image:none;">EOSregress()<\/a><\/code>/g' anintro.html
 sed -i '120,$s/<code>RH2OBIGT()<\/code>/<code><a href="..\/html\/util.data.html" style="background-image:none;">RH2OBIGT()<\/a><\/code>/g' anintro.html
-sed -i '120,$s/<code>eqdata()<\/code>/<code><a href="..\/html\/eqdata.html" style="background-image:none;">eqdata()<\/a><\/code>/g' anintro.html
 sed -i '120,$s/<code>retrieve()<\/code>/<code><a href="..\/html\/retrieve.html" style="background-image:none;">retrieve()<\/a><\/code>/g' anintro.html
 
 # anintro.html: functions from R base packages

Modified: pkg/CHNOSZ/vignettes/vig.bib
===================================================================
--- pkg/CHNOSZ/vignettes/vig.bib	2022-02-07 04:38:29 UTC (rev 699)
+++ pkg/CHNOSZ/vignettes/vig.bib	2022-02-07 05:26:17 UTC (rev 700)
@@ -489,15 +489,6 @@
   doi       = {10.1038/ncomms2998},
 }
 
- at TechReport{Wol92,
-  author      = {Wolery, Thomas J.},
-  title       = {{E}q3/6, {A} {S}oftware {P}ackage for {G}eochemical {M}odeling of {A}queous {S}ystems: {P}ackage {O}verview and {I}nstallation {G}uide ({V}ersion 7.0)},
-  institution = {Lawrence Livermore National Laboratory},
-  year        = {1992},
-  number      = {UCRL-MA-110662 PT I},
-  doi         = {10.2172/138894},
-}
-
 @Article{Man13,
   author    = {Manning, Craig E.},
   journal   = {Reviews in Mineralogy and Geochemistry},



More information about the CHNOSZ-commits mailing list