ncss-tech / SoilTaxonomy

A System of Soil Classification for Making and Interpreting Soil Surveys
https://ncss-tech.github.io/SoilTaxonomy/
GNU General Public License v3.0
14 stars 2 forks source link

Simplify Great Group formative elements #20

Closed brownag closed 3 years ago

brownag commented 3 years ago

This simplifies some duplicate-definition entries that share a common formative element with various vowels or other characters appended.

They are not needed with the current version of the FormativeElements function.

These changes should make it a little easier to plan updates to formative elements LUT since definitions will only need to be changed in one place and the simplest "pattern" for a given element will be used.

There is room to make any of these more specific if different definitions are warranted, but that can be addressed further in #17

dylanbeaudette commented 3 years ago

They are not needed with the current version of the FormativeElements function.

I wanted to verify that retaining only the "root" form of the formative elements will not interfere with explainST().

For example, are the results identical in master vs. this PR. I have not had time to check. If results are identical, then I approve this PR.

Thanks.

library(SoilTaxonomy)

taxa <- c("sulfic endoaquents", "sulfic fluvaquents", "sulfic hydraquents", 
          "thapto-histic sulfaquents", "typic sulfaquents", "haplic sulfaquents", 
          "histic sulfaquents", "sulfic fluviwassents", "sulfic haplowassents", 
          "sulfic hydrowassents", "sulfic psammowassents", "thapto-histic sulfiwassents", 
          "typic sulfiwassents", "lithic sulfiwassents", "fluventic sulfiwassents", 
          "haplic sulfiwassents", "aeric sulfiwassents", "sulfuric aquorthels", 
          "sulfuric aquiturbels", "typic sulfihemists", "terric sulfihemists", 
          "typic sulfohemists", "typic sulfisaprists", "terric sulfisaprists", 
          "typic sulfosaprists", "sulfic haplowassists", "typic sulfiwassists", 
          "sapric sulfiwassists", "fibric sulfiwassists", "sulfic cryaquepts", 
          "sulfic endoaquepts", "typic sulfaquepts", "salidic sulfaquepts", 
          "hydraquentic sulfaquepts", "typic sulfudepts", "sulfaqueptic dystraquerts", 
          "typic sulfaquerts", "salic sulfaquerts", "sulfic sulfaquerts"
)

for(i in taxa) {
  cat(explainST(i), sep = '\n')
}
brownag commented 3 years ago

Thanks, after last commit I can confirm those taxa outputs from explainST are identical

Everything in terms of finding the formative elements was the same, but I had to undo some wordsmithing regarding the linking of "sulf-" at great group level to specific diagnostics. I wound up elaborating on that much more in #17, and didn't intend to actually have that be in this PR.

library(SoilTaxonomy)

taxa <- c("sulfic endoaquents", "sulfic fluvaquents", "sulfic hydraquents", 
          "thapto-histic sulfaquents", "typic sulfaquents", "haplic sulfaquents", 
          "histic sulfaquents", "sulfic fluviwassents", "sulfic haplowassents", 
          "sulfic hydrowassents", "sulfic psammowassents", "thapto-histic sulfiwassents", 
          "typic sulfiwassents", "lithic sulfiwassents", "fluventic sulfiwassents", 
          "haplic sulfiwassents", "aeric sulfiwassents", "sulfuric aquorthels", 
          "sulfuric aquiturbels", "typic sulfihemists", "terric sulfihemists", 
          "typic sulfohemists", "typic sulfisaprists", "terric sulfisaprists", 
          "typic sulfosaprists", "sulfic haplowassists", "typic sulfiwassists", 
          "sapric sulfiwassists", "fibric sulfiwassists", "sulfic cryaquepts", 
          "sulfic endoaquepts", "typic sulfaquepts", "salidic sulfaquepts", 
          "hydraquentic sulfaquepts", "typic sulfudepts", "sulfaqueptic dystraquerts", 
          "typic sulfaquerts", "salic sulfaquerts", "sulfic sulfaquerts"
)

res <- lapply(taxa, explainST)

# save(res, file = "before.rda")
# save(res, file = "after.rda")

res <- NULL
load("E:/workspace/SoilTaxonomy/before.rda")
res_before <- res

res <- NULL
load("E:/workspace/SoilTaxonomy/after.rda")
res_after <- res

as.character(res_before) == as.character(res_after)
#>  [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
#> [16] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
#> [31] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE