Skip to content

Commit

Permalink
Merge branch 'master' into suggest-sp
Browse files Browse the repository at this point in the history
  • Loading branch information
brownag committed Oct 9, 2024
2 parents 0e67bfb + 1511c62 commit fb5cd24
Show file tree
Hide file tree
Showing 81 changed files with 2,653 additions and 1,081 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ jobs:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v4

- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
Expand All @@ -52,15 +51,8 @@ jobs:
brew install --cask xquartz
- uses: r-lib/actions/setup-r-dependencies@v2
if: matrix.config.r == '3.6'
with:
extra-packages: any::rcmdcheck, soiltexture=?ignore-before-r=4.3.0, markovchain=?ignore-before-r=4.0.0, Hmisc=?ignore
needs: check

- uses: r-lib/actions/setup-r-dependencies@v2
if: matrix.config.r != '3.6'
with:
extra-packages: any::rcmdcheck, markovchain=?ignore-before-r=4.0.0
extra-packages: any::rcmdcheck, soiltexture=?ignore-before-r=4.3.0, markovchain=?ignore-before-r=4.0.0, Hmisc=?ignore, knitr=?ignore-before-r=4.0.0, rmarkdown=?ignore-before-r=4.0.0, testthat=?ignore-before-r=4.0.0,
needs: check

- name: Install soilDB from r-universe (R-devel only)
Expand All @@ -70,6 +62,14 @@ jobs:
shell: Rscript {0}

- uses: r-lib/actions/check-r-package@v2
if: matrix.config.r != '3.6'
with:
upload-snapshots: true

- uses: r-lib/actions/check-r-package@v2
if: matrix.config.r == '3.6'
with:
args: 'c("--no-manual", "--as-cran", "--ignore-vignettes", "--no-tests")'
build_args: 'c("--no-manual", "--no-build-vignettes")'
upload-snapshots: true

4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: aqp
Version: 2.0.3
Version: 2.0.4
Title: Algorithms for Quantitative Pedology
Authors@R: c(person(given="Dylan", family="Beaudette", role = c("aut", "cre"), email = "[email protected]"), person(given="Pierre", family="Roudier", email="[email protected]", role = c("aut", "ctb")), person(given="Andrew", family="Brown", email="[email protected]", role = c("aut", "ctb")))
Author: Dylan Beaudette [aut, cre], Pierre Roudier [aut, ctb], Andrew Brown [aut, ctb]
Expand All @@ -15,6 +15,6 @@ URL: https://github.com/ncss-tech/aqp, https://ncss-tech.github.io/AQP/
BugReports: https://github.com/ncss-tech/aqp/issues
Language: en-US
Encoding: UTF-8
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
Roxygen: list(markdown = TRUE)
VignetteBuilder: knitr
4 changes: 3 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
export(HzDepthLogicSubset)
export(L1_profiles)
export(NCSP)
export(PSCS_levels)
export(ReactionClassLevels)
export(SANN_1D)
export(SoilProfileCollection)
Expand Down Expand Up @@ -102,6 +101,7 @@ export(hz_lag)
export(hz_segment)
export(hz_to_taxpartsize)
export(invertLabelColor)
export(lookup_taxpartsize)
export(lunique)
export(maxDepthOf)
export(minDepthOf)
Expand Down Expand Up @@ -175,6 +175,7 @@ exportMethods("horizons<-")
exportMethods("hzID<-")
exportMethods("hzdesgnname<-")
exportMethods("hzidname<-")
exportMethods("hzmetaname<-")
exportMethods("hztexclname<-")
exportMethods("initSpatial<-")
exportMethods("metadata<-")
Expand Down Expand Up @@ -207,6 +208,7 @@ exportMethods(hzID)
exportMethods(hzMetadata)
exportMethods(hzdesgnname)
exportMethods(hzidname)
exportMethods(hzmetaname)
exportMethods(hztexclname)
exportMethods(idname)
exportMethods(isEmpty)
Expand Down
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# aqp 2.0.4 (2024-10-04)
* CRAN release
* ragged bottom lines in `plotSPC()` now adjusted as function of number of profiles and device width
* additional metadata from `plotSPC()` saved to `last_spc_plot` in `aqp.env`
* added Munsell values of 8.5 and 9.5 to Munsell LUT and (interpolated) reference spectra (#318)
* `munsell2rgb()` now safely selects the closest Munsell value and chroma to those available in the package LUT

# aqp 2.0.3 (2024-04-18)
* CRAN release
* `simulateColor()` gains new method `mvnorm` for simulating plausible colors
Expand Down
71 changes: 71 additions & 0 deletions R/SoilProfileCollection-metadata.R
Original file line number Diff line number Diff line change
Expand Up @@ -293,3 +293,74 @@ setReplaceMethod("GHL",
allowednames = "horizon"
)
})

