if (FALSE) {
b <- c(-119.747629, -119.67935, 36.912019, 36.944987)
bbox.sp <- sf::st_as_sf(wk::rct(
xmin = b[1], xmax = b[2], ymin = b[3], ymax = b[4],
crs = sf::st_crs(4326)
))
ssurgo.geom <- soilDB::SDA_spatialQuery(
bbox.sp,
what = 'mupolygon',
db = 'SSURGO',
geomIntersection = TRUE
)
# grid output
res <- fetchSOLUS(
ssurgo.geom,
depth_slices = "0",
variables = c("sandtotal", "silttotal", "claytotal", "cec7"),
output_type = "prediction"
)
terra::plot(res)
# SoilProfileCollection output, using linear interpolation for 1cm slices
# site-level variables (e.g. resdept) added to site data.frame of SPC
res <- fetchSOLUS(
ssurgo.geom,
depth_slices = c("0", "5", "15", "30", "60", "100", "150"),
variables = c("sandtotal", "silttotal", "claytotal", "cec7", "resdept"),
output_type = "prediction",
method = "linear",
grid = FALSE,
samples = 10
)
# plot, truncating each profile to the predicted restriction depth
aqp::plotSPC(trunc(res, 0, res$resdept_p), color = "claytotal_p", divide.hz = FALSE)
}
Run the code above in your browser using DataLab