skeleton: soil skeleton

Description Usage Arguments Value Examples

View source: R/skeleton.R

Description

generates layer for the soil skeleton

Usage

1
skeleton(shape_mod, skeleton_mat, seed = 34)

Arguments

shape_mod

A simple feature class object with the base geometry of horizons. At least the following column names must be present in the attributes: horizont id (name), abundanz (skel_ab), minimum dimension in cm (skel_dim_to_from), maximum dimension in cm (skel_dim_to), area of the horizont (area).

skeleton_mat

A data frame with the following parameters (as column names) for specifying the rock form: "name" the horizon id as numeric; "nSides" number of sides; smooth "smooth" logical if should be smooth by; "union" logical value, should the individual stones be connected or each one gets its own outline?; "strat" logical value if the stones are stratified; "cellnumber" numerical value if the stones are stratified in how many horizontal strata should it be; "rotation" Angle of horizontal stratification; "phi" numerical value between 0 and 1. If greater than 0, each stone is drawn in the shape of an ellipse. As the value increases, the ellipse becomes flatter.

seed

set seed for reproducible results

Value

a simple feature with one row for each horizont. A column with the horizontal ID ("Name") and the geometry column with the skeleton content.

Examples

 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
30
31
32
33
34
35
36
37
38
39
 
#create an example dataset and modify the color and depths 
library(dplyr) 
library(ggplot2)
df_example <-  data.frame(name = c("Ah", "Bv", "C"),
                          from = c(0, 15, 43.4),
                          to = c(15, 43.4, 70),
                          col = c("7.5YR 2/1","10YR 4/3", "2.5Y 5/3"),
                          skel_dim = c(".1-.5","1-2", "2-3"),
                          skel_ab = c(0.1, 0.4, .8)) %>%
  data_mod()

#Set coordinates, four points on each horizon
cord_example  <-  cord_setting(df_example, plot_width = 2)

#create a simple feature: Each line represents a horizon
#with one polygon as geometry.
sf_example <- sf_polygon(df_geom = cord_example,
                         df_attri = df_example)
#data frame with specific parameters for the soil skeleton content

skeleton_mat <- data.frame(
  name = c(1,2, 3),
  nSides = c(4,13, 20),
  smooth = c(TRUE, TRUE, TRUE),
  union = c(TRUE, FALSE, TRUE),
  strat = c(FALSE, TRUE, FALSE),
  cellnumber = c(0, 18, 0),
  rotation = c(0,20, 0),
  phi = c(0, 0, 0)
)
spoint <- skeleton(shape_mod = sf_example,
                   skeleton_mat = skeleton_mat)
#Plot the result:
sf_example %>%
  ggplot() +
  geom_sf(fill = sf_example$rgb_col) +
  geom_sf(data = spoint) +
  soil_theme()

nardusstricta/soilprofile2 documentation built on May 23, 2019, 6:04 p.m.