TODO:

Recreate functionality of previous API.

library(soilDB)
library(sharpshootR)
library(latticeExtra)
library(reshape2)
library(cluster)
library(ape)

# new function as of 2.2-8
# get sibling data for Amador soil series via SoilWeb
# note that sib$sib may contain duplicates, based on major/minor component status
s <- siblings('amador', component.data = TRUE)

str(s)
## List of 2
##  $ sib     :'data.frame':    16 obs. of  4 variables:
##   ..$ series     : chr [1:16] "amador" "amador" "amador" "amador" ...
##   ..$ sibling    : chr [1:16] "Miltonhills" "Gillender" "Pardee" "Vleck" ...
##   ..$ majcompflag: logi [1:16] TRUE TRUE TRUE TRUE FALSE FALSE ...
##   ..$ n          : int [1:16] 2 2 1 1 8 5 4 4 4 4 ...
##  $ sib.data:'data.frame':    88 obs. of  7 variables:
##   ..$ areasymbol : chr [1:88] "ca628" "ca628" "ca628" "ca628" ...
##   ..$ mukey      : int [1:88] 1612048 1612048 1612048 1612048 1612048 1612048 1612048 2600529 2600529 2600529 ...
##   ..$ cokey      : int [1:88] 16573880 16573881 16573878 16573879 16573882 16573883 16573877 17095829 17095832 17095830 ...
##   ..$ compname   : chr [1:88] "Amador" "Gillender" "Ranchoseco" "Vleck" ...
##   ..$ comppct_r  : int [1:88] 45 40 3 3 3 3 3 50 30 10 ...
##   ..$ compkind   : chr [1:88] "Series" "Series" "Series" "Series" ...
##   ..$ majcompflag: chr [1:88] "Yes" "Yes" "No " "No " ...
# convert into adjacency matrix
m <- component.adj.matrix(s$sib.data[s$sib.data$compkind == 'Series', ], mu = 'mukey', co = 'compname', wt = 'comppct_r')

# plot network diagram, with Amador soil highlighted
par(mar=c(0.5,0.5,0.5,0.5))
plotSoilRelationGraph(m, s='Amador', vertex.scaling.factor=2, edge.transparency=0.75, edge.col=grey(0.85), edge.highlight.col='black', vertex.label.family='sans')

Sibling type and counts.

kable_styling(kable(s$sib, format = 'html'), full_width = FALSE, font_size = 10)
series sibling majcompflag n
amador Miltonhills TRUE 2
amador Gillender TRUE 2
amador Pardee TRUE 1
amador Vleck TRUE 1
amador Pardee FALSE 8
amador Hornitos FALSE 5
amador Redding FALSE 4
amador Exchequer FALSE 4
amador Miltonhills FALSE 4
amador Pentz FALSE 4
amador Gillender FALSE 3
amador Ranchoseco FALSE 2
amador Peters FALSE 2
amador Vleck FALSE 2
amador Corning FALSE 1
amador Inks FALSE 1

Combine counts for major/minor siblings.

plyr::ddply(s$sib, c('series', 'sibling'), .fun=plyr::summarise, n=sum(n))

Split sibling lists and get basic morphology from OSDs.

idx <- which(s$sib$majcompflag)
major.siblings <- c(s$sib$series[1], s$sib$sibling[idx])
all.siblings <- unique(c(s$sib$series[1], s$sib$sibling))

# get basic OSD data for queried series and siblings
h.major <- fetchOSD(major.siblings)
h.all <- fetchOSD(all.siblings)

Siblings that are major components.

SoilTaxonomyDendrogram(h.major)

All siblings.

SoilTaxonomyDendrogram(h.all)

Cousin lookup.

# takes a while to run, there will be duplicates in counsins here
s <- siblings('amador', component.data = TRUE, cousins = TRUE)

# combine sibling + cousin data, remove duplicates
d <- unique(rbind(s$sib.data, s$cousin.data))

# subset to components that are correlated to a soil series
d <- d[which(d$compkind == 'Series'), ]

# convert into adjacency matrix
m <- component.adj.matrix(d, mu = 'mukey', co = 'compname', wt = 'comppct_r')

# plot network diagram, with Amador soil highlighted
par(mar=c(1,1,1,1))
plotSoilRelationGraph(m, s='Amador')


# fetch and convert data into an SPC
h <- fetchOSD(c(s$sib$series[1], unique(s$cousins$sibling)))

# plot dendrogram + profiles
SoilTaxonomyDendrogram(h)

Geomorphic Summaries

s.all.siblings <- fetchOSD(all.siblings, extended = TRUE)

Compare hillslope position.

Compare geomorphic component.

MLRA and Parent Material Summaries

TODO

Investigate Spatial Patterns

TODO

KSSL Data

TODO


This document is based on aqp version 1.17.05, soilDB version 2.3.8, and sharpshootR version 1.4.02.