Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
^codecov\.yml$
^LICENSE\.md$
^misc$
^data-raw$
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.3
Depends: R (>= 3.4.0)
Depends:
R (>= 3.5)
Imports:
readr,
fpeek,
Expand All @@ -26,3 +27,4 @@ Suggests:
covr,
testthat (>= 3.0.0)
Config/testthat/edition: 3
LazyData: true
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export(read_file_dropbox)
export(read_sapflow_file)
export(read_teros_file)
export(scan_folders)
export(search_Lx_variables)
import(dplyr)
import(fpeek)
importFrom(arrow,read_parquet)
Expand Down
22 changes: 22 additions & 0 deletions R/read_Lx_variable.R → R/Lx_variables.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,25 @@ read_L2_variable <- function(variable, path, site = NULL, quiet = FALSE) {
})
bind_rows(x)
}

#' Search the list of COMPASS-FME sensor variables
#'
#' @param term Search term, case insensitive (character)
#'
#' @returns Variables whose descriptions match the search term.
#' @export
#' @note The search is case-sensitive but definitely not 'smart';
#' use single words only!
#' @examples
#' search_Lx_variables("redox")
#' search_Lx_variables("this will not find any matches")
search_Lx_variables <- function(term) {
hits <- grep(tolower(term),
tolower(compasstools::Lx_variables$description),
fixed = TRUE)
if(length(hits) > 0) {
compasstools::Lx_variables[hits,]
} else {
message("No matches found")
}
}
17 changes: 17 additions & 0 deletions R/data.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#' COMPASS-FME sensor data variables
#'
#' A listing of the data variables (the "research names")
#' output by the COMPASS-FME sensor data processing pipeline.
#'
#' @format ## `Lx_variables`
#' A data frame with 154 rows and 2 columns:
#' \describe{
#' \item{research_name}{Name of the output variable}
#' \item{final_units}{Units}
#' \item{description}{Description}
#' }
#' @source See https://github.com/COMPASS-DOE/sensor-data-pipeline
#' @references Pennington et al. (2025), "A Performant, Scalable Processing
#' Pipeline for High-Quality and FAIR Environmental Sensor
#' Data". https://agupubs.onlinelibrary.wiley.com/doi/10.1029/2025JG008807
"Lx_variables"
8 changes: 8 additions & 0 deletions data-raw/Lx_variables.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## code to prepare `Lx_variables` dataset goes here

# `variables_metadata.csv` is direct from the
# sensor data processing pipeline
Lx_variables <- readr::read_csv("data-raw/variables_metadata.csv")
Lx_variables <- Lx_variables[c("research_name", "final_units", "description")]

usethis::use_data(Lx_variables, overwrite = TRUE)
155 changes: 155 additions & 0 deletions data-raw/variables_metadata.csv

Large diffs are not rendered by default.

Binary file added data/Lx_variables.rda
Binary file not shown.
33 changes: 33 additions & 0 deletions man/Lx_variables.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/read_L1_variable.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/read_L2_variable.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions man/search_Lx_variables.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.