Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify Great Group formative elements #20

Merged
merged 2 commits into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified data/ST_formative_elements.rda
Binary file not shown.
144 changes: 58 additions & 86 deletions misc/formative-elements/dictionaries/greatgroup.csv
Original file line number Diff line number Diff line change
@@ -1,86 +1,58 @@
element,derivation,connotation,simplified,link
acro,at the end,extreme weathering,,
acr,at the end,extreme weathering,,
al,aluminum,"high Al, low Fe",,
alb,white,presence of an albic horizon,,
anhy,dry,very dry,,
anthra,human,presence of an anthropic epipedon,,
aqui,water,wetness,,
aqu,water,wetness,,
argi,white clay,presence of an argillic horizon,,
calci,lime,presence of a calcic horizon,,
cryo,cold,cryic STR,,
cry,cold,cryic STR,,
duri,hard,presence of a duripan,,
dur,hard,presence of a duripan,,
dystro,infertile,low base saturation,,
dystr,infertile,low base saturation,,
endo,within,ground water table,,
epi,above,perched water table,,
eutro,fertile,high base saturation,,
eutr,fertile,high base saturation,,
ferr,iron,presence of Fe,,
fibr,fiber,least decomposed stage,,
fluv,river,flood plain,,
fol,leaf,mass of leaves,,
fragi,brittle,presence of a fragipan,,
fragloss,brittle + tongue,presence of a fragipan and glossic horizon,,
frasi,fresh,not salty,,
fulvi,brownish yellow,dark brown with organic carbon,,
fulv,brownish yellow,dark brown with organic carbon,,
glac,icy,presence of ice lenses,,
glosso,tongue,presence of a glossic horizon,,
gloss,tongue,presence of a glossic horizon,,
gypsi,gypsum,presence of a gypsic horizon,,
hal,salt,salty,,
haplo,simple,minimum horizon development,,
hapl,simple,minimum horizon development,,
hap,simple,minimum horizon development,,
hemi,half,intermediate decomposition,,
histo,tissue,organic soil material,,
hist,tissue,organic soil material,,
humi,earth,presence of organic carbon,,
hum,earth,presence of organic carbon,,
hydro,water,presence of water,,
hydr,water,presence of water,,
kandi,modified from kandite,presence of a kandic horizon,,
kanhaplo,kandite + simple,thin kandic horizon,,
kanhap,kandite + simple,thin kandic horizon,,
luvi,to wash,illuvial organic material,,
melano,black,presence of a melanic epipedon,,
melan,black,presence of a melanic epipedon,,
molli,soft,presence of a mollic epipedon,,
moll,soft,presence of a mollic epipedon,,
natri,sodium,presence of a natric horizon,,
natr,sodium,presence of a natric horizon,,
pale,old,excessive development,,
petro,rock,petrocalcic horizon,,
petr,rock,petrocalcic horizon,,
plac,flat stone,presence of a thin pan,,
plagg,sod,presence of a plaggen epipedon,,
plinth,brick,presence of plinthite,,
psammo,sand,sandy texture,,
psamm,sand,sandy texture,,
quartzi,quartz,high quartz content,,
rhodo,rose,dark red colors,,
rhod,rose,dark red colors,,
sali,salt,presence of a salic horizon,,
sal,salt,presence of a salic horizon,,
sapr,rotten,most decomposed stage,,
sombri,dark,presence of a sombric horizon,,
sphagno,bog,presence of sphagnum moss,,
sulfo,sulfur,presence of sulfides or their oxidation products,,
sulfi,sulfur,presence of sulfides or their oxidation products,,
sulf,sulfur,presence of sulfides or their oxidation products,,
torri,hot and dry,torric/aridic SMR,,
udi,humid,udic SMR,,
ud,humid,udic SMR,,
umbri,shade,presence of an umbric epipedon,,
umbr,shade,presence of an umbric epipedon,,
usti,burnt,ustic SMR,,
ust,burnt,ustic SMR,,
verm,worm,"wormy, or mixed by animals",,
vitri,glass,presence of glass,,
vitr,glass,presence of glass,,
xero,dry,xeric SMR,,
xer,dry,xeric SMR,,
element,derivation,connotation,simplified,link
acr,at the end,extreme weathering,,
al,aluminum,"high Al, low Fe",,
alb,white,presence of an albic horizon,,
anhy,dry,very dry,,
anthra,human,presence of an anthropic epipedon,,
aqu,water,wetness,,
argi,white clay,presence of an argillic horizon,,
calci,lime,presence of a calcic horizon,,
cry,cold,cryic STR,,
dur,hard,presence of a duripan,,
dystr,infertile,low base saturation,,
endo,within,ground water table,,
epi,above,perched water table,,
eutr,fertile,high base saturation,,
ferr,iron,presence of Fe,,
fibr,fiber,least decomposed stage,,
fluv,river,flood plain,,
fol,leaf,mass of leaves,,
fragi,brittle,presence of a fragipan,,
fragloss,brittle + tongue,presence of a fragipan and glossic horizon,,
frasi,fresh,not salty,,
fulv,brownish yellow,dark brown with organic carbon,,
glac,icy,presence of ice lenses,,
gloss,tongue,presence of a glossic horizon,,
gypsi,gypsum,presence of a gypsic horizon,,
hal,salt,salty,,
hap,simple,minimum horizon development,,
hemi,half,intermediate decomposition,,
hist,tissue,organic soil material,,
hum,earth,presence of organic carbon,,
hydr,water,presence of water,,
kandi,modified from kandite,presence of a kandic horizon,,
kanhap,kandite + simple,thin kandic horizon,,
luvi,to wash,illuvial organic material,,
melan,black,presence of a melanic epipedon,,
moll,soft,presence of a mollic epipedon,,
natr,sodium,presence of a natric horizon,,
pale,old,excessive development,,
petr,rock,petrocalcic horizon,,
plac,flat stone,presence of a thin pan,,
plagg,sod,presence of a plaggen epipedon,,
plinth,brick,presence of plinthite,,
psamm,sand,sandy texture,,
quartzi,quartz,high quartz content,,
rhod,rose,dark red colors,,
sal,salt,presence of a salic horizon,,
sapr,rotten,most decomposed stage,,
sombri,dark,presence of a sombric horizon,,
sphagno,bog,presence of sphagnum moss,,
sulf,sulfur,presence of sulfides or their oxidation products,,
torri,hot and dry,torric/aridic SMR,,
ud,humid,udic SMR,,
umbr,shade,presence of an umbric epipedon,,
ust,burnt,ustic SMR,,
verm,worm,"wormy, or mixed by animals",,
vitr,glass,presence of glass,,
xer,dry,xeric SMR,,
68 changes: 34 additions & 34 deletions misc/formative-elements/extract-and-prepare-dictionaries.R
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
library(jsonlite)
# order
soilorder <- read.csv('dictionaries/order.csv', stringsAsFactors=FALSE)
str(soilorder)
# suborder
suborder <- read.csv('dictionaries/suborder.csv', stringsAsFactors=FALSE)
str(suborder)
# greatgroup
greatgroup <- read.csv('dictionaries/greatgroup.csv', stringsAsFactors=FALSE)
str(greatgroup)
# subgroup
subgroup <- read.csv('dictionaries/subgroup.csv', stringsAsFactors=FALSE)
str(subgroup)
# pack into a list
ST.formative_elements <- list(
soilorder=soilorder,
suborder=suborder,
greatgroup=greatgroup,
subgroup=subgroup
)
# try saving as JSON
ST.json <- toJSON(ST.formative_elements, auto_unbox = TRUE, pretty = TRUE, na='string')
cat(ST.json, file = 'formative-elements.json')
# save in compressed format for packaging
save(ST.formative_elements, file='formative-elements.rda')

