Soil science. Soil data and its analysis ... Soil data: Highly multi-dimensional. Point support. Soft and hard data ..... Provides advanced visualisations of soil data.
Investigating soil data with R Pierre Roudier1 and Dylan E. Beaudette2 1 2
Landcare Research – Manaaki Whenua, New Zealand Natural Resources Conservation Service, USDA, USA
Acknowledgement
Talk Outline
1 The soil resource
Soil matters! Soil science Soil data and its analysis 2 The aqp package Visualisation Classification Harmonisation Analysis and modelling 3 Recent and future developments Introduction of S4 classes Design 4 Conclusions and further work
Talk Outline 1 The soil resource
Soil matters! Soil science Soil data and its analysis 2 The aqp package
Visualisation Classification Harmonisation Analysis and modelling 3 Recent and future developments
Introduction of S4 classes Design 4 Conclusions and further work
Soil matters!
Soil a very thin layer between parent rock and atmosphere, a very complex body – physical, chemical and biological interactions, a support for almost all terrestrial ecosystems – and thus food production
Soil matters!
Soil is not dirt.
A threatened resource
How to feed 7 billion+ people? Growing tensions on arable land Urbanisation Erosion Etc.
,→ Important to provide soil information to a wide range of decision makers.
A threatened resource
“Man has only a thin layer of soil between himself and starvation.” –Bard of Cincinnati
Soils today
Long been only regarded as a producer of crops But soils are back on the global agenda New challenges through global projects
Soils today
Long been only regarded as a producer of crops But soils are back on the global agenda New challenges through global projects
GlobalSoilMap.net– a leading project International network of soil scientists Generate and provide a ≈ 100m grid of 9 key soils attributes globally R has been identified as a key platform for the various stages involved
Data courtesy of Tomislav Hengl.
GlobalSoilMap.net– a leading project International network of soil scientists Generate and provide a ≈ 100m grid of 9 key soils attributes globally R has been identified as a key platform for the various stages involved
Data courtesy of Tomislav Hengl.
,→ The way to do soil science is changing significantly (“pedometrics”)
The soil profile
The soil profile
Soil data: Highly multi-dimensional Point support Soft and hard data Importance of legacy data Most of the time associated with environmental covariates
Talk Outline 1 The soil resource
Soil matters! Soil science Soil data and its analysis 2 The aqp package
Visualisation Classification Harmonisation Analysis and modelling 3 Recent and future developments
Introduction of S4 classes Design 4 Conclusions and further work
The aqp package
aqp – Algorithms for Quantitative Pedology
Soil profile sketches
An example of profile sketches manually created from soil profile observations collected as part of the Pinnacles National Monument soil survey. Horizon designations, sequences, boundaries, and soil texture classes are usually sufficient for describing complex soil-landscape relationships.
(Digital) Soil profile sketches 08
14 A1 A2
13 A1
A/C Bt1
Bt2
12 A1
A2
Cr R
A2 R
09 A
03 A
Bw1 Bw2
Bw1
01 A AB
AB
15
07 A1 A2 Bw1
05 A AB1
Cr R
11
10
02
Oi Oe/A
A
A
Ad
AB1
AB
AB2
EC1
AB2
Oe A
Bt1 Bw2
Cr
Bw2 R
Bt Crt
Crt
Bw2
Bw1
Bt2
04
Oi/A A
AB1
Bw
Bw3
Cr R
Oi A
A AB
0 cm
Bt1
20 cm
Bt2 Bt1
Bt1 EC2
Bt3 AB2
Cr/Bw Cr
06
Bt2
??? BC Crt
60 cm
80 cm
Bt
Bt2
Cr
BC
40 cm
???
CB
100 cm
R
120 cm
140 cm
160 cm
180 cm
(Digital) Soil profile sketches 08
14
13 A1
A1
12 A1
A2
09 A
A2
01 A
15 Oi A
07 A1 A2
Bw1
A2
05 A
R
Bw1
Bw2
Cr R
AB
Bw1
10
02
A
A
Ad
AB1
AB
AB2
EC1
AB2
04
Bt1
Cr R
Bw2
Bw1
A AB1
Cr
Bw2 R
Cr
20 cm
40 cm Bt3
EC2
60 cm
AB2
Bt2
Cr/Bw
BC 80 cm
Cr Bt2
0 cm
Bt1
Bt1
Crt Crt
R
A AB
Bt2
Bt1
Bw2 Bt
06 Oi/A
Oe A
Bw
Bw3
Bt2
11 Oi Oe/A
AB1
AB
A/C Bt1
03 A
Bt
Bt2
CB
100 cm
R
120 cm
???
Cr
BC
???
Crt
140 cm
Backslope
Summit
Swale 160 cm
98
79
summit
67
40
30
−5 −5 −9 −13 −30 −51 Relative Topographic Position (50 meter radius)
−54
−81
backslope swale
−86
−97
180 cm
Numerical soil classification evaluate dissimilarity metric for each depth increment
dissimilarity matrices for all depth increments
apply depth-weighting and sum dissimilarities
final between-profile dissimilarity matrix
Numerical soil classification 30 25 20 15 10 5 0 01
09 Oi A
05 A
04 Oi Oe/A Ad
AB
07
15
Oi/A
A
A
AB1
AB2 Bw
13 Oe A
14 A1
12 A1 A2
A2
A2
Bw2 Cr/Bw
Bw1 Bt1
AB1
Bt1 Bw1 Bt2
Crt Crt
02 A1
19Tollhs A Bw1
Bw2
Bt2 AB2
Bw2 R
R Cr R
03
10 A
18Chualr A Ap1
A1
AB
Bw2
EC1
A2
Cr R
C Cr
Bt1
Ap2
Bt2
Bt3 EC2
A1
A1 A2
A3
11
17Ahwahn A
A11
AB1
A12
AB2
A2
50 cm
Bt1 B1
0 cm
B1
BC B2
A2
Cr Bt R
Bt2
Bt2
??? ???
Cr
Bt1 BC
CB
B2
C1
100 cm
R Bt21
Sampled Soils Soil Survey Legend
16 Vista A AB
Bw3
Cr
Cr
Group 1 Group 2 Group 3 Group 4
06
Bt1
AB
A/C
Bw1
Bt
08 A1 A2
Crt C2
C
150 cm
Bt22
200 cm
Soil data harmonisation
Harmonisation of heterogeneous data sets
Legacy data Diversity of measurement methods Etc.
Soil data harmonisation Harmonisation of the depth support 0
20
Depth (cm)
40
60
80
100
120
0.0
0.5
1.0
Organic carbon (%)
1.5
Soil data harmonisation
0
0
20
20
40
40
60
60
Depth (cm)
Depth (cm)
Harmonisation of the depth support
80
80
100
100
120
120
0.0
0.5
1.0
Organic carbon (%)
1.5
0.0
0.5
1.0
Organic carbon (%)
1.5
Soil data harmonisation
0
0
20
20
20
40
40
40
60
60
60
Depth (cm)
0
Depth (cm)
Depth (cm)
Harmonisation of the depth support
80
80
80
100
100
100
120
120
120
0.0
0.5
1.0
Organic carbon (%)
1.5
0.0
0.5
1.0
Organic carbon (%)
1.5
0.0
0.5
1.0
Organic carbon (%)
1.5
Aggregation of soil properties
compute summary statistics by segment
segment each profile
collect profiles
representative depth function and characteristic variability
Aggregation of soil properties Meta-basalt Sand (%)
Clay (%)
Granodiorite
Total Carbon (%)
CIE Redness
pH
CEC (cmol [+] / kg)
0
Fe Crystallinity
0
Mn Crystallinity
Total Ca (%)
Total Fe (%)
Total Zr (ppm)
Total Si (%)
30
25
20
5 10 15
7. 5
7. 0
6. 5
6. 0
16
14
8 10 12
6
3
2
1
0
40
30
100 20
80
100 10
60
80
80
40
60
60 70
40
40 50
20
20 30
20
0
40
35
14 0 30
12 0
80
25th Percentile, Median, 75th Percentile
10 0
60
8 10 12
6
4
2
1. 4 0. 5 1. 0 1. 5 2. 0 2. 5 3. 0
1.
1.
0.
0.
0.
0.
2
100 0
80
100 8
60
80
4
40
60
3
40
2
20
1
20
0.
Depth (cm)
0
Pedotransfer functions
”Pedotransfer functions” are models predicting a soil attribute from other(s) soil attribute(s) and environmental covariates.
From simple approach with multivariate linear models... ... to state-of-the-art machine learning algorithms (ANN, random forests, etc.)
,→ R is of course a natural platform for these tasks.
Talk Outline 1 The soil resource
Soil matters! Soil science Soil data and its analysis 2 The aqp package
Visualisation Classification Harmonisation Analysis and modelling 3 Recent and future developments
Introduction of S4 classes Design 4 Conclusions and further work
Structuring soil data Site Data
50 - 200 cm
100 meters x, y, z
slope, erosion, drainage, geology, ...
species, abundance
xxxxx
xxxx xxxxxxxx xxxxx xxxx xxxxx
xxxxxx xxxxxxxx xxxxxxxx xxxxxx xxx xxxxxxxxxxx
Horizon Morphology Data name, depths, roots, color, structure, texture, ...
feature, abundance
xxxx xxxxxx xxxxxxxxx xxxxxx
xxxxxx xxxxxxxxx xxxxxxxxx xxxxxx xxxxxx xxxxxxxxx
xxxxxxx
Laboratory Data available {Na, K, Mg, Ca}, total {Si, Al, Fe}, CEC, ph, PSD, EC, SAR, ... xxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxx xxxxxxxxxx xxxxxxxx xxxxx
Spatial analysis
Spatial analyis is an example where we need bindings to other packages.
Slice the soil collection on any depth interval Cast it as a sp object (SpatialPointsDataFrame) Apply sp/raster methods for spatial data analysis
Spatial analysis
0.15 0.10 0.05
10 cm depth 20 cm depth 30 cm depth 40 cm depth 50 cm depth 60 cm depth
0.00
semivariance
0.20
0.25
0.30
Si:Al Variogram Models
50
100
150 distance
200
250
Spatial analysis
S4 Classes and Methods for Soil Information Formal class 'SoilProfileCollection' [package ”.GlobalEnv”] with 4 slots ..@ id : Named chr ”P001” .. ..− attr(*, ”names”)= chr ”id” ..@ depths : int [1:6, 1:2] 0 2 14 49 57 89 2 14 49 57 ... .. ..− attr(*, ”dimnames”)=List of 2 .. .. ..$ : chr [1:6] ”1” ”2” ”3” ”4” ... .. .. ..$ : chr [1:2] ”top” ”bottom” ..@ units : chr ”cm” ..@ horizons:'data.frame': 6 obs. of 4 variables: .. ..$ texture : Factor w/ 14 levels ”C”,”CBVSCL”,”FSL”,..: 8 8 8 8 9 NA .. ..$ stickiness : Factor w/ 4 levels ”MS”,”SO”,”SS”,..: NA NA NA NA NA NA .. ..$ plasticity : Factor w/ 4 levels ”MP”,”PO”,”SP”,..: NA NA NA NA NA NA .. ..$ field ph : num [1:6] 7.9 7.7 8 7.9 7.4 NA ..@ site:'data.frame': 6 obs. of 2 variables: .. ..$ bound topography: Factor w/ 3 levels ”B”,”S”,”W”: 2 2 2 2 2 NA .. ..$ elevation: int [1:6] 13 7 9 14 21 NA
S4 Classes and Methods for Soil Information Formal class 'SoilProfileCollection' [package ”.GlobalEnv”] with 4 slots ..@ id : Named chr ”P001” .. ..− attr(*, ”names”)= chr ”id” ..@ depths : int [1:6, 1:2] 0 2 14 49 57 89 2 14 49 57 ... .. ..− attr(*, ”dimnames”)=List of 2 .. .. ..$ : chr [1:6] ”1” ”2” ”3” ”4” ... .. .. ..$ : chr [1:2] ”top” ”bottom” ..@ units : chr ”cm” ..@ horizons:'data.frame': 6 obs. of 4 variables: .. ..$ texture : Factor w/ 14 levels ”C”,”CBVSCL”,”FSL”,..: 8 8 8 8 9 NA .. ..$ stickiness : Factor w/ 4 levels ”MS”,”SO”,”SS”,..: NA NA NA NA NA NA .. ..$ plasticity : Factor w/ 4 levels ”MP”,”PO”,”SP”,..: NA NA NA NA NA NA .. ..$ field ph : num [1:6] 7.9 7.7 8 7.9 7.4 NA ..@ site:'data.frame': 6 obs. of 2 variables: .. ..$ bound topography: Factor w/ 3 levels ”B”,”S”,”W”: 2 2 2 2 2 NA .. ..$ elevation: int [1:6] 13 7 9 14 21 NA ..@ spatial:'SpatialPoints' ..@ metadata:'data.frame'
S4 Classes and Methods for Soil Information # Initialization depths(spc)