Skip to contents

The function converts the visible soil spectrum to three-dimensional color systems, such as Munsell and RGB, using the CIE tristimulus values for the conversion. This allows for the standardized representation of colors and facilitates visual and comparative analysis.

Usage

soil_color(data = data,
           name_wave = "wave",
           tri_values = "std",
           plot = FALSE)

Arguments

data

A data.frame containing the wavelength and reflectance values.

name_wave

Character indicating the name of the column with the wavelength. It can be only the initial characters.

tri_values

Tristimulus Values. Values from the colorSpec package can be used.

plot

Logical, if TRUE, the plot with the colors is generated, the default is FALSE

Value

A data.frame with color values in Munsell, HVC, RGB, and hexadecimal code.

Examples

# example code
data(soil_refle)

soil_color(soil_refle)
#>    sample       munsell     H    V    C      R      G      B     hex
#> 1      a1 8.3YR 6.2/3.7 18.33 6.15 3.69 179.01 146.84 114.92 #B39272
#> 2      a2 8.2YR 5.9/4.1 18.22 5.94 4.06 173.47 138.32 103.71 #AD8A67
#> 3      a3 5.1YR 5.3/4.1 15.10 5.34 4.14 160.53 120.97  94.65 #A0785E
#> 4      a4   8.6YR 5.3/2 18.56 5.32 2.01 144.23 126.16 109.37 #907E6D
#> 5      a5 8.1YR 5.9/3.2 18.08 5.86 3.22 168.35 139.62 112.87 #A88B70
#> 6      a6 4.4YR 5.8/5.1 14.38 5.81 5.11 181.39 131.27  99.54 #B58363
#> 7      a7   8YR 5.5/3.4 17.99 5.55 3.42 158.98 128.87 101.32 #9E8065
#> 8      a8   4YR 5.5/4.8 13.98 5.48 4.84 171.65 123.89  95.97 #AB7B5F
#> 9      a9 7.2YR 5.6/3.8 17.22 5.57 3.83 164.99 130.31 101.30 #A48265
#> 10    a10 8.4YR 6.7/2.7 18.37 6.71 2.65 186.04 161.47 137.10 #BAA189
#> 11    a11 8.9YR 6.3/2.9 18.92 6.30 2.88 176.07 151.01 124.30 #B0977C
#> 12    a12 7.8YR 5.6/3.5 17.75 5.61 3.46 162.50 131.17 103.15 #A28367
#> 13    a13 9.1YR 5.9/3.3 19.07 5.91 3.27 167.51 140.17 110.05 #A78C6E
#> 14    a14 7.4YR 6.8/4.4 17.40 6.83 4.37 200.72 160.76 124.26 #C8A07C
#> 15    a15   4.4YR 5/4.3 14.41 5.01 4.27 154.56 112.31  86.92 #9A7056
#> 16    a16 8.8YR 5.4/2.4 18.75 5.45 2.38 149.28 128.24 107.55 #95806B
#> 17    a17 8.7YR 5.2/2.4 18.69 5.17 2.38 144.11 123.02 102.80 #907B66
#> 18    a18     8.4YR 6/3 18.43 6.01 2.98 169.40 142.71 116.76 #A98E74
#> 19    a19   5.2YR 5/3.9 15.23 5.05 3.94 151.28 113.62  88.70 #977158
#> 20    a20   5YR 5.5/4.7 14.99 5.52 4.71 169.95 124.79  94.31 #A97C5E
#> 21    a22 7.5YR 5.6/4.4 17.54 5.64 4.36 168.22 129.47  94.74 #A8815E
#> 22    a24   8YR 5.5/3.1 18.05 5.53 3.06 157.15 129.34 104.27 #9D8168
#> 23    a26 8.5YR 5.3/2.7 18.53 5.27 2.71 148.82 125.06 102.55 #947D66

# tristimulus values {colorSpec}
soil_color(soil_refle, tri_values = "xyz1931.1nm", plot = TRUE)
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length
#> Warning: longer object length is not a multiple of shorter object length

#>    sample       munsell     H    V    C      R      G      B     hex
#> 1      a1   9YR 6.4/3.8 19.03 6.35 3.79 183.78 152.49 117.22 #B79875
#> 2      a2 8.6YR 6.2/4.3 18.59 6.17 4.28 181.92 146.21 108.04 #B5926C
#> 3      a3 7.2YR 5.6/4.3 17.17 5.61 4.34 168.00 129.44  96.37 #A88160
#> 4      a4 8.1YR 5.4/2.2 18.09 5.40 2.15 148.62 128.23 110.45 #94806E
#> 5      a5   8.1YR 6/3.4 18.12 6.04 3.44 172.21 141.92 113.38 #AC8D71
#> 6      a6 6.5YR 6.1/5.4 16.46 6.15 5.37 188.80 140.03  98.92 #BC8C62
#> 7      a7 8.8YR 5.7/3.6 18.78 5.73 3.56 164.36 134.32 102.67 #A48666
#> 8      a8   6YR 5.8/5.1 15.98 5.81 5.13 179.57 132.38  95.64 #B3845F
#> 9      a9   8.2YR 5.8/4 18.17 5.80 4.04 170.23 135.86 102.28 #AA8766
#> 10    a10   8YR 6.8/2.8 17.96 6.83 2.84 189.80 163.72 139.26 #BDA38B
#> 11    a11   8.6YR 6.4/3 18.65 6.43 3.03 179.74 153.29 126.27 #B3997E
#> 12    a12 8.5YR 5.8/3.6 18.45 5.80 3.64 167.48 136.70 105.71 #A78869
#> 13    a13 9.6YR 6.1/3.4 19.55 6.07 3.36 172.54 145.64 113.00 #AC9171
#> 14    a14 8.2YR 7.1/4.5 18.18 7.08 4.54 208.06 169.20 128.56 #D0A980
#> 15    a15   6YR 5.3/4.6 16.03 5.30 4.61 162.98 120.39  88.19 #A27858
#> 16    a16 8.4YR 5.6/2.5 18.38 5.55 2.54 155.65 133.07 111.95 #9B856F
#> 17    a17 8.4YR 5.3/2.6 18.37 5.28 2.56 148.30 125.16 103.69 #947D67
#> 18    a18 8.2YR 6.2/3.2 18.23 6.16 3.19 176.18 147.51 120.08 #B09378
#> 19    a19 6.6YR 5.3/4.2 16.63 5.30 4.24 159.95 121.50  91.01 #9F795B
#> 20    a20 6.4YR 5.8/5.1 16.39 5.83 5.05 179.10 132.65  94.79 #B3845E
#> 21    a22 8.5YR 5.9/4.6 18.53 5.90 4.56 175.76 137.82  97.72 #AF8961
#> 22    a24 8.1YR 5.7/3.3 18.11 5.69 3.28 163.61 134.27 107.01 #A3866B
#> 23    a26 8.4YR 5.4/2.9 18.44 5.41 2.89 152.81 127.29 103.15 #987F67