Skip to content

Commit

Permalink
ex2.2: ohz
Browse files Browse the repository at this point in the history
  • Loading branch information
brownag committed Jan 18, 2025
1 parent efd1218 commit 753c23b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions data/book/02/ohz.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
library(aqp)

set.seed(456)

d <- list(
id = "P",
name = c(c("Oe", "Oa", "A", "Cg1", "Cg2")),
depths = c(28, 30, 50, 100, 250),
soil_color = c("10YR 2/2", "10YR 2/1", "7.5YR 2.5/1", "10Y 4/1", "2.5Y 5/1"),
soc = c(30, 32, 4, 0.8, 0.5),
bdy = aqp::hzDistinctnessCodeToOffset(c(
"gradual", "gradual", "clear", "diffuse", "clear"
))
)

ohz <- aqp::quickSPC(d, ) |>
aqp::perturb(n = 10, boundary.attr = "bdy") |>
trunc(0, 200)

ohz$soc <- pmax(0.1, jitter(ohz$soc, abs(log10(ohz$soc) * (ohz$bottom - ohz$top))))
ohz$soc[runif(nrow(ohz)) > 0.97] <- NA

plot(ohz)
plot(ohz, color='soc')

save(ohz, file ="../data/book/02/ohz.rda")
Binary file added data/book/02/ohz.rda
Binary file not shown.

0 comments on commit 753c23b

Please sign in to comment.