diff --git a/data/ST_formative_elements.rda b/data/ST_formative_elements.rda index a302356..6a8222f 100644 Binary files a/data/ST_formative_elements.rda and b/data/ST_formative_elements.rda differ diff --git a/misc/formative-elements/dictionaries/greatgroup.csv b/misc/formative-elements/dictionaries/greatgroup.csv index 7c8039e..45d5667 100644 --- a/misc/formative-elements/dictionaries/greatgroup.csv +++ b/misc/formative-elements/dictionaries/greatgroup.csv @@ -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,, diff --git a/misc/formative-elements/extract-and-prepare-dictionaries.R b/misc/formative-elements/extract-and-prepare-dictionaries.R index 6020e8b..50f28f0 100644 --- a/misc/formative-elements/extract-and-prepare-dictionaries.R +++ b/misc/formative-elements/extract-and-prepare-dictionaries.R @@ -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') diff --git a/misc/formative-elements/formative-elements.rda b/misc/formative-elements/formative-elements.rda index ac842ad..5274559 100644 Binary files a/misc/formative-elements/formative-elements.rda and b/misc/formative-elements/formative-elements.rda differ diff --git a/tests/testthat/test-formative-element-parsing.R b/tests/testthat/test-formative-element-parsing.R index fcb826a..419e490 100644 --- a/tests/testthat/test-formative-element-parsing.R +++ b/tests/testthat/test-formative-element-parsing.R @@ -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 @@ -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')