From 2b2ab7f07d722bac92a76b421cd3b45dec13c8aa Mon Sep 17 00:00:00 2001 From: Beaudette Date: Wed, 11 Oct 2023 00:03:34 -0700 Subject: [PATCH] removing / fixing references to rgb2Munsell() #297 --- R/colorQuantiles.R | 4 ++-- R/estimateSoilColor.R | 5 +++++ R/mixMunsell.R | 4 ++-- R/spec2Munsell.R | 4 ++-- man/estimateSoilColor.Rd | 2 +- man/plotColorQuantiles.Rd | 2 +- man/singlebracket.Rd | 5 +++-- man/spec2Munsell.Rd | 6 +++--- 8 files changed, 19 insertions(+), 13 deletions(-) diff --git a/R/colorQuantiles.R b/R/colorQuantiles.R index 31e33982c..af98f2ffd 100644 --- a/R/colorQuantiles.R +++ b/R/colorQuantiles.R @@ -182,9 +182,9 @@ colorQuantiles <- function(soilColors, p = c(0.05, 0.5, 0.95)) { #' @param pt.cex scaling factor for color chips #' @param lab.cex chip label scaling factor #' -#' @return a \code{lattice} graphics object +#' @return a `lattice` graphics object #' -#' @details Marginal percentiles and L1 median CIELAB values from \code{colorQuantiles} are combined into a single plot, arranged in panels according to L, A, and B coordinates. Munsell "chips" (colors and labels) are based on the closest Munsell color found via \code{rgb2Munsell}. +#' @details Marginal percentiles and L1 median CIELAB values from `colorQuantiles()` are combined into a single plot, arranged in panels according to L, A, and B coordinates. Munsell "chips" (colors and labels) are based on the closest Munsell color found via [col2Munsell()]. #' #' @author D.E. Beaudette #' diff --git a/R/estimateSoilColor.R b/R/estimateSoilColor.R index cc84ed372..73c7a354d 100644 --- a/R/estimateSoilColor.R +++ b/R/estimateSoilColor.R @@ -91,6 +91,8 @@ estimateSoilColor <- function(hue, value, chroma, sourceMoistureState = c('dry', ## CIELAB -> closest Munsel res <- col2Munsell(Y, space = 'CIELAB', nClosest = 1) + ## no longer required since col2Munsell() ## + # ## CIELAB -> sRGB # ## TODO: why does farver give slightly different results? # @@ -103,6 +105,9 @@ estimateSoilColor <- function(hue, value, chroma, sourceMoistureState = c('dry', # ## sRGB -> Munsell # res <- rgb2munsell(color = .srgb, colorSpace = 'CIE2000', nClosest = 1) + ### + + ## additional diagnostics... ? return(res) diff --git a/R/mixMunsell.R b/R/mixMunsell.R index bb382165f..49a1ec080 100644 --- a/R/mixMunsell.R +++ b/R/mixMunsell.R @@ -363,7 +363,7 @@ mixMunsell <- function(x, w = rep(1, times = length(x)) / length(x), mixingMetho # XYZ -> sRGB -> Munsell mx <- spec2Munsell(mixed, ...) - # NOTE: ... are passed to rgb2munsell() + # NOTE: ... are passed to col2munsell() # convert = TRUE: mx is a data.frame # convert = FALSE: mx is a matrix @@ -406,7 +406,7 @@ mixMunsell <- function(x, w = rep(1, times = length(x)) / length(x), mixingMetho # https://cran.r-project.org/web/packages/gower/vignettes/intro.pdf # would make sense to reshape reference data - # NOTE: arguments to rgb2munsell() are silently ignored + # NOTE: arguments to col2munsell() are silently ignored ## TODO: time wasted here # reshape reference spectra: wavelength to columns diff --git a/R/spec2Munsell.R b/R/spec2Munsell.R index 9fad4877f..22b8bb28a 100644 --- a/R/spec2Munsell.R +++ b/R/spec2Munsell.R @@ -22,9 +22,9 @@ #' * D65 represents average daylight #' * F2 represents typical fluorescent lighting #' -#' @param ... further arguments to [col2munsell()] +#' @param ... further arguments to [col2Munsell()] #' -#' @return output from [col2munsell()] +#' @return output from [col2Munsell()] #' @export #' #' @references diff --git a/man/estimateSoilColor.Rd b/man/estimateSoilColor.Rd index 461f01d6a..8305f4a24 100644 --- a/man/estimateSoilColor.Rd +++ b/man/estimateSoilColor.Rd @@ -24,7 +24,7 @@ Soil color is typically described at dry and moist conditions. This function att \item convert Munsell notation to CIELAB color coordinates via \code{munsell2rgb()} \item apply scaling, rotation, and translation parameters in CIELAB color space \item convert CIELAB to sRGB coordinates -\item locate closest Munsell chip to sRGB coordinates via \code{rgb2munsell()} +\item locate closest Munsell chip to sRGB coordinates via \code{col2munsell()} } Estimation of dry from moist soil color state is not guaranteed to be symmetric with estimation of moist from dry. diff --git a/man/plotColorQuantiles.Rd b/man/plotColorQuantiles.Rd index 41c248877..91b658ed5 100644 --- a/man/plotColorQuantiles.Rd +++ b/man/plotColorQuantiles.Rd @@ -20,7 +20,7 @@ a \code{lattice} graphics object This function creates a visualization of the output from \code{colorQuantiles} using lattice graphics. } \details{ -Marginal percentiles and L1 median CIELAB values from \code{colorQuantiles} are combined into a single plot, arranged in panels according to L, A, and B coordinates. Munsell "chips" (colors and labels) are based on the closest Munsell color found via \code{rgb2Munsell}. +Marginal percentiles and L1 median CIELAB values from \code{colorQuantiles()} are combined into a single plot, arranged in panels according to L, A, and B coordinates. Munsell "chips" (colors and labels) are based on the closest Munsell color found via \code{\link[=col2Munsell]{col2Munsell()}}. } \author{ D.E. Beaudette diff --git a/man/singlebracket.Rd b/man/singlebracket.Rd index 8ee088bfc..733d2679f 100644 --- a/man/singlebracket.Rd +++ b/man/singlebracket.Rd @@ -1,10 +1,11 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/SoilProfileCollection-operators.R -\name{[,SoilProfileCollection-method} +\name{[,SoilProfileCollection,ANY,ANY,ANY-method} +\alias{[,SoilProfileCollection,ANY,ANY,ANY-method} \alias{[,SoilProfileCollection-method} \title{Matrix/data.frame-like access to profiles and horizons in a SoilProfileCollection} \usage{ -\S4method{[}{SoilProfileCollection}(x, i, j, ..., drop = TRUE) +\S4method{[}{SoilProfileCollection,ANY,ANY,ANY}(x, i, j, ..., drop = TRUE) } \arguments{ \item{x}{a SoilProfileCollection} diff --git a/man/spec2Munsell.Rd b/man/spec2Munsell.Rd index 66ac8ca25..969a461bb 100644 --- a/man/spec2Munsell.Rd +++ b/man/spec2Munsell.Rd @@ -28,10 +28,10 @@ spec2Munsell( \item F2 represents typical fluorescent lighting }} -\item{...}{further arguments to \code{\link[=rgb2munsell]{rgb2munsell()}}} +\item{...}{further arguments to \code{\link[=col2Munsell]{col2Munsell()}}} } \value{ -output from \code{\link[=rgb2munsell]{rgb2munsell()}} +output from \code{\link[=col2Munsell]{col2Munsell()}} } \description{ Convert reflectance spectra to closest Munsell chip @@ -45,7 +45,7 @@ See the \href{https://ncss-tech.github.io/AQP/aqp/mix-colors.html}{expanded tuto data("munsell.spectra.wide") # convert to closest Munsell chip -# sRGB -> Munsell conversion via rgb2Munsell() +# sRGB -> Munsell conversion via col2Munsell() spec2Munsell(munsell.spectra.wide[, '10YR 3/3']) # attempt several