munsell2spc-SoilProfileCollection-method: Merge Munsell Hue, Value, Chroma converted to sRGB & CIELAB...

munsell2spc,SoilProfileCollection-methodR Documentation

Merge Munsell Hue, Value, Chroma converted to sRGB & CIELAB into a SoilProfileCollection

Description

Convert Munsell hue, value and chroma into sRGB (rgb_R, rgb_G, rgb_B) and CIELAB (lab_L, lab_A, lab_B) color coordinates using munsell2rgb. The converted values are stored in the horizons() slot unless as.spc is FALSE, in which case the results are combined with profile and horizon ID columns and returned as the data.frame subclass used by the SPC.

Usage

## S4 method for signature 'SoilProfileCollection'
munsell2spc(
  object,
  hue = "hue",
  value = "value",
  chroma = "chroma",
  .data = NULL,
  as.spc = TRUE
)

Arguments

object

A SoilProfileCollection

hue

Column name containing numeric hue values. Default: "hue"

value

Column name containing numeric value values. Default: "value"

chroma

Column name containing numeric chroma values. Default: "chroma"

.data

Optional: a character vector of equal length to number of horizons (containing Munsell notation), or a column name in the horizon data OR a data.frame containing three columns (names specified in hue, value, chroma)

as.spc

Return a data.frame-like object with ID columns?

Value

A SoilProfileCollection or data.frame-like object

See Also

parseMunsell rgb2munsell munsell2rgb

Examples


data(sp3)
depths(sp3) <- id ~ top + bottom

# inspect input data
horizons(sp3)[,c("hue","value","chroma")]

# do color conversions to sRGB and LAB, join into horizon data
sp3 <- munsell2spc(sp3)

# plot rgb "R" coordinate by horizon
plot(sp3, color = "rgb_R")

# plot lab "A" coordinate by horizon
plot(sp3, color = "lab_A")

# note that `lab_A` values do not exactly match the original `A` values
# this is because `lab_A` was computed from the (field determined) Munsell color notation,
# while `A` was directly measured in the lab by colorimeter
plot(sp3$A, sp3$lab_A, xlab = 'Measured', ylab = 'Converted from Field Observed Munsell')


aqp documentation built on Oct. 19, 2024, 5:06 p.m.