ncss-tech / soilDB

soilDB: Simplified Access to National Cooperative Soil Survey Databases
http://ncss-tech.github.io/soilDB/
GNU General Public License v3.0
81 stars 20 forks source link

Taxonomic class names in fetchOSD result #256

Closed brownag closed 10 months ago

brownag commented 2 years ago

I didn't realize or had forgotten that soilDB::fetchOSD() returns family subgroup greatgroup suborder and soilorder rather than taxclname taxsubgrp taxgrtgroup taxsuborder taxorder. I think where possible we should standardize on the NASIS physical column names for soilDB results, which would mean also possibly changing those with underscore separating "tax" and the rest of the column name e.g. tax_partsize

Related #242

brownag commented 2 years ago

Related PR for sharpshootR::SoilTaxonomyDendrogram(): https://github.com/ncss-tech/sharpshootR/pull/45

Related issue in SoilTaxonomy: https://github.com/ncss-tech/SoilTaxonomy/issues/38

dylanbeaudette commented 2 years ago

Thanks. Parity with NASIS and other functions is a good idea, but changes to fetchOSD will require a lot of testing. I'll start that process after WCSS.

brownag commented 2 years ago

Have those columns always existed by those names in fetchOSD? I was a bit surprised to seem them in there

dylanbeaudette commented 2 years ago

Yes, they are inherited from the SoilWeb API that returns most of the data. I can't remember, but suspect that those names date back to before fetchOSD was a function and before soilDB was a package.

brownag commented 2 years ago

Yeah, I dug back and you are right, and they were the original names used in SoilTaxonomy. I mis-remembered what had been changed there. EDIT: some functions like isValidST used names like 'tax_order', 'tax_suborder', 'tax_greatgroup', 'tax_subgroup

But anyway... names should be standardized in long run. Not a big deal or an immediate issue, I just was thinking that most of the standardization items have focused on NASIS data access functions so far. Would probably be good to get SoilWeb on board across the board where possible, and a specific issue to implement it.

brownag commented 2 years ago

And changing all that stuff to properly resolve #242 is probably a milestone for soilDB 3.0 -- as changing column names that are frequently used will wreak all sorts of havoc even if we test.

brownag commented 10 months ago

I think the SoilTaxonomy v0.2.4 parse_family() routine covers the general case of converting taxonomic classes/domains for a series of interest to their NASIS column names. There is probably no need to change this in the fetchOSD() result.

library(soilDB)
library(SoilTaxonomy)

o <- fetchOSD("alberti")
x <- parse_family(o$family)
x
#>                                                    family
#> 1 clayey, smectitic, thermic, shallow vertic rhodoxeralfs
#>                                                 taxclname           taxonname
#> 1 clayey, smectitic, thermic, shallow vertic rhodoxeralfs vertic rhodoxeralfs
#>   subgroup_code code                        class_string classes_split
#> 1          JDEB JDEB clayey, smectitic, thermic, shallow  clayey, ....
#>   taxpartsize taxpartsizemod taxminalogy taxceactcl taxreaction taxtempcl
#> 1      clayey             NA   smectitic         NA          NA   thermic
#>   taxfamhahatmatcl taxfamother           taxsubgrp  taxgrtgroup taxsuborder
#> 1               NA     shallow Vertic Rhodoxeralfs Rhodoxeralfs     Xeralfs
#>   taxorder
#> 1 Alfisols