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" "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] 25531937 25531935 25531936 25531939 25531940 25531934 25531938 25533776 25533775 25533772 ...
##   ..$ compname   : chr [1:88] "Amador" "Gillender" "Lithic Xerorthents" "Ranchoseco" ...
##   ..$ comppct_r  : int [1:88] 45 40 3 3 3 3 3 50 30 10 ...
##   ..$ compkind   : chr [1:88] "Series" "Series" "Taxon above family" "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'
)

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 Pardee TRUE 1
amador Vleck TRUE 1
amador Pardee FALSE 8
amador Hornitos FALSE 5
amador Pentz FALSE 4
amador Redding FALSE 4
amador Miltonhills FALSE 4
amador Exchequer FALSE 4
amador Gillender FALSE 3
amador Vleck FALSE 2
amador Peters FALSE 2
amador Ranchoseco 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.2-1, soilDB version 2.8.12, and sharpshootR version 2.4.