Description Usage Arguments Value Note Author(s) References Examples
This function is specific for soil profile data. A continous spline function is fitted upon information recieved about a target soil property at specified depths intervals or soil horizons. The spline however has the unique property of maintaining the integrity of the observed information i.e. the spline has mass preserving properties.
1 |
obj |
Can be an object of class |
var.name |
character; target variable name (must be a numeric variable) |
lam |
numeric; lambda the smoothing parameter |
d |
numeric; standard depths that are used to extract values from fitted spline i.e harmonising depths |
vlow |
numeric; smallest value of the target variable (smaller values will be replaced) |
vhigh |
numeric; highest value of the target variable (larger values will be replaced) |
show.progress |
logical; Display the progress bar? |
Returns a list with four elements:
harmonised
data frame; are spline-estimated values of the target variable at standard depths
obs.preds
data frame; are observed values together with associated spline predictions for each profile at each depth.
var.1cm
matrix; are spline-estimated values of the target variable using the 1 cm increments
tmse
matrix; True mean square error estimate between observed profiles and associated fitted splines.
Target variable needs to be a numeric vector measured at least 2 horizons for the spline to be fitted. Profiles with 1 horizon are accepted and processed as per output requirements, but no spline is fitted as such. Only positive numbers for upper and lower depths can be accepted. It is assumed that soil variables collected per horizon refer to block support i.e. they represent averaged values for the whole horizon. This operation can be time-consuming for large data sets.
Brendan Malone
Bishop, T.F.A., McBratney, A.B., Laslett, G.M., (1999) Modelling soil attribute depth functions with equal-area quadratic smoothing splines. Geoderma, 91(1-2): 27-45.
Malone, B.P., McBratney, A.B., Minasny, B., Laslett, G.M. (2009) Mapping continuous depth functions of soil carbon storage and available water capacity. Geoderma, 154(1-2): 138-152.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | library(aqp)
library(plyr)
library(sp)
#Fit spline
data(oneProfile)
class(oneProfile)
sp.fit<- ea_spline(oneProfile, var.name="C.kg.m3.")
#Using a SoilProfileCollection
## sample profile from Nigeria:
lon = 3.90; lat = 7.50; id = "ISRIC:NG0017"; FAO1988 = "LXp"
top = c(0, 18, 36, 65, 87, 127)
bottom = c(18, 36, 65, 87, 127, 181)
ORCDRC = c(18.4, 4.4, 3.6, 3.6, 3.2, 1.2)
munsell = c("7.5YR3/2", "7.5YR4/4", "2.5YR5/6", "5YR5/8", "5YR5/4", "10YR7/3")
## prepare a SoilProfileCollection:
prof1 <- join(data.frame(id, top, bottom, ORCDRC, munsell),
data.frame(id, lon, lat, FAO1988), type='inner')
depths(prof1) <- id ~ top + bottom
site(prof1) <- ~ lon + lat + FAO1988
coordinates(prof1) <- ~ lon + lat
proj4string(prof1) <- CRS("+proj=longlat +datum=WGS84")
## fit spline:
ORCDRC.s <- ea_spline(prof1, var.name="ORCDRC")
str(ORCDRC.s)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.