ncss-tech / aqp

Algorithms for Quantitative Pedology
http://ncss-tech.github.io/aqp/
54 stars 15 forks source link

new SPC subclass, with gridded representation of horizon membership #46

Open dylanbeaudette opened 6 years ago

dylanbeaudette commented 6 years ago

2D vs. 1D horizonation, useful in situation where cryoturbation is a dominant pedogenic driver.

See Sampling Protocols for Permafrost-Affected Soils for some examples.

Recent papers:

Borrowed from Siewert et al., 2016:

image

dylanbeaudette commented 6 years ago

A very simple, perhaps comical example.

library(raster)
library(wesanderson)

# empty template for horizon classes or membership
r <- raster(nrows=10, ncols=10)

# make up some data representing 
# mixed-up 1D but otherwise common 2D description
r[1:28] <- 1
r[29:44] <- 2
r[45:71] <- 3
r[71:100] <- 4
r[77:83] <- 5
r[4:8] <- 3
r[22:28] <- 5
r[80:88] <- 2

# check
as(r, 'matrix')

#  simple plot of horizon codes
plot(r, col=wes_palette('Zissou', n=5), asp=4, axes=FALSE)

image

dylanbeaudette commented 5 years ago

We need some real examples to work with. Anyone?

dylanbeaudette commented 5 years ago

A much better example c/o @umnpedology (Nic Jelinski) has been added to misc/sandbox:

image

dylanbeaudette commented 1 year ago

Update, will not be using the {raster} package and I'd rather not create a hard dependency on {terra}. There is no reason we can't use the base matrix datatype to encode the data.

Working with the data and plotting will require duplication of effort already solved in packages like {terra}...

dylanbeaudette commented 8 months ago

Some new ideas, using base matrix class to store integer-coded horizon designations. Eventually, this will need to store horizon IDs.

image

Getting the data into this format will require some clever ideas. First, not so clever, idea: use either single-character or horizon designation as ASCII representation of a grid system.

AAOOOOOOOO
AAAAAAAOOO
AAAAAAAAAA
AAAAAAAAAA
AAAAAAAAAA
AAAAAAAABB
AABBBBBBBB
BBBBBBBBBB
BBBBBBBBBB
BBBBBBBBBB
BBBBBBBBBB
BBBBBBBBBB
BBBBBBBBBB
BBBBBBBBBB
BBBBBBBBBB
BBBBBBBCCC
BCCCCCCCCC
BCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCR
CCCCCCCCRR
CCCCCCCRRR
CCCCCCRRRR
CRRRRRRRRR
CCCCCRRRRR
RRRRRRRRRR
RRRRRRRRRR
RRRRRRRRRR
RRRRRRRRRR
RRRRRRRRRR
RRRRRRRRRR
RRRRRRRRRR

Not very efficient, but a starting point for creating data to build / test functionality.