TODO:

Recreate functionality of previous API.

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

# 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" "Vleck" "Pardee" ...
##   ..$ 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] 22521662 22521663 22521664 22521665 22521666 22521667 22521668 22523169 22523168 22523170 ...
##   ..$ compname   : chr [1:88] "Amador" "Gillender" "Vleck" "Lithic Xerorthents" ...
##   ..$ comppct_r  : int [1:88] 45 40 3 3 3 3 3 50 30 10 ...
##   ..$ compkind   : chr [1:88] "Series" "Series" "Series" "Taxon above family" ...
##   ..$ 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'
)

A simple depiction of the resulting adjacency matrix. Cell values are adjacency weight (strength of association).

.cp <- c('white', hcl.colors(25))

corrplot(
  m, 
  col = .cp, 
  is.corr = FALSE, 
  diag = TRUE,
  col.lim = c(0, 1), 
  method = "color",
  type = "upper", 
  tl.pos = "td",
  tl.cex = 0.8,
  tl.col = 'black',
  addgrid.col = 'black'
) 

Adjacency as a network.

# 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.
series sibling majcompflag n
amador Miltonhills TRUE 2
amador Gillender TRUE 2
amador Vleck TRUE 1
amador Pardee TRUE 1
amador Pardee FALSE 8
amador Hornitos FALSE 5
amador Miltonhills FALSE 4
amador Redding FALSE 4
amador Pentz FALSE 4
amador Exchequer FALSE 4
amador Gillender FALSE 3
amador Peters FALSE 2
amador Ranchoseco FALSE 2
amador Vleck FALSE 2
amador Inks FALSE 1
amador Corning FALSE 1

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, depth.axis = list(line = -4))

All siblings.

SoilTaxonomyDendrogram(h.all, width = 0.3, depth.axis = list(line = -3.5))

Cousins are siblings of siblings. This can generate a lot of output.

# 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')

Adjaceny matrix.

corrplot(
  m, 
  col = .cp, 
  is.corr = FALSE, 
  diag = TRUE,
  col.lim = c(0, 1), 
  method = "color",
  type = "upper", 
  tl.pos = "td",
  tl.cex = 0.8,
  tl.col = 'black',
  addgrid.col = 'black'
) 

Adjaceny network.

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

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'
)

Try on your own, this is too much data to “see” all in one figure.

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

# plot dendrogram + profiles
SoilTaxonomyDendrogram(h, width = 0.3)

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 2.01, soilDB version 2.7.8, and sharpshootR version 2.2.