setGeneric("hzmetaname", function(object, attr, required = FALSE)
standardGeneric("hzmetaname"))

#' @title Get or Set Horizon Metadata Column Name
#' @name hzmetaname
#' @aliases hzmetaname hzmetaname,SoilProfileCollection-method hzmetaname<- hzmetaname,SoilProfileCollection-method
#' @details Store the column name containing a specific type of horizon data in the metadata slot of the SoilProfileCollection.
#' @description `hzmetaname()`: Get column name containing horizon data of interest
#' @param object a SoilProfileCollection
#' @param attr character. Base name for attribute to be stored in metadata. This is prefixed with `"aqp_hz"` for horizon-level metadata for column attributes. e.g. `attr="clay"` results in metadata value retrieved from `"aqp_hzclay"`.
#' @param required logical, is this attribute required? If it is, set to `TRUE` to trigger error on invalid result
#' @docType methods
#' @rdname hzmetaname
#' @export
setMethod("hzmetaname", signature(object = "SoilProfileCollection"),
function(object, attr, required = FALSE) {
.require.metadata.aqp(object,
attr = paste0("aqp_hz", attr),
attrlabel = paste0("Horizon metadata (", attr, ") column"),
message = "\nSee ??hzmetaname",
required = required)
})

setGeneric('hzmetaname<-', function(object, attr, required = FALSE, value)
standardGeneric('hzmetaname<-'))

#' @description `hzmetaname<-`: Set horizon designation column name
#' @param object A _SoilProfileCollection_
#' @param attr _character_. Base name for attribute to be stored in metadata. This is prefixed with `"aqp_hz"` for horizon-level metadata for column attributes. e.g. `attr="clay"` results in metadata value retrieved from `"aqp_hzclay"`.
#' @param value _character_. Name of horizon-level column containing data corresponding to `attr`.
#' @param required _logical_. Is this attribute required? If it is, set to `TRUE` to trigger error on invalid `value`.
#' @docType methods
#' @seealso [guessHzAttrName()]
#' @rdname hzmetaname
#' @export
#' @examples
#'
#' data(sp1)
#'
#' # promote to SPC
#' depths(sp1) <- id ~ top + bottom
#'
#' # set important metadata columns
#' hzdesgnname(sp1) <- "name"
#' hztexclname(sp1) <- "texture"
#'
#' # set custom horizon property (clay content) column
#' hzmetaname(sp1, "clay") <- "prop"
#'
#' # inspect metadata list
#' metadata(sp1)
#'
#' # get horizon clay content column
#' hzmetaname(sp1, "clay")
#'
#' # uses hzdesgname(), hztexclname(), hzmetaname(attr="clay") in function definition
#' estimatePSCS(sp1)
setReplaceMethod("hzmetaname",
signature(object = "SoilProfileCollection"),
function(object, attr, required = FALSE, value) {
.set.metadata.aqp(
object = object,
value = value,
required = required,
attr = paste0("aqp_hz", attr),
attrlabel = paste0("Horizon metadata (", attr, ") column"),
message = "\nSee ??hzmetaname",
allowednames = "horizon"
)
})
Loading

0 comments on commit fb5cd24

Please sign in to comment.