library(jsonlite)

# order
soilorder <- read.csv('misc/formative-elements/dictionaries/order.csv', stringsAsFactors=FALSE)
str(soilorder)

# suborder
suborder <- read.csv('misc/formative-elements/dictionaries/suborder.csv', stringsAsFactors=FALSE)
str(suborder)

# greatgroup
greatgroup <- read.csv('misc/formative-elements/dictionaries/greatgroup.csv', stringsAsFactors=FALSE)
str(greatgroup)

# subgroup
subgroup <- read.csv('misc/formative-elements/dictionaries/subgroup.csv', stringsAsFactors=FALSE)
str(subgroup)


# pack into a list
ST.formative_elements <- list(
soilorder=soilorder,
suborder=suborder,
greatgroup=greatgroup,
subgroup=subgroup
)

# try saving as JSON
ST.json <- toJSON(ST.formative_elements, auto_unbox = TRUE, pretty = TRUE, na='string')
cat(ST.json, file = 'misc/formative-elements/formative-elements.json')

# save in compressed format for packaging
save(ST.formative_elements, file='misc/formative-elements/formative-elements.rda')
Binary file modified misc/formative-elements/formative-elements.rda
Binary file not shown.
4 changes: 2 additions & 2 deletions tests/testthat/test-formative-element-parsing.R
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ test_that("greatgroup formative elements", {

# full subgroup
x <- GreatGroupFormativeElements('typic haploxerolls')
expect_equal(x$defs$element, 'haplo')
expect_equal(x$defs$element, 'hap')
expect_equal(x$char.index, 7L)

# more complex example
Expand All @@ -110,7 +110,7 @@ test_that("greatgroup formative elements", {
expect_equal(x$char.index, 15)

x <- GreatGroupFormativeElements('alfic humic vitrixerands')
expect_equal(x$defs$element, 'vitri')
expect_equal(x$defs$element, 'vitr')
expect_equal(x$char.index, 13)

x <- GreatGroupFormativeElements('acrustoxic kanhaplustults')
Expand Down