diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 1293b3e5332..a5c26141117 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -26,6 +26,9 @@ - [ ] My change requires a change to the documentation. - [ ] My name is in the list of CITATION.cff +- [ ] I agree that PEcAn Project may distribute my contribution under any or all of + - the same license as the existing code, + - and/or the BSD 3-clause license. - [ ] I have updated the CHANGELOG.md. - [ ] I have updated the documentation accordingly. - [ ] I have read the **CONTRIBUTING** document. diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 7c9ac8badfa..187fa0ca36f 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -8,10 +8,15 @@ jobs: stale: if: github.repository == 'PecanProject/pecan' + permissions: + contents: write + issues: write + pull-requests: write + runs-on: ubuntu-latest steps: - - uses: actions/stale@v6 + - uses: actions/stale@v9 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: 'This issue is stale because it has been open 365 days with no activity.' diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a17817da4b..0cbd0976ae5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ For more information about this file see also [Keep a Changelog](http://keepacha * Model packages `PEcAn.BASGRA`, `PEcAn.CLM45`, `PEcAn.DALEC`, `PEcAn.dvmdostem`, `PEcAn.FATES`, `PEcAn.GDAY`, `PEcAn.JULES`, `PEcAn.LDNDC`, `PEcAn.LINKAGES`, `PEcAn.LPJGUESS`, `PEcAn.MAAT`, `PEcAn.MAESPA`, `PEcAn.PRELES`, `PEcAn.SIBCASA`, `PEcAn.SIPNET`, `PEcAn.STICS`, and the new model package template. * Modules `PEcAn.allometry`, `PEcAn.assim.batch`, `PEcAn.data.mining`, `PEcAn.emulator`, `PEcAn.MA`, `PEcAn.photosynthesis`, `PEcAn.priors`, and `PEcAn.RTM`. - Renamed master branch to main +- `PEcAn.all::pecan_version()` now reports commit hashes as well as version numbers for each installed package. ### Removed diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index eb1ce470e0a..1ec2e870917 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -110,6 +110,10 @@ git push -u origin GH-issuenumber-title-of-issue When finished create a pull request from your branch to the main pecan repository. + When submitting a pull request, you retain authorship of the code you contribute. However, you are giving the PEcAn Project permission to distribute your contributions under either or both, at our discretion, of: + - The license listed at PR opening time for the code you are contributing to, + - and/or the BSD 3-clause license. + ## Additional Resources - [Adding models to PEcAn](https://pecanproject.github.io/pecan-documentation/latest/adding-an-ecosystem-model.html) diff --git a/Makefile b/Makefile index 273592d6e67..db701ada644 100644 --- a/Makefile +++ b/Makefile @@ -67,6 +67,11 @@ drop_parents = $(filter-out $(patsubst %/,%,$(dir $1)), $1) # Generates a list of regular files at any depth inside its argument files_in_dir = $(call drop_parents, $(call recurse_dir, $1)) +# Git hash + clean status for this directory +git_rev = $(shell \ + CLEAN=$$([[ -n $$(git status -s $1) ]] && echo "+mod"); \ + echo $$(git rev-parse --short=10 HEAD)"$$CLEAN") + # HACK: NA vs TRUE switch on dependencies argument is an ugly workaround for # a circular dependency between benchmark and data.land. # When this is fixed, can go back to simple `dependencies = TRUE` @@ -74,6 +79,7 @@ depends_R_pkg = ./scripts/time.sh "depends ${1}" ./scripts/confirm_deps.R ${1} \ $(if $(findstring modules/benchmark,$(1)),NA,TRUE) install_R_pkg = ./scripts/time.sh "install ${1}" Rscript \ -e ${SETROPTIONS} \ + -e "Sys.setenv(PECAN_GIT_REV='$(call git_rev,$1)')" \ -e "remotes::install_local('$(strip $(1))', force=TRUE, dependencies=FALSE, upgrade=FALSE)" check_R_pkg = ./scripts/time.sh "check ${1}" Rscript scripts/check_with_errors.R $(strip $(1)) test_R_pkg = ./scripts/time.sh "test ${1}" Rscript \ @@ -132,12 +138,6 @@ $(subst .doc/models/template,,$(MODELS_D)): .install/models/template ### Order-only dependencies # (i.e. prerequisites must exist before building target, but # target need not be rebuilt when a prerequisite changes) - -.doc/base/all: | $(ALL_PKGS_D) -.install/base/all: | $(ALL_PKGS_I) -.check/base/all: | $(ALL_PKGS_C) -.test/base/all: | $(ALL_PKGS_T) - include Makefile.depends clean: diff --git a/base/all/DESCRIPTION b/base/all/DESCRIPTION index 6d77c125a9f..2cad68114e2 100644 --- a/base/all/DESCRIPTION +++ b/base/all/DESCRIPTION @@ -1,7 +1,6 @@ Package: PEcAn.all Type: Package -Title: PEcAn functions used for ecological forecasts and - reanalysis +Title: PEcAn Functions Used for Ecological Forecasts and Reanalysis Version: 1.8.0.9000 Authors@R: c(person("Mike", "Dietze", role = c("aut"), email = "dietze@bu.edu"), diff --git a/base/all/NAMESPACE b/base/all/NAMESPACE index a7e08575d38..150394015c9 100644 --- a/base/all/NAMESPACE +++ b/base/all/NAMESPACE @@ -1,3 +1,4 @@ # Generated by roxygen2: do not edit by hand +S3method(print,pecan_version_report) export(pecan_version) diff --git a/base/all/NEWS.md b/base/all/NEWS.md index 22b477b0daa..1c4ff017520 100644 --- a/base/all/NEWS.md +++ b/base/all/NEWS.md @@ -3,6 +3,10 @@ ## License change * PEcAn.all is now distributed under the BSD three-clause license instead of the NCSA Open Source license. +## Changed +* `pecan_version()` now reports the Git revision (if known) for each package, + and prints its results more compactly for easier reading. + # PEcAn.all 1.8.0 ## Added diff --git a/base/all/R/pecan_version.R b/base/all/R/pecan_version.R index 85c9fc346db..7d686af6d1f 100644 --- a/base/all/R/pecan_version.R +++ b/base/all/R/pecan_version.R @@ -23,9 +23,9 @@ #' @param exact Show only tags that exactly match `version`, #' or all tags that have it as a substring? #' @return data frame with columns for package name, expected version(s), -#' and installed version. -#' If the `sessioninfo` package is installed, a fourth column reports where -#' each package was installed from: local, github, CRAN, etc. +#' installed version, and Git hash (if known). +#' If the `sessioninfo` package is installed, an additional column reports +#' where each package was installed from: local, github, CRAN, etc. #' #' @examples #' pecan_version() @@ -46,7 +46,7 @@ pecan_version <- function(version = max(PEcAn.all::pecan_releases$version), ) version <- unique(unlist(version)) } - cols_to_return <- c("package", version, "installed") + cols_to_return <- c("package", version, "installed", "build_hash") if (requireNamespace("sessioninfo", quietly = TRUE)) { @@ -55,23 +55,24 @@ pecan_version <- function(version = max(PEcAn.all::pecan_releases$version), all_pkgs <- sessioninfo::package_info(pkgs = "installed", dependencies = FALSE) our_pkgs <- all_pkgs[grepl("PEcAn", all_pkgs$package),] + # Why do we need this when `pkgs = "installed"` usually shows loaded too? + # Because there are times a package is loaded but not installed + # (e.g. notably during R CMD check) all_loaded <- sessioninfo::package_info(pkgs = "loaded", dependencies = FALSE) our_loaded <- all_loaded[grepl("PEcAn", all_loaded$package),] - unloaded <- our_pkgs[!our_pkgs$package %in% our_loaded$package,] - our_pkgs <- rbind(our_loaded, unloaded) - our_pkgs <- our_pkgs[order(our_pkgs$package),] - - # TODO: consider using package_info's callouts of packages where loaded and # installed versions mismatch -- it's a more elegant version of what we # were trying for with the "multiple rows for packages with multiple # versions found" behavior. - our_pkgs$installed <- ifelse( - test = is.na(our_pkgs$loadedversion), - yes = our_pkgs$ondiskversion, - no = our_pkgs$loadedversion) - our_pkgs <- our_pkgs[, c("package", "installed", "source")] + our_pkgs <- merge( + x = our_pkgs[, c("package", "ondiskversion", "source")], + y = our_loaded[, c("package", "loadedversion", "source")], + by.x = c("package", "ondiskversion", "source"), + by.y = c("package", "loadedversion", "source"), + all = TRUE, + sort = TRUE) + colnames(our_pkgs) <- c("package", "installed", "source") our_pkgs$installed <- package_version(our_pkgs$installed) } else { @@ -89,17 +90,24 @@ pecan_version <- function(version = max(PEcAn.all::pecan_releases$version), package = names(our_loaded), installed = sapply(our_loaded, `[[`, "Version")) our_loaded$installed <- package_version(our_loaded$installed) - our_pkgs <- merge(our_pkgs, our_loaded, all = TRUE) + our_pkgs <- merge(our_pkgs, our_loaded, all = TRUE, sort = TRUE) + our_pkgs <- our_pkgs[!duplicated(our_pkgs),] } + want_hash <- !is.na(our_pkgs$installed) + our_pkgs$build_hash[want_hash] <- sapply( + our_pkgs$package[want_hash], + get_buildhash) res <- merge( x = our_pkgs, y = PEcAn.all::pecan_version_history, all = TRUE) - res <- res[, cols_to_return] + res <- drop_na_version_rows(res[, cols_to_return]) + rownames(res) <- res$package + class(res) <- c("pecan_version_report", class(res)) - drop_na_version_rows(res) + res } # Remove rows where all versions are missing @@ -108,3 +116,46 @@ drop_na_version_rows <- function(df) { stopifnot(colnames(df)[[1]] == "package") df[rowSums(is.na(df[, -1])) < ncol(df[, -1]), ] } + + +# Look up git revision, if recorded, from an installed PEcAn package +get_buildhash <- function(pkg) { + # Set if pkg was installed from r-universe or via install_github() + desc_sha <- utils::packageDescription(pkg, fields = "RemoteSha") + if (!is.na(desc_sha)) { + return(substr(desc_sha, 1, 10)) + } + # Set if PECAN_GIT_REV was set during install (includes `make install`) + get0(".build_hash", envir = asNamespace(pkg), ifnotfound = NA_character_) +} + + +# print method for version +# (Just to help it display more compactly) +#' @export +print.pecan_version_report <- function(x, ...) { + + dots <- list(...) + if (is.null(dots$row.names)) { dots$row.names <- FALSE } + if (is.null(dots$right)) { dots$right <- FALSE } + + xx <- as.data.frame(x) + # only print hash for dev versions + # (typically x.y.z.9000, but we'll use anything with a 4th version component) + skip_hash <- is.na(xx$installed[,4]) | is.na(xx$build_hash) + xx$build_hash[skip_hash] <- "" + xx$build_hash <- sub(".{4}\\+mod$", "+mod", xx$build_hash) + xx$installed <- paste0( + xx$installed, + sub("(.+)", " (\\1)", xx$build_hash)) + xx$build_hash <- NULL + if (!is.null(xx$source)) { + xx$source <- paste0( + strtrim(xx$source, 17), + ifelse(nchar(xx$source, type="width") <= 17, "", "...")) + } + dots$x <- xx + do.call("print", dots) + + invisible(x) +} diff --git a/base/all/R/version.R b/base/all/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/base/all/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/base/all/data/pecan_version_history.R b/base/all/data/pecan_version_history.R index 58f77d31170..efff2cdf1ac 100644 --- a/base/all/data/pecan_version_history.R +++ b/base/all/data/pecan_version_history.R @@ -1,25 +1,34 @@ +# Read and format a list of pecan versions -pecan_version_history <- utils::read.csv( - "pecan_version_history.csv", - colClasses = "character", - check.names = FALSE) +# The local() wrapper is to avoid adding objects to the package data: +# Any extra vars defined at the top level of this file would be loaded +# into the global environment by `data("pecan_version_history")` -# We'd like to parse strictly to catch invalid versions (probably typos). -# But we _need_ to allow NAs... and in R < 4.4, package_version did not -# accept NAs unless strict=FALSE. -strict <- TRUE -na_version <- try( - package_version(NA_character_, strict = strict), - silent = TRUE) -if (inherits(na_version, "try-error")) { - strict <- FALSE -} +pecan_version_history <- local({ + pvh <- utils::read.csv( + "pecan_version_history.csv", + colClasses = "character", + check.names = FALSE) -for (col in colnames(pecan_version_history)) { - if (col != "package") { - pecan_version_history[[col]] <- package_version( - pecan_version_history[[col]], - strict = strict) + # We'd like to parse strictly to catch invalid versions (probably typos). + # But we _need_ to allow NAs... and in R < 4.4, package_version did not + # accept NAs unless strict=FALSE. + strict <- TRUE + na_version <- try( + package_version(NA_character_, strict = strict), + silent = TRUE) + if (inherits(na_version, "try-error")) { + strict <- FALSE } -} + + for (col in colnames(pvh)) { + if (col != "package") { + pvh[[col]] <- package_version( + pvh[[col]], + strict = strict) + } + } + + pvh +}) diff --git a/base/all/man/pecan_version.Rd b/base/all/man/pecan_version.Rd index a0275089a9a..1f3c9578b59 100644 --- a/base/all/man/pecan_version.Rd +++ b/base/all/man/pecan_version.Rd @@ -14,9 +14,9 @@ or all tags that have it as a substring?} } \value{ data frame with columns for package name, expected version(s), -and installed version. -If the \code{sessioninfo} package is installed, a fourth column reports where -each package was installed from: local, github, CRAN, etc. +installed version, and Git hash (if known). +If the \code{sessioninfo} package is installed, an additional column reports +where each package was installed from: local, github, CRAN, etc. } \description{ Reports the currently installed or loaded version(s) of each PEcAn package, diff --git a/base/all/tests/Rcheck_reference.log b/base/all/tests/Rcheck_reference.log index c03d9bb902b..30cecf2ff34 100644 --- a/base/all/tests/Rcheck_reference.log +++ b/base/all/tests/Rcheck_reference.log @@ -14,38 +14,6 @@ New submission Version contains large components (1.7.2.9000) -License components with restrictions and base license permitting such: - BSD_3_clause + file LICENSE -File 'LICENSE': - University of Illinois/NCSA Open Source License - - Copyright (c) 2012, University of Illinois, NCSA. All rights reserved. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal with the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimers. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. - - Neither the names of University of Illinois, NCSA, nor the names - of its contributors may be used to endorse or promote products - derived from this Software without specific prior written permission. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR - ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. - Strong dependencies not in mainstream repositories: PEcAn.DB, PEcAn.settings, PEcAn.MA, PEcAn.logger, PEcAn.utils, PEcAn.uncertainty, PEcAn.data.atmosphere, PEcAn.data.land, @@ -54,13 +22,6 @@ Strong dependencies not in mainstream repositories: Suggests or Enhances not in mainstream repositories: PEcAn.ED2, PEcAn.SIPNET, PEcAn.BIOCRO, PEcAn.DALEC, PEcAn.LINKAGES, PEcAn.allometry, PEcAn.photosynthesis - -The Title field should be in title case. Current version is: -‘PEcAn functions used for ecological forecasts and reanalysis’ -In title case that is: -‘PEcAn Functions Used for Ecological Forecasts and Reanalysis’ - -The Date field is over a month old. * checking package namespace information ... OK * checking package dependencies ... NOTE Depends: includes the non-default packages: diff --git a/base/all/tests/testthat/test-pecan_version.R b/base/all/tests/testthat/test-pecan_version.R index c1e45b0c267..b66172709a2 100644 --- a/base/all/tests/testthat/test-pecan_version.R +++ b/base/all/tests/testthat/test-pecan_version.R @@ -26,7 +26,7 @@ test_that("pecan_version", { # tags substring matched only when exact = FALSE expect_named( pecan_version("v1.5"), - c("package", paste0("v1.5.", 0:3), "installed", "source") + c("package", paste0("v1.5.", 0:3), "installed", "build_hash", "source") ) expect_error( pecan_version("v1.5", exact = TRUE), @@ -34,14 +34,14 @@ test_that("pecan_version", { ) expect_named( pecan_version("v1.3", exact = TRUE), - c("package", "v1.3", "installed", "source") + c("package", "v1.3", "installed", "build_hash", "source") ) # returns current release if no args given noargs <- pecan_version() expected_tag <- tail(PEcAn.all::pecan_releases, 1)$tag - expect_length(noargs, 4) - expect_named(noargs, c("package", expected_tag, "installed", "source")) + expect_length(noargs, 5) + expect_named(noargs, c("package", expected_tag, "installed", "build_hash", "source")) # Why the `any()`s below? # Because R CMD check runs tests with local test dir added to .libPaths, @@ -77,8 +77,8 @@ test_that("pecan_version without sessioninfo", { mockery::stub(pecan_version, 'requireNamespace', FALSE) without_sessinfo <- pecan_version() - expect_length(with_sessinfo, 4) - expect_length(without_sessinfo, 3) + expect_length(with_sessinfo, 5) + expect_length(without_sessinfo, 4) expect_equal( with_sessinfo[, colnames(with_sessinfo) != "source"], without_sessinfo) @@ -91,3 +91,37 @@ test_that("pecan_version without sessioninfo", { # The approach that failed just before I wrote this note: # No, the version of PEcAn.all (1.8.1.9000 today) is not reliably in sync with # the PEcAn version last tagged as a release (1.7.2 today). + + +test_that("printing", { + ver <- structure( + data.frame( + package = "PEcAnFake", + v0.0 = package_version("1.2.3"), + installed = package_version("1.2.3.9000"), + build_hash = "01234567ab", + source = "13 characters"), + class = c("pecan_version_report", "data.frame") + ) + + long_ver <- ver + long_ver$build_hash = "01234567ab+mod" + long_ver$source = "twenty-two characters" + + # hash truncated to fit "+mod" if present + expect_output(print(ver), "01234567ab", fixed = TRUE) + expect_output(print(long_ver), "012345+mod", fixed = TRUE) + + # source truncated to total of 20 chars + expect_output(print(ver), "13 characters$") + expect_output(print(long_ver), "twenty-two charac...", fixed = TRUE) + + # source truncation works on width not glyph count + long_ver$source <- gsub("tw", "\U{1F197}\U{1F192}", long_ver$source) + expect_output(print(long_ver), "\U{1F192}o ch...", fixed = TRUE) + + # dots passed on + expect_output(print(ver), "\n PEcAnFake") + expect_output(print(ver, row.names = TRUE), "\n1 PEcAnFake", fixed = TRUE) + expect_output(print(ver, quote = TRUE), "\n \"PEcAnFake\"", fixed = TRUE) +}) diff --git a/base/db/DESCRIPTION b/base/db/DESCRIPTION index 76b55aed168..f88a16982e4 100644 --- a/base/db/DESCRIPTION +++ b/base/db/DESCRIPTION @@ -73,7 +73,7 @@ Suggests: tidyverse, withr License: BSD_3_clause + file LICENSE -VignetteBuilder: knitr +VignetteBuilder: knitr, rmarkdown Copyright: Authors LazyLoad: yes LazyData: FALSE diff --git a/base/db/R/version.R b/base/db/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/base/db/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/base/logger/R/version.R b/base/logger/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/base/logger/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/base/qaqc/DESCRIPTION b/base/qaqc/DESCRIPTION index 5334347a906..041f957d25b 100644 --- a/base/qaqc/DESCRIPTION +++ b/base/qaqc/DESCRIPTION @@ -35,6 +35,6 @@ Copyright: Authors LazyLoad: yes LazyData: FALSE Encoding: UTF-8 -VignetteBuilder: knitr +VignetteBuilder: knitr, rmarkdown Config/testthat/edition: 3 RoxygenNote: 7.3.2 diff --git a/base/qaqc/R/version.R b/base/qaqc/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/base/qaqc/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/base/remote/R/version.R b/base/remote/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/base/remote/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/base/settings/R/version.R b/base/settings/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/base/settings/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/base/utils/LICENSE b/base/utils/LICENSE index 9e38c2dc685..09ef35a60b4 100644 --- a/base/utils/LICENSE +++ b/base/utils/LICENSE @@ -1,29 +1,3 @@ -University of Illinois/NCSA Open Source License - -Copyright (c) 2012, University of Illinois, NCSA. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal with the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -- Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimers. -- Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. -- Neither the names of University of Illinois, NCSA, nor the names - of its contributors may be used to endorse or promote products - derived from this Software without specific prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF -CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. - +YEAR: 2024 +COPYRIGHT HOLDER: PEcAn Project +ORGANIZATION: PEcAn Project, authors affiliations diff --git a/base/utils/NEWS.md b/base/utils/NEWS.md index 2832fad34ff..05aa69b5d67 100644 --- a/base/utils/NEWS.md +++ b/base/utils/NEWS.md @@ -1,5 +1,8 @@ # PEcAn.utils 1.8.0.9000 +## License change +* PEcAn.utils is now distributed under the BSD three-clause license instead of the NCSA Open Source license. + ## Added * utility function `zero.bounded.density` is now exported. diff --git a/base/utils/R/Defunct.R b/base/utils/R/Defunct.R index e74d3e3c425..4533ce75891 100644 --- a/base/utils/R/Defunct.R +++ b/base/utils/R/Defunct.R @@ -1,5 +1,6 @@ -#' @title Defunct functions in PEcAn.utils -#' @description The functions listed below are defunct and have been removed from the package. +#' Defunct functions in PEcAn.utils +#' +#' The functions listed below are defunct and have been removed from the package. #' Calling them will produce a message indicating what function, if any, has replaced it. #' #' @name PEcAn.utils-defunct diff --git a/base/utils/R/cf2date.R b/base/utils/R/cf2date.R index bef5fb9d795..79380c8fc50 100644 --- a/base/utils/R/cf2date.R +++ b/base/utils/R/cf2date.R @@ -81,4 +81,4 @@ datetime2doy <- function(datetime, tz = "UTC") { #' #' @author Alexey Shiklomanov #' -cf2doy <- function(value, unit, tz = "UTC") datetime2doy(cf2datetime(value, unit, tz), tz) \ No newline at end of file +cf2doy <- function(value, unit, tz = "UTC") datetime2doy(cf2datetime(value, unit, tz), tz) diff --git a/base/utils/R/clear.scratch.R b/base/utils/R/clear.scratch.R index afc37df0221..924f8e3d149 100644 --- a/base/utils/R/clear.scratch.R +++ b/base/utils/R/clear.scratch.R @@ -1,24 +1,14 @@ -#------------------------------------------------------------------------------- -# Copyright (c) 2012 University of Illinois, NCSA. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the -# University of Illinois/NCSA Open Source License -# which accompanies this distribution, and is available at -# http://opensource.ncsa.illinois.edu/license.html -#------------------------------------------------------------------------------- -##' Removes previous model run output from worker node local scratch directories on EBI-CLUSTER -##' -##' @title Clear EBI-CLUSTER worker node local scratch directories of old PEcAn output -##' @name clear.scratch -##' @author Shawn Serbin -##' @param settings list of PEcAn settings. Only \code{settings$host$name} is used -##' @return nothing -##' @export -##' @examples -##' \dontrun{ -##' clear.scratch(settings) -##' } +#' Removes previous model run output from worker node local scratch directories on EBI-CLUSTER +#' +#' @author Shawn Serbin +#' @param settings list of PEcAn settings. Only \code{settings$host$name} is used +#' @return nothing +#' @export +#' @examples +#' \dontrun{ +#' clear.scratch(settings) +#' } clear.scratch <- function(settings) { ### Setup script diff --git a/base/utils/R/distn.stats.R b/base/utils/R/distn.stats.R index 6cf66acaac5..f8ee4ddd1df 100644 --- a/base/utils/R/distn.stats.R +++ b/base/utils/R/distn.stats.R @@ -1,15 +1,16 @@ -##' Implementation of standard equations used to calculate mean and sd for a variety of -##' named distributions different -##' -##' @title Distribution Stats -##' @param distn named distribution, one of 'beta', 'exp', 'f', 'gamma', 'lnorm', 'norm', 't', -##' @param a numeric; first parameter of \code{distn} -##' @param b numeric; second parameter of \code{distn} -##' @return vector with mean and standard deviation -##' @export -##' @author David LeBauer -##' @examples -##' distn.stats('norm', 0, 1) +#' Distribution Stats +#' +#' Implementation of standard equations used to calculate mean and sd for a variety of +#' named distributions different +#' +#' @param distn named distribution, one of 'beta', 'exp', 'f', 'gamma', 'lnorm', 'norm', 't', +#' @param a numeric; first parameter of \code{distn} +#' @param b numeric; second parameter of \code{distn} +#' @return vector with mean and standard deviation +#' @export +#' @author David LeBauer +#' @examples +#' distn.stats('norm', 0, 1) distn.stats <- function(distn, a, b) { mean <- sd <- NULL if (distn == "beta") { @@ -44,14 +45,15 @@ distn.stats <- function(distn, a, b) { } # distn.stats -##' a helper function for computing summary statistics of a parametric distribution -##' -##' @title return mean and standard deviation of a distribution for each distribution in a table with \code{colnames = c('distn', 'a', 'b')}, -##' e.g. in a table of priors -##' @param distns table of distributions; see examples -##' @return named vector of mean and SD -##' @export -##' @author David LeBauer +#' Helper function for computing summary statistics of a parametric distribution +#' +#' return mean and standard deviation of a distribution for each distribution in a table with \code{colnames = c('distn', 'a', 'b')}, +#' e.g. in a table of priors +#' +#' @param distns table of distributions; see examples +#' @return named vector of mean and SD +#' @export +#' @author David LeBauer distn.table.stats <- function(distns) { y <- as.data.frame(matrix(NA, nrow(distns), 2)) for (i in seq_len(nrow(distns))) { diff --git a/base/utils/R/download.url.R b/base/utils/R/download.url.R index 557493ee80c..06561891332 100644 --- a/base/utils/R/download.url.R +++ b/base/utils/R/download.url.R @@ -1,25 +1,23 @@ -##' Try and download a file. -##' -##' This will download a file, if retry is set and 404 is returned it will -##' wait until the file is available. If the file is still not available -##' after timeout tries, it will return NA. If the file is downloaded -##' it will return the name of the file -##' -##' @name download.url -##' @title Download file from the url. -##' @export -##' @param url the url of the file to download -##' @param file the filename -##' @param timeout number of seconds to wait for file (default 600) -##' @param .opts list of options for curl, for example to download from a -##' protected site use list(userpwd=userpass, httpauth = 1L) -##' @param retry retry if url not found yet, this is used by Brown Dog -##' @return returns name of file if successful or NA if not. -##' -##' @examples -##' \dontrun{ -##' download.url('http://localhost/', index.html) -##' } +#' Try and download a file. +#' +#' This will download a file, if retry is set and 404 is returned it will +#' wait until the file is available. If the file is still not available +#' after timeout tries, it will return NA. If the file is downloaded +#' it will return the name of the file +#' +#' @export +#' @param url the url of the file to download +#' @param file the filename +#' @param timeout number of seconds to wait for file (default 600) +#' @param .opts list of options for curl, for example to download from a +#' protected site use list(userpwd=userpass, httpauth = 1L) +#' @param retry retry if url not found yet, this is used by Brown Dog +#' @return returns name of file if successful or NA if not. +#' +#' @examples +#' \dontrun{ +#' download.url('http://localhost/', index.html) +#' } download.url <- function(url, file, timeout = 600, .opts = list(), retry = TRUE) { count <- 0 while (retry && !url_found(url) && count < timeout) { diff --git a/base/utils/R/full.path.R b/base/utils/R/full.path.R index 7a0b681cdb0..1221a81513a 100644 --- a/base/utils/R/full.path.R +++ b/base/utils/R/full.path.R @@ -1,26 +1,16 @@ -#------------------------------------------------------------------------------- -# Copyright (c) 2012 University of Illinois, NCSA. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the -# University of Illinois/NCSA Open Source License -# which accompanies this distribution, and is available at -# http://opensource.ncsa.illinois.edu/license.html -#------------------------------------------------------------------------------- -##' Creates an absolute path to a folder. -##' -##' This will take a folder and make it into an absolute folder name. It -##' will normalize the path and prepend it with the current working folder -##' if needed to get an absolute path name. -##' -##' @title Creates an absolute path to a folder -##' @name full.path -##' @param folder folder for file paths. -##' @author Rob Kooper -##' @return absolute path -##' @export -##' @examples -##' full.path('pecan') +#' Creates an absolute path to a folder. +#' +#' This will take a folder and make it into an absolute folder name. It +#' will normalize the path and prepend it with the current working folder +#' if needed to get an absolute path name. +#' +#' @param folder folder for file paths. +#' @author Rob Kooper +#' @return absolute path +#' @export +#' @examples +#' full.path('pecan') full.path <- function(folder) { # normalize pathname folder <- normalizePath(folder, mustWork = FALSE) diff --git a/base/utils/R/get.ensemble.inputs.R b/base/utils/R/get.ensemble.inputs.R index bcc7a5553ea..3377dd507ea 100644 --- a/base/utils/R/get.ensemble.inputs.R +++ b/base/utils/R/get.ensemble.inputs.R @@ -1,14 +1,16 @@ ## split clim file into smaller time units to use in KF -##' @title get.ensemble.inputs -##' @name get.ensemble.inputs -##' @author Mike Dietze and Ann Raiho -##' -##' @param settings PEcAn settings list -##' @param ens ensemble number. default = 1 -##' @description Splits climate met for SIPNET -##' -##' @return find correct ensemble inputs -##' @export + +#' get.ensemble.inputs +#' +#' Splits climate met for SIPNET +#' +#' @author Mike Dietze and Ann Raiho +#' +#' @param settings PEcAn settings list +#' @param ens ensemble number. default = 1 +#' +#' @return find correct ensemble inputs +#' @export get.ensemble.inputs <- function(settings, ens = 1){ diff --git a/base/utils/R/help.R b/base/utils/R/help.R index dbc5281dbdd..175d8f302ef 100644 --- a/base/utils/R/help.R +++ b/base/utils/R/help.R @@ -1,36 +1,43 @@ -#------------------------------------------------------------------------------- -# Copyright (c) 2012 University of Illinois, NCSA. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the -# University of Illinois/NCSA Open Source License -# which accompanies this distribution, and is available at -# http://opensource.ncsa.illinois.edu/license.html -#------------------------------------------------------------------------------- - -##' R package to support PEcAn, the Predictive Ecosystem Analyzer -##' -##' Instructions for the use of this package are provided in the project documentation \url{https://pecanproject.github.io/documentation.html}. -##' -##' Project homepage: \url{pecanproject.org} -##' -##' Description of PEcAn -##' -##' The Predictive Ecosystem Analyzer (PEcAn) is a scientific workflow management tool that is designed to simplify the management of model parameterization, execution, and analysis. The goal of PEcAn is to streamline the interaction between data and models, and to improve the efficacy of scientific investigation. PEcAn is an open source utility that encapsulates: -##' -##' 1. acquisition of meteorological inputs -##' 2. synthesis of physiological trait data as the posterior distribution of a Bayesian meta-analysis -##' 3. sampling trait meta-analysis posterior distributions to parameterize ensembles of ED2 and other ecophysiological models -##' 4. probabilistic forecasts -##' 5. postprocessing to constrain forecasts and model parameters with field, meterological, eddy flux, and spectral data, and -##' 6. provenance tracking -##' -##' PECAn integrates available data into ecological forecasts by running ensembles of a terrestrial ecosystem model that is parameterized by the posterior distribution from a meta-analysis of available plant trait data. -##' These trait data are assembled from field research and primary literature, and are stored in a PostgreSQL database. Current development focused on biofuel crops uses BETYdb. -##' In addition to generating forecasts that reflect available data, PEcAn quantifies the contribution of each parameter to model uncertainty. -##' This information informs targeted data collection and synthesis efforts that most efficiently reduce forecast uncertainty. -##' -##' Current development is focused on developing PEcAn into a real-time data assimilation and forecasting system. This system will provide a detailed analysis of the past and present ecosystem functioning that seamlessly transitions into forecasts. -##' -##' @name PEcAn -##' @aliases PECAn pecan package-pecan +#' R package to support PEcAn, the Predictive Ecosystem Analyzer +#' +#' Instructions for the use of this package are provided in the project +#' documentation \url{https://pecanproject.github.io/documentation.html}. +#' +#' Project homepage: \url{pecanproject.org} +#' +#' Description of PEcAn +#' +#' The Predictive Ecosystem Analyzer (PEcAn) is a scientific workflow management +#' tool that is designed to simplify the management of model parameterization, +#' execution, and analysis. The goal of PEcAn is to streamline the interaction +#' between data and models, and to improve the efficacy of scientific +#' investigation. PEcAn is an open source utility that encapsulates: +#' +#' 1. acquisition of meteorological inputs +#' 2. synthesis of physiological trait data as the posterior distribution of a +#' Bayesian meta-analysis +#' 3. sampling trait meta-analysis posterior distributions to parameterize +#' ensembles of ED2 and other ecophysiological models +#' 4. probabilistic forecasts +#' 5. postprocessing to constrain forecasts and model parameters with field, +#' meterological, eddy flux, and spectral data, and +#' 6. provenance tracking +#' +#' PECAn integrates available data into ecological forecasts by running +#' ensembles of a terrestrial ecosystem model that is parameterized by the +#' posterior distribution from a meta-analysis of available plant trait data. +#' These trait data are assembled from field research and primary literature, +#' and are stored in a PostgreSQL database. Current development focused on +#' biofuel crops uses BETYdb. In addition to generating forecasts that reflect +#' available data, PEcAn quantifies the contribution of each parameter to model +#' uncertainty. This information informs targeted data collection and synthesis +#' efforts that most efficiently reduce forecast uncertainty. +#' +#' Current development is focused on developing PEcAn into a real-time data +#' assimilation and forecasting system. This system will provide a detailed +#' analysis of the past and present ecosystem functioning that seamlessly +#' transitions into forecasts. +#' +#' @name PEcAn +#' @aliases PECAn pecan package-pecan "_PACKAGE" diff --git a/base/utils/R/listToArgString.R b/base/utils/R/listToArgString.R index 68d56d599d2..880c07d0007 100644 --- a/base/utils/R/listToArgString.R +++ b/base/utils/R/listToArgString.R @@ -1,11 +1,11 @@ -##' format a list of arguments as one comma-separated string -##' -##' @export -##' -##' @param l a named list of function arguments -##' @return A string containing named argument/value pairs separated by commas -##' -##' @author Ryan Kelly +#' format a list of arguments as one comma-separated string +#' +#' @export +#' +#' @param l a named list of function arguments +#' @return A string containing named argument/value pairs separated by commas +#' +#' @author Ryan Kelly ## This little utility is used in a few places in data.atmosphere. listToArgString <- function(l) { arg.string <- "" diff --git a/base/utils/R/mail.R b/base/utils/R/mail.R index d188b43275b..35735aab676 100644 --- a/base/utils/R/mail.R +++ b/base/utils/R/mail.R @@ -1,25 +1,17 @@ -#------------------------------------------------------------------------------- -# Copyright (c) 2012 University of Illinois, NCSA. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the -# University of Illinois/NCSA Open Source License -# which accompanies this distribution, and is available at -# http://opensource.ncsa.illinois.edu/license.html -#------------------------------------------------------------------------------- -##' Sends email. This assumes the program sendmail is installed. -##' -##' @param from the sender of the mail message -##' @param to the receipient of the mail message -##' @param subject the subject of the mail message -##' @param body the body of the mail message -##' @author Rob Kooper -##' @return nothing -##' @export -##' @examples -##' \dontrun{ -##' sendmail('bob@@example.com', 'joe@@example.com', 'Hi', 'This is R.') -##' } +#' Sends email. This assumes the program sendmail is installed. +#' +#' @param from the sender of the mail message +#' @param to the receipient of the mail message +#' @param subject the subject of the mail message +#' @param body the body of the mail message +#' @author Rob Kooper +#' @return nothing +#' @export +#' @examples +#' \dontrun{ +#' sendmail('bob@@example.com', 'joe@@example.com', 'Hi', 'This is R.') +#' } sendmail <- function(from, to, subject, body) { if (is.null(to)) { PEcAn.logger::logger.error("No receipient specified, mail is not send.") @@ -38,4 +30,3 @@ sendmail <- function(from, to, subject, body) { unlink(mailfile) } } # sendmail - diff --git a/base/utils/R/n_leap_day.R b/base/utils/R/n_leap_day.R index 0bbdae568e2..fffa28c3f09 100644 --- a/base/utils/R/n_leap_day.R +++ b/base/utils/R/n_leap_day.R @@ -1,9 +1,9 @@ -##' @name n_leap_day -##' @title n_leap_day -##' @description number of leap days between two dates -##' @author Mike Dietze -##' @param start_date,end_date dates in any format recognized by \code{\link[base]{as.Date}} -##' @export +#' n_leap_day +#' +#' number of leap days between two dates +#' @author Mike Dietze +#' @param start_date,end_date dates in any format recognized by \code{\link[base]{as.Date}} +#' @export n_leap_day <- function(start_date, end_date) { ## make sure dates are formatted correctly diff --git a/base/utils/R/r2bugs.distributions.R b/base/utils/R/r2bugs.distributions.R index 0e832c3183d..1ec86414388 100644 --- a/base/utils/R/r2bugs.distributions.R +++ b/base/utils/R/r2bugs.distributions.R @@ -1,26 +1,17 @@ -#------------------------------------------------------------------------------- -# Copyright (c) 2012 University of Illinois, NCSA. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the -# University of Illinois/NCSA Open Source License -# which accompanies this distribution, and is available at -# http://opensource.ncsa.illinois.edu/license.html -#------------------------------------------------------------------------------- - -##' convert R parameterizations to BUGS paramaterizations -##' -##' R and BUGS have different parameterizations for some distributions. This function transforms the distributions from R defaults to BUGS defaults. BUGS is an implementation of the BUGS language, and these transformations are expected to work for bugs. -##' @title convert R parameterizations to BUGS paramaterizations -##' @param priors data.frame with columns distn = distribution name, parama, paramb using R default parameterizations. -##' @param direction One of "r2bugs" or "bugs2r" -##' @return priors dataframe using JAGS default parameterizations -##' @author David LeBauer, Ben Bolker -##' @export -##' @examples -##' priors <- data.frame(distn = c('weibull', 'lnorm', 'norm', 'gamma'), -##' parama = c(1, 1, 1, 1), -##' paramb = c(2, 2, 2, 2)) -##' r2bugs.distributions(priors) +#' convert R parameterizations to BUGS paramaterizations +#' +#' R and BUGS have different parameterizations for some distributions. This function transforms the distributions from R defaults to BUGS defaults. BUGS is an implementation of the BUGS language, and these transformations are expected to work for bugs. +#' +#' @param priors data.frame with columns distn = distribution name, parama, paramb using R default parameterizations. +#' @param direction One of "r2bugs" or "bugs2r" +#' @return priors dataframe using JAGS default parameterizations +#' @author David LeBauer, Ben Bolker +#' @export +#' @examples +#' priors <- data.frame(distn = c('weibull', 'lnorm', 'norm', 'gamma'), +#' parama = c(1, 1, 1, 1), +#' paramb = c(2, 2, 2, 2)) +#' r2bugs.distributions(priors) r2bugs.distributions <- function(priors, direction = "r2bugs") { priors$distn <- as.character(priors$distn) @@ -76,19 +67,19 @@ bugs2r.distributions <- function(..., direction = "bugs2r") { } # bugs2r.distributions -##' Sample from an R distribution using JAGS -##' -##' Takes a distribution with R parameterization, converts it to a -##' BUGS parameterization, and then samples from the distribution using -##' JAGS -##' @title bugs.rdist -##' @param prior dataframe with distribution name and parameters -##' @param n.iter number of MCMC samples. Output will have n.iter/4 samples -##' @param n number of randomly chosen samples to return. +#' Sample from an R distribution using JAGS +#' +#' Takes a distribution with R parameterization, converts it to a +#' BUGS parameterization, and then samples from the distribution using +#' JAGS +#' +#' @param prior dataframe with distribution name and parameters +#' @param n.iter number of MCMC samples. Output will have n.iter/4 samples +#' @param n number of randomly chosen samples to return. ## If NULL, returns all n.iter/4 of them -##' @return vector of samples -##' @export -##' @author David LeBauer +#' @return vector of samples +#' @export +#' @author David LeBauer bugs.rdist <- function(prior = data.frame(distn = "norm", parama = 0, paramb = 1), n.iter = 1e+05, n = NULL) { need_packages("rjags") diff --git a/base/utils/R/read.output.R b/base/utils/R/read.output.R index 2929c3cb76b..a641b113aa3 100644 --- a/base/utils/R/read.output.R +++ b/base/utils/R/read.output.R @@ -1,62 +1,54 @@ -#------------------------------------------------------------------------------- -# Copyright (c) 2012 University of Illinois, NCSA. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the -# University of Illinois/NCSA Open Source License -# which accompanies this distribution, and is available at -# http://opensource.ncsa.illinois.edu/license.html -#------------------------------------------------------------------------------- - -##' Read model output -##' -##' Reads the output of a single model run -##' -##' Generic function to convert model output from model-specific format to -##' a common PEcAn format. This function uses MsTMIP variables except that units of -##' (kg m-2 d-1) are converted to kg ha-1 y-1. Currently this function converts -##' Carbon fluxes: GPP, NPP, NEE, TotalResp, AutoResp, HeteroResp, -##' DOC_flux, Fire_flux, and Stem (Stem is specific to the BioCro model) -##' and Water fluxes: Evaporation (Evap), Transpiration (TVeg), -##' surface runoff (Qs), subsurface runoff (Qsb), and rainfall (Rainf). -##' For more details, see the [MsTMIP -##' variables](http://nacp.ornl.gov/MsTMIP_variables.shtml) -##' documentation. -##' -##' @param runid the ID distinguishing the model run. Can be omitted -##' if `ncfiles` is set. -##' @param outdir the directory that the model's output was sent to. -##' Can be omitted if `ncfiles` is set. -##' @param variables Character vector of variables to be read from -##' model output. Default = `"GPP"`. If `NULL`, try to read all -##' variables in output file.. -##' @param dataframe Logical: if TRUE, will return output in a -##' `data.frame` format with a posix column. Useful for -##' `PEcAn.benchmark::align.data` and plotting. -##' @param pft.name character string, name of the plant functional -##' type (PFT) to read PFT-specific output. If `NULL` no -##' PFT-specific output will be read even the variable has PFT as a -##' dimension. -##' @param ncfiles Custom character vector of full paths to NetCDF -##' files. If `NULL` (default), this list is constructed -##' automatically by looking for `YYYY.nc` files in -##' `file.path(outdir, runid)`. -##' @param verbose Logical. If `TRUE`, print status as every year and -##' variable is read, as well as all NetCDF diagnostics (from -##' `verbose` argument to, e.g., [ncdf4::nc_open()]) (default = -##' `FALSE`). -##' @param print_summary Logical. If `TRUE` (default), calculate and -##' print a summary of the means of each variable for each year. -##' @param start.year,end.year first and last year of output to read. -##' Specify as a date-time (only the year portion is used) or as a -##' four-digit number or string. If `NA`, reads all years found in -##' `outdir`. -##' @return If `dataframe = FALSE`, a vector of output variables. If -##' `dataframe = TRUE`, a `data.frame` of output variables with -##' POSIXct timestamps added (`posix` column). The `posix` column -##' is in seconds after January 1 of `start.year`, or 1970 if -##' `start.year` is not provided. -##' @export -##' @author Michael Dietze, David LeBauer, Alexey Shiklomanov +#' Read model output +#' +#' Reads the output of a single model run +#' +#' Generic function to convert model output from model-specific format to +#' a common PEcAn format. This function uses MsTMIP variables except that units of +#' (kg m-2 d-1) are converted to kg ha-1 y-1. Currently this function converts +#' Carbon fluxes: GPP, NPP, NEE, TotalResp, AutoResp, HeteroResp, +#' DOC_flux, Fire_flux, and Stem (Stem is specific to the BioCro model) +#' and Water fluxes: Evaporation (Evap), Transpiration (TVeg), +#' surface runoff (Qs), subsurface runoff (Qsb), and rainfall (Rainf). +#' +#' For more details, see the [MsTMIP +#' variables](http://nacp.ornl.gov/MsTMIP_variables.shtml) +#' documentation. +#' +#' @param runid the ID distinguishing the model run. Can be omitted +#' if `ncfiles` is set. +#' @param outdir the directory that the model's output was sent to. +#' Can be omitted if `ncfiles` is set. +#' @param variables Character vector of variables to be read from +#' model output. Default = `"GPP"`. If `NULL`, try to read all +#' variables in output file.. +#' @param dataframe Logical: if TRUE, will return output in a +#' `data.frame` format with a posix column. Useful for +#' `PEcAn.benchmark::align.data` and plotting. +#' @param pft.name character string, name of the plant functional +#' type (PFT) to read PFT-specific output. If `NULL` no +#' PFT-specific output will be read even the variable has PFT as a +#' dimension. +#' @param ncfiles Custom character vector of full paths to NetCDF +#' files. If `NULL` (default), this list is constructed +#' automatically by looking for `YYYY.nc` files in +#' `file.path(outdir, runid)`. +#' @param verbose Logical. If `TRUE`, print status as every year and +#' variable is read, as well as all NetCDF diagnostics (from +#' `verbose` argument to, e.g., [ncdf4::nc_open()]) (default = +#' `FALSE`). +#' @param print_summary Logical. If `TRUE` (default), calculate and +#' print a summary of the means of each variable for each year. +#' @param start.year,end.year first and last year of output to read. +#' Specify as a date-time (only the year portion is used) or as a +#' four-digit number or string. If `NA`, reads all years found in +#' `outdir`. +#' @return If `dataframe = FALSE`, a vector of output variables. If +#' `dataframe = TRUE`, a `data.frame` of output variables with +#' POSIXct timestamps added (`posix` column). The `posix` column +#' is in seconds after January 1 of `start.year`, or 1970 if +#' `start.year` is not provided. +#' @export +#' @author Michael Dietze, David LeBauer, Alexey Shiklomanov read.output <- function(runid, outdir, start.year = NA, end.year = NA, diff --git a/base/utils/R/remove.config.R b/base/utils/R/remove.config.R index 2f40a353fa1..b9407fdb90d 100644 --- a/base/utils/R/remove.config.R +++ b/base/utils/R/remove.config.R @@ -1,12 +1,3 @@ -#------------------------------------------------------------------------------- -# Copyright (c) 2012 University of Illinois, NCSA. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the -# University of Illinois/NCSA Open Source License -# which accompanies this distribution, and is available at -# http://opensource.ncsa.illinois.edu/license.html -#------------------------------------------------------------------------------- - remove.config <- function(dir, settings, model) { fcn.name <- paste0("remove.config.", model) diff --git a/base/utils/R/status.R b/base/utils/R/status.R index 868be2d091f..41e340d0ebf 100644 --- a/base/utils/R/status.R +++ b/base/utils/R/status.R @@ -7,8 +7,7 @@ #' Records the progress of a PEcAn workflow by writing statuses and timestamps #' to a STATUS file. Use these each time a module starts, finishes, #' or is skipped. - -#' @details +#' #' All of these functions write to or read from a STATUS file in your run's #' output directory. If the file is not specified in the call, they will look #' for a `settings` object in the global environment and use diff --git a/base/utils/R/timezone_hour.R b/base/utils/R/timezone_hour.R index 0ea9a63b0af..b61c450d817 100644 --- a/base/utils/R/timezone_hour.R +++ b/base/utils/R/timezone_hour.R @@ -1,14 +1,14 @@ -##' @name timezone_hour -##' @title timezone_hour -##' @description return the number of hours offset to UTC for a timezone. -##' @author Rob Kooper -##' @param timezone to be converted -##' @return hours offset of the timezone -##' @examples -##' \dontrun{ -##' timezone_hour('America/New_York') -##' } -##' @export +#' Timezone Hour +#' +#' Returns the number of hours offset to UTC for a timezone. +#' @author Rob Kooper +#' @param timezone to be converted +#' @return hours offset of the timezone +#' @examples +#' \dontrun{ +#' timezone_hour('America/New_York') +#' } +#' @export timezone_hour <- function(timezone) { if (is.numeric(timezone)) { return(timezone) diff --git a/base/utils/R/to_nc.R b/base/utils/R/to_nc.R index 6b244be05c0..9ee1d38e047 100644 --- a/base/utils/R/to_nc.R +++ b/base/utils/R/to_nc.R @@ -1,12 +1,12 @@ -##' Make some values into an NCDF dimension variable -##' -##' Units and longnames are looked up from the \code{\link{standard_vars}} table -##' @export -##' -##' @param dimname character vector, standard dimension name (must be in PEcAn.utils::standard_vars) -##' @param vals values of dimension; can be single value or vector -##' @return ncdim defined according to standard_vars -##' @author Anne Thomas +#' Make some values into an NCDF dimension variable +#' +#' Units and longnames are looked up from the \code{\link{standard_vars}} table +#' @export +#' +#' @param dimname character vector, standard dimension name (must be in PEcAn.utils::standard_vars) +#' @param vals values of dimension; can be single value or vector +#' @return ncdim defined according to standard_vars +#' @author Anne Thomas to_ncdim <- function(dimname,vals){ dim <- PEcAn.utils::standard_vars[which(PEcAn.utils::standard_vars$Variable.Name == dimname),] #check dim exists @@ -30,14 +30,14 @@ to_ncdim <- function(dimname,vals){ } #to_ncdim -##' Define an NCDF variable -##' -##' @export -##' -##' @param varname character vector, standard variable name (must be in PEcAn.utils::standard_vars) -##' @param dims list of previously defined ncdims (function will match subset of dims for this variable in standard_vars; can include other dims--enables lapply.) -##' @return ncvar defined according to standard_vars -##' @author Anne Thomas +#' Define an NCDF variable +#' +#' @export +#' +#' @param varname character vector, standard variable name (must be in PEcAn.utils::standard_vars) +#' @param dims list of previously defined ncdims (function will match subset of dims for this variable in standard_vars; can include other dims--enables lapply.) +#' @return ncvar defined according to standard_vars +#' @author Anne Thomas to_ncvar <- function(varname,dims){ nc_var <- PEcAn.utils::standard_vars[which(PEcAn.utils::standard_vars$Variable.Name == varname),] #check nc_var exists diff --git a/base/utils/R/transformstats.R b/base/utils/R/transformstats.R index d128f0d785a..6c3bf7e4bc3 100644 --- a/base/utils/R/transformstats.R +++ b/base/utils/R/transformstats.R @@ -1,22 +1,22 @@ -##' Transform misc. statistics to SE -##' -##' Automates transformations of SD, MSE, LSD, 95%CI, HSD, and MSD -##' to conservative estimates of SE. -##' Method details and assumptions described in -##' LeBauer 2020 Transforming ANOVA and Regression statistics for Meta-analysis. -##' Authorea. DOI: https://doi.org/10.22541/au.158359749.96662550 -##' @param data data frame with columns for mean, statistic, n, -##' and statistic name -##' @return data frame with statistics transformed to SE -##' @author David LeBauer -##' @export -##' @examples -##' statdf <- data.frame(Y=rep(1,5), -##' stat=rep(1,5), -##' n=rep(4,5), -##' statname=c('SD', 'MSE', 'LSD', 'HSD', 'MSD')) -##' transformstats(statdf) +#' Transform misc. statistics to SE +#' +#' Automates transformations of SD, MSE, LSD, 95%CI, HSD, and MSD +#' to conservative estimates of SE. +#' Method details and assumptions described in +#' LeBauer 2020 Transforming ANOVA and Regression statistics for Meta-analysis. +#' Authorea. DOI: https://doi.org/10.22541/au.158359749.96662550 +#' @param data data frame with columns for mean, statistic, n, +#' and statistic name +#' @return data frame with statistics transformed to SE +#' @author David LeBauer +#' @export +#' @examples +#' statdf <- data.frame(Y=rep(1,5), +#' stat=rep(1,5), +#' n=rep(4,5), +#' statname=c('SD', 'MSE', 'LSD', 'HSD', 'MSD')) +#' transformstats(statdf) transformstats <- function(data) { if (is.factor(data$statname) && !"SE" %in% levels(data$statname)) { data$statname <- factor( diff --git a/base/utils/R/ud_convert.R b/base/utils/R/ud_convert.R index 242b3ece006..ee96bf60cd9 100644 --- a/base/utils/R/ud_convert.R +++ b/base/utils/R/ud_convert.R @@ -1,16 +1,16 @@ -##' Convert units -##' -##' Unit conversion to replace the now-unmaintained `udunits2::ud.convert` -##' @author Chris Black -##' -##' @param x vector of class "numeric" or "difftime" -##' @param u1 string parseable as the units in which `x` is provided. If `x` is -##' class "difftime", then `u1` is not actually used. However, it still needs -##' to be supplied and needs to be convertible to `u2` for consistency. -##' @param u2 string parseable as the units to convert to -##' -##' @return numeric vector with values converted to units in `u2` -##' @export +#' Convert units +#' +#' Unit conversion to replace the now-unmaintained `udunits2::ud.convert` +#' @author Chris Black +#' +#' @param x vector of class "numeric" or "difftime" +#' @param u1 string parseable as the units in which `x` is provided. If `x` is +#' class "difftime", then `u1` is not actually used. However, it still needs +#' to be supplied and needs to be convertible to `u2` for consistency. +#' @param u2 string parseable as the units to convert to +#' +#' @return numeric vector with values converted to units in `u2` +#' @export ud_convert <- function(x, u1, u2) { stopifnot(units::ud_are_convertible(u1, u2)) if(inherits(x, "difftime")) { diff --git a/base/utils/R/unit_is_parseable.R b/base/utils/R/unit_is_parseable.R index 17b3779537d..7ec67361258 100644 --- a/base/utils/R/unit_is_parseable.R +++ b/base/utils/R/unit_is_parseable.R @@ -1,17 +1,17 @@ -##' Check whether a string can be interpreted as a unit -##' -##' Function will replace the now-unmaintained `udunits2::ud.is.parseable` -##' @author Tanishq Jain -##' -##' @param unit A character string representing a type of units -##' -##' @return TRUE if the units is parseable, FALSE otherwise. -##' -##' @examples -##' unit_is_parseable("g/sec^2") -##' unit_is_parseable("kiglometters") -##' -##' @export +#' Check whether a string can be interpreted as a unit +#' +#' Function will replace the now-unmaintained `udunits2::ud.is.parseable` +#' @author Tanishq Jain +#' +#' @param unit A character string representing a type of units +#' +#' @return TRUE if the units is parseable, FALSE otherwise. +#' +#' @examples +#' unit_is_parseable("g/sec^2") +#' unit_is_parseable("kiglometters") +#' +#' @export unit_is_parseable <- function(unit){ tryCatch({ if(units::as_units(unit)) @@ -19,4 +19,4 @@ unit_is_parseable <- function(unit){ }, error = function(e) FALSE ) -} # unit_is_parseable \ No newline at end of file +} # unit_is_parseable diff --git a/base/utils/R/utils.R b/base/utils/R/utils.R index e7e0381f146..1bb2174ad35 100644 --- a/base/utils/R/utils.R +++ b/base/utils/R/utils.R @@ -1,32 +1,23 @@ -#------------------------------------------------------------------------------- -# Copyright (c) 2012 University of Illinois, NCSA. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the -# University of Illinois/NCSA Open Source License -# which accompanies this distribution, and is available at -# http://opensource.ncsa.illinois.edu/license.html -#------------------------------------------------------------------------------- - -#--------------------------------------------------------------------------------------------------# -# Small, miscellaneous functions for use throughout PECAn -#--------------------------------------------------------------------------------------------------# - -#--------------------------------------------------------------------------------------------------# -##' return MstMIP variable as ncvar -##' -##' returns a MstMIP variable as a ncvar based on name and other parameters -##' passed in. -##' -##' @title MstMIP variable -##' @export -##' @param name of variable -##' @param lat latitude if dimension requests it -##' @param lon longitude if dimension requests it -##' @param time time if dimension requests it -##' @param nsoil nsoil if dimension requests it -##' @param silent logical: suppress log messages about missing variables? -##' @return ncvar based on MstMIP definition -##' @author Rob Kooper + +#--------------------------------------------------------------------------------------------------# +# Small, miscellaneous functions for use throughout PEcAn +#--------------------------------------------------------------------------------------------------# + +#--------------------------------------------------------------------------------------------------# +#' return MstMIP variable as ncvar +#' +#' returns a MstMIP variable as a ncvar based on name and other parameters +#' passed in. +#' +#' @export +#' @param name of variable +#' @param lat latitude if dimension requests it +#' @param lon longitude if dimension requests it +#' @param time time if dimension requests it +#' @param nsoil nsoil if dimension requests it +#' @param silent logical: suppress log messages about missing variables? +#' @return ncvar based on MstMIP definition +#' @author Rob Kooper mstmipvar <- function(name, lat = NULL, lon = NULL, time = NULL, nsoil = NULL, silent = FALSE) { nc_var <- PEcAn.utils::standard_vars[PEcAn.utils::standard_vars$Variable.Name == name, ] @@ -72,29 +63,31 @@ mstmipvar <- function(name, lat = NULL, lon = NULL, time = NULL, nsoil = NULL, s #--------------------------------------------------------------------------------------------------# -##' left padded by zeros up to a given number of digits. -##' -##' returns a string representing a given number -##' @title Left Pad Zeros -##' @export -##' @param num number to be padded (integer) -##' @param digits number of digits to add -##' @return num with zeros to the left -##' @export -##' @author Carl Davidson +#' Left Pad Zeros +#' +#' left padded by zeros up to a given number of digits. +#' +#' returns a string representing a given number +#' @export +#' @param num number to be padded (integer) +#' @param digits number of digits to add +#' @return num with zeros to the left +#' @export +#' @author Carl Davidson left.pad.zeros <- function(num, digits = 5) { format_string <- paste0("%", sprintf("0%.0f.0f", digits)) return(sprintf(format_string, num)) } # left.pad.zeros -##' Truncates vector at 0 -##' @name zero.truncate -##' @title Zero Truncate -##' @param y numeric vector -##' @return numeric vector with all values less than 0 set to 0 -##' @export -##' @author unknown +#' Zero Truncate +#' +#' Truncates vector at 0 +#' +#' @param y numeric vector +#' @return numeric vector with all values less than 0 set to 0 +#' @export +#' @author unknown zero.truncate <- function(y) { y[y < 0 | is.na(y)] <- 0 return(y) @@ -102,18 +95,17 @@ zero.truncate <- function(y) { #--------------------------------------------------------------------------------------------------# -##' R implementation of rsync -##' -##' rsync is a file copying tool in bash -##' @title rsync -##' @param args rsync arguments (see man rsync) -##' @param from source -##' @param to destination -##' @param pattern file pattern to be matched -##' @return nothing, transfers files as a side effect -##' @export -##' @author David LeBauer -##' @author Shawn Serbin +#' R implementation of rsync +#' +#' rsync is a file copying tool in bash +#' @param args rsync arguments (see man rsync) +#' @param from source +#' @param to destination +#' @param pattern file pattern to be matched +#' @return nothing, transfers files as a side effect +#' @export +#' @author David LeBauer +#' @author Shawn Serbin rsync <- function(args, from, to, pattern = "") { PEcAn.logger::logger.warn("NEED TO USE TUNNEL") system(paste0("rsync", " ", args, " ", from, pattern, " ", to), intern = TRUE) @@ -121,13 +113,12 @@ rsync <- function(args, from, to, pattern = "") { #--------------------------------------------------------------------------------------------------# -##' R implementation of SSH -##' -##' @title SSH -##' @param host (character) machine to connect to -##' @param ... Commands to execute. Will be passed as a single quoted string -##' @param args futher arguments -##' @export +#' R implementation of SSH +#' +#' @param host (character) machine to connect to +#' @param ... Commands to execute. Will be passed as a single quoted string +#' @param args futher arguments +#' @export ssh <- function(host, ..., args = "") { PEcAn.logger::logger.warn("NEED TO USE TUNNEL") if (host == "localhost") { @@ -140,53 +131,50 @@ ssh <- function(host, ..., args = "") { #--------------------------------------------------------------------------------------------------# -##' Convert vector to comma delimited string -##' -##' vecpaste, turns vector into comma delimited string fit for SQL statements. -##' @title vecpaste -##' @param x vector -##' @return comma delimited string -##' @export +#' Convert vector to comma delimited string +#' +#' vecpaste, turns vector into comma delimited string fit for SQL statements. +#' @param x vector +#' @return comma delimited string +#' @export vecpaste <- function(x) paste(paste0("'", x, "'"), collapse = ",") #--------------------------------------------------------------------------------------------------# -##' returns an id representing a model run -##' -##' Provides a consistent method of naming runs; for use in model input files and indices -##' @title Get Run ID -##' @param run.type character, can be any character; currently 'SA' is used for sensitivity analysis, 'ENS' for ensemble run. -##' @param index unique index for different runs, e.g. integer counting members of an -##' ensemble or a quantile used to which a trait has been perturbed for sensitivity analysis -##' @param trait name of trait being sampled (for sensitivity analysis) -##' @param pft.name name of PFT (value from pfts.names field in database) -##' @param site.id optional site id .This is could be necessary for multisite write=false ensembles. -##' @return id representing a model run -##' @export -##' @examples -##' get.run.id('ENS', left.pad.zeros(1, 5)) -##' get.run.id('SA', round(qnorm(-3),3), trait = 'Vcmax') -##' @author Carl Davidson, David LeBauer +#' returns an id representing a model run +#' +#' Provides a consistent method of naming runs; for use in model input files and indices +#' @param run.type character, can be any character; currently 'SA' is used for sensitivity analysis, 'ENS' for ensemble run. +#' @param index unique index for different runs, e.g. integer counting members of an +#' ensemble or a quantile used to which a trait has been perturbed for sensitivity analysis +#' @param trait name of trait being sampled (for sensitivity analysis) +#' @param pft.name name of PFT (value from pfts.names field in database) +#' @param site.id optional site id .This is could be necessary for multisite write=false ensembles. +#' @return id representing a model run +#' @export +#' @examples +#' get.run.id('ENS', left.pad.zeros(1, 5)) +#' get.run.id('SA', round(qnorm(-3),3), trait = 'Vcmax') +#' @author Carl Davidson, David LeBauer get.run.id <- function(run.type, index, trait = NULL, pft.name = NULL, site.id=NULL) { result <- paste(c(run.type, pft.name, trait, index, site.id), collapse = "-") return(result) } # get.run.id #--------------------------------------------------------------------------------------------------# -##' Zero bounded density using log density transform -##' -##' Provides a zero bounded density estimate of a parameter. -##' Kernel Density Estimation used by the \code{\link[stats]{density}} function will cause problems -##' at the left hand end because it will put some weight on negative values. -##' One useful approach is to transform to logs, estimate the density using KDE, and then transform back. -##' @title Zero Bounded Density -##' @param x data, as a numeric vector -##' @param bw The smoothing bandwidth to be used. See 'bw.nrd' -##' @param n number of points to use in kernel density estimate. See \code{\link[stats]{density}} -##' @return data frame with back-transformed log density estimate -##' @author \href{https://stats.stackexchange.com/q/6588/2750}{Rob Hyndman} -##' @references M. P. Wand, J. S. Marron and D. Ruppert, 1991. Transformations in Density Estimation. Journal of the American Statistical Association. 86(414):343-353 \url{http://www.jstor.org/stable/2290569} -##' @export +#' Zero bounded density using log density transform +#' +#' Provides a zero bounded density estimate of a parameter. +#' Kernel Density Estimation used by the \code{\link[stats]{density}} function will cause problems +#' at the left hand end because it will put some weight on negative values. +#' One useful approach is to transform to logs, estimate the density using KDE, and then transform back. +#' @param x data, as a numeric vector +#' @param bw The smoothing bandwidth to be used. See 'bw.nrd' +#' @param n number of points to use in kernel density estimate. See \code{\link[stats]{density}} +#' @return data frame with back-transformed log density estimate +#' @author \href{https://stats.stackexchange.com/q/6588/2750}{Rob Hyndman} +#' @references M. P. Wand, J. S. Marron and D. Ruppert, 1991. Transformations in Density Estimation. Journal of the American Statistical Association. 86(414):343-353 \url{http://www.jstor.org/stable/2290569} +#' @export zero.bounded.density <- function(x, bw = "SJ", n = 1001) { y <- log(x) g <- stats::density(y, bw = bw, n = n) @@ -198,16 +186,14 @@ zero.bounded.density <- function(x, bw = "SJ", n = 1001) { #--------------------------------------------------------------------------------------------------# -##' Summarize results of replicate observations in trait data query -##' -##' @title Summarize Results -##' @param result dataframe with results of trait data query -##' @return result with replicate observations summarized -##' @export summarize.result -##' @usage summarize.result(result) -##' @importFrom rlang .data -##' @importFrom magrittr %>% -##' @author David LeBauer, Alexey Shiklomanov +#' Summarize results of replicate observations in trait data query +#' +#' @param result dataframe with results of trait data query +#' @return result with replicate observations summarized +#' @export summarize.result +#' @importFrom rlang .data +#' @importFrom magrittr %>% +#' @author David LeBauer, Alexey Shiklomanov summarize.result <- function(result) { ans1 <- result %>% dplyr::filter(.data$n == 1) %>% @@ -234,13 +220,12 @@ summarize.result <- function(result) { #--------------------------------------------------------------------------------------------------# -##' Further summarizes output from summary.mcmc -##' -##' @title Get stats for parameters in MCMC output -##' @param mcmc.summary probably produced by \code{\link[coda]{summary.mcmc}} -##' @param sample.size passed as 'n' in returned list -##' @return list with summary statistics for parameters in an MCMC chain -##' @author David LeBauer +#' Further summarizes output from summary.mcmc +#' +#' @param mcmc.summary probably produced by \code{\link[coda]{summary.mcmc}} +#' @param sample.size passed as 'n' in returned list +#' @return list with summary statistics for parameters in an MCMC chain +#' @author David LeBauer get.stats.mcmc <- function(mcmc.summary, sample.size) { a <- list(n = sample.size) for (parm in c("beta.o", "sd.y", "sd.site", "sd.trt", "beta.ghs[2]")) { @@ -256,20 +241,21 @@ get.stats.mcmc <- function(mcmc.summary, sample.size) { #--------------------------------------------------------------------------------------------------# -##' A helper function for building a LaTex table. -##' -##' Used by \code{\link{get.parameter.stat}}. -##' @title Paste Stats -##' @name paste.stats -##' @param median 50-percent quantile -##' @param lcl lower confidence limit -##' @param ucl upper confidence limit -##' @param n significant digits for printing. Passed to \code{\link{tabnum}} -##' @export -##' @author David LeBauer -##' @examples -##' paste.stats(3.333333, 5.00001, 6.22222, n = 3) -##' # [1] "$3.33(5,6.22)$" +#' Paste Stats +#' +#' A helper function for building a LaTex table. +#' +#' Used by \code{\link{get.parameter.stat}}. +#' @name paste.stats +#' @param median 50-percent quantile +#' @param lcl lower confidence limit +#' @param ucl upper confidence limit +#' @param n significant digits for printing. Passed to \code{\link{tabnum}} +#' @export +#' @author David LeBauer +#' @examples +#' paste.stats(3.333333, 5.00001, 6.22222, n = 3) +#' # [1] "$3.33(5,6.22)$" paste.stats <- function(median, lcl, ucl, n = 2) { paste0("$", tabnum(median, n), "(", tabnum(lcl, n), ",", tabnum(ucl, n), ")", @@ -278,16 +264,17 @@ paste.stats <- function(median, lcl, ucl, n = 2) { #--------------------------------------------------------------------------------------------------# -##' Gets statistics for LaTeX - formatted table -##' -##' @title Get Parameter Statistics -##' @param mcmc.summary probably produced by \code{\link[coda]{summary.mcmc}} -##' @param parameter name of parameter to extract, as character -##' @return table with parameter statistics -##' @author David LeBauer -##' @export -##' @examples -##' \dontrun{get.parameter.stat(mcmc.summaries[[1]], 'beta.o')} +#' Get Parameter Statistics +#' +#' Gets statistics for LaTeX - formatted table +#' +#' @param mcmc.summary probably produced by \code{\link[coda]{summary.mcmc}} +#' @param parameter name of parameter to extract, as character +#' @return table with parameter statistics +#' @author David LeBauer +#' @export +#' @examples +#' \dontrun{get.parameter.stat(mcmc.summaries[[1]], 'beta.o')} get.parameter.stat <- function(mcmc.summary, parameter) { paste.stats(median = mcmc.summary$quantiles[parameter, "50%"], lcl = mcmc.summary$quantiles[parameter, c("2.5%")], @@ -298,14 +285,15 @@ get.parameter.stat <- function(mcmc.summary, parameter) { #--------------------------------------------------------------------------------------------------# -##' Calculate mean, variance statistics, and CI from a known distribution -##' -##' @title Probability Distirbution Function Statistics -##' @param distn name of distribution used by R (beta, f, gamma, lnorm, norm, weibull) -##' @param A first parameter -##' @param B second parameter -##' @return list with mean, variance, and 95 CI -##' @author David LeBauer +#' Probability Distribution Function Statistics +#' +#' Calculate mean, variance statistics, and CI from a known distribution +#' +#' @param distn name of distribution used by R (beta, f, gamma, lnorm, norm, weibull) +#' @param A first parameter +#' @param B second parameter +#' @return list with mean, variance, and 95 CI +#' @author David LeBauer ## in future, perhaps create S3 functions: get.stats.pdf <- pdf.stats pdf.stats <- function(distn, A, B) { distn <- as.character(distn) @@ -339,23 +327,23 @@ pdf.stats <- function(distn, A, B) { #--------------------------------------------------------------------------------------------------# -##' Dictionary of terms used to identify traits in ed, filenames, and figures -##' -##' @return a dataframe with id, the name used by ED and PEcAn database for a parameter; fileid, an abbreviated -##' name used for files; figid, the parameter name written out as best known in english for figures -##' and tables. -##' -##' @param traits a vector of trait names, if traits = NULL, all of the traits will be returned. -##' @export -##' @examples -##' # convert parameter name to a string appropriate for end-use plotting -##' \dontrun{ -##' trait.lookup('growth_resp_factor') -##' trait.lookup('growth_resp_factor')$figid -##' -##' # get a list of all traits and units in dictionary -##' trait.lookup()[,c('figid', 'units')] -##' } +#' Dictionary of terms used to identify traits in ed, filenames, and figures +#' +#' @return a dataframe with id, the name used by ED and PEcAn database for a parameter; fileid, an abbreviated +#' name used for files; figid, the parameter name written out as best known in english for figures +#' and tables. +#' +#' @param traits a vector of trait names, if traits = NULL, all of the traits will be returned. +#' @export +#' @examples +#' # convert parameter name to a string appropriate for end-use plotting +#' \dontrun{ +#' trait.lookup('growth_resp_factor') +#' trait.lookup('growth_resp_factor')$figid +#' +#' # get a list of all traits and units in dictionary +#' trait.lookup()[,c('figid', 'units')] +#' } trait.lookup <- function(traits = NULL) { if (is.null(traits)) { return(PEcAn.utils::trait.dictionary) @@ -365,17 +353,18 @@ trait.lookup <- function(traits = NULL) { #--------------------------------------------------------------------------------------------------# -##' Convert number to n significant digits -##' -##' @title Table numbers -##' @param x numeric value or vector -##' @param n number of significant figures -##' @export -##' @author David LeBauer -##' @return x rounded to n significant figures -##' @examples -##' tabnum(1.2345) -##' tabnum(1.2345, n = 4) +#' Table numbers +#' +#' Convert number to n significant digits +#' +#' @param x numeric value or vector +#' @param n number of significant figures +#' @export +#' @author David LeBauer +#' @return x rounded to n significant figures +#' @examples +#' tabnum(1.2345) +#' tabnum(1.2345, n = 4) tabnum <- function(x, n = 3) { ans <- as.numeric(signif(x, n)) names(ans) <- names(x) @@ -385,15 +374,16 @@ tabnum <- function(x, n = 3) { #--------------------------------------------------------------------------------------------------# -##' Scale temperature dependent trait from measurement temperature to reference temperature -##' -##' @title Arrhenius scaling -##' @param observed.value observed value of temperature dependent trait, e.g. Vcmax, root respiration rate -##' @param old.temp temperature at which measurement was taken or previously scaled to -##' @param new.temp temperature to be scaled to, default = 25 C -##' @return numeric value at reference temperature -##' @export -##' @author unknown +#' Arrhenius scaling +#' +#' Scale temperature dependent trait from measurement temperature to reference temperature +#' +#' @param observed.value observed value of temperature dependent trait, e.g. Vcmax, root respiration rate +#' @param old.temp temperature at which measurement was taken or previously scaled to +#' @param new.temp temperature to be scaled to, default = 25 C +#' @return numeric value at reference temperature +#' @export +#' @author unknown arrhenius.scaling <- function(observed.value, old.temp, new.temp = 25) { new.temp.K <- ud_convert(new.temp, "degC", "K") old.temp.K <- ud_convert(old.temp, "degC", "K") @@ -403,32 +393,28 @@ arrhenius.scaling <- function(observed.value, old.temp, new.temp = 25) { #--------------------------------------------------------------------------------------------------# -##' Capitalize a string -##' -##' @title Capitalize a string -##' @param x string -##' @return x, capitalized -##' @author David LeBauer +#' Capitalize a string +#' +#' @param x string +#' @return x, capitalized +#' @author David LeBauer capitalize <- function(x) { x <- as.character(x) s <- strsplit(x, " ")[[1]] return(paste(toupper(substring(s, 1, 1)), substring(s, 2), sep = "", collapse = " ")) } # capitalize -# isFALSE <- function(x) !isTRUE(x) -#--------------------------------------------------------------------------------------------------# - #--------------------------------------------------------------------------------------------------# -##' New xtable -##' -##' utility to properly escape the '%' sign for latex -##' @title newxtable -##' @param x data.frame to be converted to latex table -##' @param environment can be 'table'; 'sidewaystable' if using latex rotating package -##' @param table.placement,label,caption,caption.placement,align passed to \code{\link[xtable]{xtable}} -##' @return Latex version of table, with percentages properly formatted -##' @author David LeBauer +#' New xtable +#' +#' utility to properly escape the '%' sign for latex +#' +#' @param x data.frame to be converted to latex table +#' @param environment can be 'table'; 'sidewaystable' if using latex rotating package +#' @param table.placement,label,caption,caption.placement,align passed to \code{\link[xtable]{xtable}} +#' @return Latex version of table, with percentages properly formatted +#' @author David LeBauer newxtable <- function(x, environment = "table", table.placement = "ht", label = NULL, caption = NULL, caption.placement = NULL, align = NULL) { need_packages("xtable") @@ -443,15 +429,15 @@ newxtable <- function(x, environment = "table", table.placement = "ht", label = #--------------------------------------------------------------------------------------------------# -##' Convert author, year, title to bibtex citation format -##' -##' Converts author year title to author1999abc format -##' @title bibtexify -##' @param author name of first author -##' @param year year of publication -##' @param title manuscript title -##' @return bibtex citation -##' @author unknown +#' bibtexify +#' +#' Converts author year title to bibtex `author1999abc` format +#' +#' @param author name of first author +#' @param year year of publication +#' @param title manuscript title +#' @return bibtex citation +#' @author unknown bibtexify <- function(author, year, title) { acronym <- abbreviate(title, minlength = 3, strict = TRUE) return(paste0(author, year, acronym)) @@ -460,16 +446,16 @@ bibtexify <- function(author, year, title) { #--------------------------------------------------------------------------------------------------# -##' Convert categorical variable into sequential integers -##' -##' Turns any categorical variable into a sequential integer. -##' This transformation is required for using data in BUGS/JAGS -##' @title as.sequence -##' @param x categorical variable as vector -##' @param na.rm logical: return NA's or replace with max(x) + 1 -##' @return sequence from 1:length(unique(x)) -##' @export -##' @author David LeBauer +#' Convert categorical variable into sequential integers +#' +#' Turns any categorical variable into a sequential integer. +#' This transformation is required for using data in BUGS/JAGS +#' +#' @param x categorical variable as vector +#' @param na.rm logical: return NA's or replace with max(x) + 1 +#' @return sequence from 1:length(unique(x)) +#' @export +#' @author David LeBauer as.sequence <- function(x, na.rm = TRUE) { x2 <- as.integer(factor(x, unique(x))) if (all(is.na(x2))) { @@ -484,16 +470,16 @@ as.sequence <- function(x, na.rm = TRUE) { #--------------------------------------------------------------------------------------------------# -##' Create a temporary settings file -##' -##' Uses \code{\link{tempfile}} function to provide a valid temporary file (OS independent) -##' Useful for testing functions that depend on settings file -##' Reference: http://stackoverflow.com/a/12940705/199217 -##' @title temp.settings -##' @param settings.txt character vector to be written -##' @return character vector written to and read from a temporary file -##' @export -##' @author David LeBauer +#' Create a temporary settings file +#' +#' Uses \code{\link{tempfile}} function to provide a valid temporary file (OS independent) +#' Useful for testing functions that depend on settings file +#' Reference: http://stackoverflow.com/a/12940705/199217 +#' +#' @param settings.txt character vector to be written +#' @return character vector written to and read from a temporary file +#' @export +#' @author David LeBauer temp.settings <- function(settings.txt) { temp <- tempfile() on.exit(unlink(temp), add = TRUE) @@ -505,19 +491,19 @@ temp.settings <- function(settings.txt) { #--------------------------------------------------------------------------------------------------# -##' Test if function gives an error -##' -##' adaptation of try that returns a logical value (FALSE if error) -##' @title tryl -##' @param FUN function to be evaluated for error -##' @return FALSE if function returns error; else TRUE -##' @export -##' @examples -##' tryl(1+1) -##' # TRUE -##' tryl(sum('a')) -##' # FALSE -##' @author David LeBauer +#' Test if function gives an error +#' +#' adaptation of try that returns a logical value (FALSE if error) +#' +#' @param FUN function to be evaluated for error +#' @return FALSE if function returns error; else TRUE +#' @export +#' @examples +#' tryl(1+1) +#' # TRUE +#' tryl(sum('a')) +#' # FALSE +#' @author David LeBauer tryl <- function(FUN) { out <- tryCatch(FUN, error = function(e) e) ans <- !inherits(out, "error") @@ -527,14 +513,14 @@ tryl <- function(FUN) { #--------------------------------------------------------------------------------------------------# -##' load model package -##' @title Load model package -##' @param model name of model -##' @return FALSE if function returns error; else TRUE -##' @export -##' @examples -##' \dontrun{require.modelpkg(BioCro)} -##' @author David LeBauer +#' Load model package +#' +#' @param model name of model +#' @return FALSE if function returns error; else TRUE +#' @export +#' @examples +#' \dontrun{require.modelpkg(BioCro)} +#' @author David LeBauer load.modelpkg <- function(model) { pecan.modelpkg <- paste0("PEcAn.", model) if (!pecan.modelpkg %in% names(utils::sessionInfo()$otherPkgs)) { @@ -550,14 +536,14 @@ load.modelpkg <- function(model) { #--------------------------------------------------------------------------------------------------# -##' conversion function for the unit conversions that udunits cannot handle but often needed in PEcAn calculations -##' @title misc.convert -##' @export -##' @param x convertible values -##' @param u1 unit to be converted from, character -##' @param u2 unit to be converted to, character -##' @return val converted values -##' @author Istem Fer, Shawn Serbin +#' conversion function for the unit conversions that udunits cannot handle but often needed in PEcAn calculations +#' +#' @export +#' @param x convertible values +#' @param u1 unit to be converted from, character +#' @param u2 unit to be converted to, character +#' @return val converted values +#' @author Istem Fer, Shawn Serbin misc.convert <- function(x, u1, u2) { amC <- 12.0107 # atomic mass of carbon @@ -589,13 +575,13 @@ misc.convert <- function(x, u1, u2) { #--------------------------------------------------------------------------------------------------# -##' function to check whether units are convertible by misc.convert function -##' @title misc.are.convertible -##' @export -##' @param u1 unit to be converted from, character -##' @param u2 unit to be converted to, character -##' @return logical -##' @author Istem Fer, Shawn Serbin +#' function to check whether units are convertible by misc.convert function +#' +#' @export +#' @param u1 unit to be converted from, character +#' @param u2 unit to be converted to, character +#' @return logical +#' @author Istem Fer, Shawn Serbin misc.are.convertible <- function(u1, u2) { # make sure the order of vectors match @@ -620,12 +606,12 @@ misc.are.convertible <- function(u1, u2) { #--------------------------------------------------------------------------------------------------# -##' Convert expression to variable names -##' @title convert.expr -##' @param expression expression string -##' @return list -##' @export -##' @author Istem Fer +#' Convert expression to variable names +#' +#' @param expression expression string +#' @return list +#' @export +#' @author Istem Fer convert.expr <- function(expression) { # split equation to LHS and RHS deri.var <- gsub("=.*$", "", expression) # name of the derived variable @@ -647,27 +633,28 @@ convert.expr <- function(expression) { #--------------------------------------------------------------------------------------------------# -##' Simple function to use ncftpget for FTP downloads behind a firewall. -##' Requires ncftpget and a properly formatted config file in the users -##' home directory -##' @title download_file -##' @param url complete URL for file download -##' @param filename destination file name -##' @param method Method of file retrieval. Can set this using the `options(download.ftp.method=[method])` in your Rprofile. -##' example options(download.ftp.method="ncftpget") -##' -##' @examples -##' \dontrun{ -##' download_file("http://lib.stat.cmu.edu/datasets/csb/ch11b.txt","~/test.download.txt") -##' -##' download_file(" -##' ftp://ftp.cdc.noaa.gov/Datasets/NARR/monolevel/pres.sfc.2000.nc", -##' "~/pres.sfc.2000.nc") -##' } -##' -##' @export -##' -##' @author Shawn Serbin, Rob Kooper +#' Simple function to use ncftpget for FTP downloads behind a firewall. +#' +#' Requires ncftpget and a properly formatted config file in the users +#' home directory +#' +#' @param url complete URL for file download +#' @param filename destination file name +#' @param method Method of file retrieval. Can set this using the `options(download.ftp.method=[method])` in your Rprofile. +#' example options(download.ftp.method="ncftpget") +#' +#' @examples +#' \dontrun{ +#' download_file("http://lib.stat.cmu.edu/datasets/csb/ch11b.txt","~/test.download.txt") +#' +#' download_file(" +#' ftp://ftp.cdc.noaa.gov/Datasets/NARR/monolevel/pres.sfc.2000.nc", +#' "~/pres.sfc.2000.nc") +#' } +#' +#' @export +#' +#' @author Shawn Serbin, Rob Kooper download_file <- function(url, filename, method) { if (startsWith(url, "ftp://")) { if (missing(method)) method <- getOption("download.ftp.method", default = "auto") @@ -686,34 +673,30 @@ download_file <- function(url, filename, method) { #--------------------------------------------------------------------------------------------------# -##' Retry function X times before stopping in error -##' -##' @title retry.func -##' @name retry.func -##' @description Retry function X times before stopping in error -##' -##' @param expr The function to try running -##' @param maxErrors The number of times to retry the function -##' @param sleep How long to wait before retrying the function call -##' @param isError function to use for checking whether to try again. -##' Must take one argument that contains the result of evaluating `expr` -##' and return TRUE if another retry is needed -##' -##' @return retval returns the results of the function call -##' -##' @examples -##' \dontrun{ -##' file_url <- paste0("https://thredds.daac.ornl.gov/", -##' "thredds/dodsC/ornldaac/1220", -##' "/mstmip_driver_global_hd_climate_lwdown_1999_v1.nc4") -##' dap <- retry.func( -##' ncdf4::nc_open(file_url), -##' maxErrors=10, -##' sleep=2) -##' } -##' -##' @export -##' @author Shawn Serbin +#' Retry function X times before stopping in error +#' +#' @param expr The function to try running +#' @param maxErrors The number of times to retry the function +#' @param sleep How long to wait before retrying the function call +#' @param isError function to use for checking whether to try again. +#' Must take one argument that contains the result of evaluating `expr` +#' and return TRUE if another retry is needed +#' +#' @return retval returns the results of the function call +#' +#' @examples +#' \dontrun{ +#' file_url <- paste0("https://thredds.daac.ornl.gov/", +#' "thredds/dodsC/ornldaac/1220", +#' "/mstmip_driver_global_hd_climate_lwdown_1999_v1.nc4") +#' dap <- retry.func( +#' ncdf4::nc_open(file_url), +#' maxErrors=10, +#' sleep=2) +#' } +#' +#' @export +#' @author Shawn Serbin retry.func <- function(expr, isError = function(x) inherits(x, "try-error"), maxErrors = 5, sleep = 0) { attempts = 0 retval = try(eval(expr)) @@ -738,25 +721,25 @@ retry.func <- function(expr, isError = function(x) inherits(x, "try-error"), max #--------------------------------------------------------------------------------------------------# -##' Adverb to try calling a function `n` times before giving up -##' -##' @param .f Function to call. -##' @param n Number of attempts to try -##' @param timeout Timeout between attempts, in seconds -##' @param silent Silence error messages? -##' @return Modified version of input function -##' @examples -##' rlog <- robustly(log, timeout = 0.3) -##' try(rlog("fail")) -##' \dontrun{ -##' nc_openr <- robustly(ncdf4::nc_open, n = 10, timeout = 0.5) -##' nc <- nc_openr(url) -##' # ...or just call the function directly -##' nc <- robustly(ncdf4::nc_open, n = 20)(url) -##' # Useful in `purrr` maps -##' many_vars <- purrr::map(varnames, robustly(ncdf4::ncvar_get), nc = nc) -##' } -##' @export +#' Adverb to try calling a function `n` times before giving up +#' +#' @param .f Function to call. +#' @param n Number of attempts to try +#' @param timeout Timeout between attempts, in seconds +#' @param silent Silence error messages? +#' @return Modified version of input function +#' @examples +#' rlog <- robustly(log, timeout = 0.3) +#' try(rlog("fail")) +#' \dontrun{ +#' nc_openr <- robustly(ncdf4::nc_open, n = 10, timeout = 0.5) +#' nc <- nc_openr(url) +#' # ...or just call the function directly +#' nc <- robustly(ncdf4::nc_open, n = 20)(url) +#' # Useful in `purrr` maps +#' many_vars <- purrr::map(varnames, robustly(ncdf4::ncvar_get), nc = nc) +#' } +#' @export robustly <- function(.f, n = 10, timeout = 0.2, silent = TRUE) { .f <- purrr::as_mapper(.f) function(...) { @@ -771,8 +754,3 @@ robustly <- function(.f, n = 10, timeout = 0.2, silent = TRUE) { } } #--------------------------------------------------------------------------------------------------# - - -#################################################################################################### -### EOF. End of R script file. -#################################################################################################### diff --git a/base/utils/R/version.R b/base/utils/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/base/utils/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/base/utils/R/write.config.utils.R b/base/utils/R/write.config.utils.R index f4a481bd53a..06c2bb4a379 100644 --- a/base/utils/R/write.config.utils.R +++ b/base/utils/R/write.config.utils.R @@ -1,24 +1,16 @@ -#------------------------------------------------------------------------------- -# Copyright (c) 2012 University of Illinois, NCSA. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the -# University of Illinois/NCSA Open Source License -# which accompanies this distribution, and is available at -# http://opensource.ncsa.illinois.edu/license.html -#------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------# ### TODO: Generalize this code for all ecosystem models (e.g. ED2.2, SiPNET, etc). #--------------------------------------------------------------------------------------------------# -##' Get Quantiles -##' -##' Returns a vector of quantiles specified by a given `` xml tag -##' -##' @param quantiles.tag specifies tag used to specify quantiles -##' @return vector of quantiles -##' @export -##' @author David LeBauer +#' Get Quantiles +#' +#' Returns a vector of quantiles specified by a given `` xml tag +#' +#' @param quantiles.tag specifies tag used to specify quantiles +#' @return vector of quantiles +#' @export +#' @author David LeBauer get.quantiles <- function(quantiles.tag) { quantiles <- vector() if (!is.null(quantiles.tag$quantile)) { @@ -38,14 +30,14 @@ get.quantiles <- function(quantiles.tag) { } # get.quantiles -##' get sensitivity samples as a list -##' -##' @param pft list of samples from Plant Functional Types -##' @param env list of samples from environment parameters -##' @param quantiles quantiles at which to obtain samples from parameter for -##' sensitivity analysis -##' @export -##' @return sa.sample.list +#' get sensitivity samples as a list +#' +#' @param pft list of samples from Plant Functional Types +#' @param env list of samples from environment parameters +#' @param quantiles quantiles at which to obtain samples from parameter for +#' sensitivity analysis +#' @export +#' @return sa.sample.list get.sa.sample.list <- function(pft, env, quantiles) { sa.sample.list <- list() for (i in seq_along(pft)) { @@ -57,23 +49,23 @@ get.sa.sample.list <- function(pft, env, quantiles) { } # get.sa.sample.list -##' Get sensitivity analysis samples -##' -##' Samples parameters for a model run at specified quantiles. -##' -##' Samples from long (>2000) vectors that represent random samples from a -##' trait distribution. -##' Samples are either the MCMC chains output from the Bayesian meta-analysis -##' or are randomly sampled from the closed-form distribution of the -##' parameter probability distribution function. -##' The list is indexed first by trait, then by quantile. -##' -##' @param samples random samples from trait distribution -##' @param quantiles list of quantiles to at which to sample, -##' set in settings file -##' @return a list of lists representing quantile values of trait distributions -##' @export -##' @author David LeBauer +#' Get sensitivity analysis samples +#' +#' Samples parameters for a model run at specified quantiles. +#' +#' Samples from long (>2000) vectors that represent random samples from a +#' trait distribution. +#' Samples are either the MCMC chains output from the Bayesian meta-analysis +#' or are randomly sampled from the closed-form distribution of the +#' parameter probability distribution function. +#' The list is indexed first by trait, then by quantile. +#' +#' @param samples random samples from trait distribution +#' @param quantiles list of quantiles to at which to sample, +#' set in settings file +#' @return a list of lists representing quantile values of trait distributions +#' @export +#' @author David LeBauer get.sa.samples <- function(samples, quantiles) { sa.samples <- data.frame() for (trait in names(samples)) { @@ -86,12 +78,12 @@ get.sa.samples <- function(samples, quantiles) { } # get.sa.samples -##' checks that met2model function exists -##' -##' Checks if `met2model.` exists for a particular model -##' -##' @param model model package name -##' @return logical +#' checks that met2model function exists +#' +#' Checks if `met2model.` exists for a particular model +#' +#' @param model model package name +#' @return logical met2model.exists <- function(model) { load.modelpkg(model) return(exists(paste0("met2model.", model))) diff --git a/base/utils/inst/clear.scratch.sh b/base/utils/inst/clear.scratch.sh index cbc75f2b292..815566596d6 100755 --- a/base/utils/inst/clear.scratch.sh +++ b/base/utils/inst/clear.scratch.sh @@ -1,13 +1,5 @@ #!/bin/bash -#------------------------------------------------------------------------------- -# Copyright (c) 2012 University of Illinois, NCSA. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the -# University of Illinois/NCSA Open Source License -# which accompanies this distribution, and is available at -# http://opensource.ncsa.illinois.edu/license.html -#------------------------------------------------------------------------------- -# + #--------------------------------------------------------------------------------------------------# LOC=/scratch/$USER if [ -d "$LOC" ]; then diff --git a/base/utils/man/PEcAn.Rd b/base/utils/man/PEcAn.Rd index 7b02f3cc42b..4a6752d93c7 100644 --- a/base/utils/man/PEcAn.Rd +++ b/base/utils/man/PEcAn.Rd @@ -10,29 +10,45 @@ \alias{package-pecan} \title{R package to support PEcAn, the Predictive Ecosystem Analyzer} \description{ -Instructions for the use of this package are provided in the project documentation \url{https://pecanproject.github.io/documentation.html}. +Instructions for the use of this package are provided in the project +documentation \url{https://pecanproject.github.io/documentation.html}. } \details{ Project homepage: \url{pecanproject.org} Description of PEcAn -The Predictive Ecosystem Analyzer (PEcAn) is a scientific workflow management tool that is designed to simplify the management of model parameterization, execution, and analysis. The goal of PEcAn is to streamline the interaction between data and models, and to improve the efficacy of scientific investigation. PEcAn is an open source utility that encapsulates: +The Predictive Ecosystem Analyzer (PEcAn) is a scientific workflow management +tool that is designed to simplify the management of model parameterization, +execution, and analysis. The goal of PEcAn is to streamline the interaction +between data and models, and to improve the efficacy of scientific +investigation. PEcAn is an open source utility that encapsulates: \enumerate{ \item acquisition of meteorological inputs -\item synthesis of physiological trait data as the posterior distribution of a Bayesian meta-analysis -\item sampling trait meta-analysis posterior distributions to parameterize ensembles of ED2 and other ecophysiological models +\item synthesis of physiological trait data as the posterior distribution of a +Bayesian meta-analysis +\item sampling trait meta-analysis posterior distributions to parameterize +ensembles of ED2 and other ecophysiological models \item probabilistic forecasts -\item postprocessing to constrain forecasts and model parameters with field, meterological, eddy flux, and spectral data, and +\item postprocessing to constrain forecasts and model parameters with field, +meterological, eddy flux, and spectral data, and \item provenance tracking } -PECAn integrates available data into ecological forecasts by running ensembles of a terrestrial ecosystem model that is parameterized by the posterior distribution from a meta-analysis of available plant trait data. -These trait data are assembled from field research and primary literature, and are stored in a PostgreSQL database. Current development focused on biofuel crops uses BETYdb. -In addition to generating forecasts that reflect available data, PEcAn quantifies the contribution of each parameter to model uncertainty. -This information informs targeted data collection and synthesis efforts that most efficiently reduce forecast uncertainty. +PECAn integrates available data into ecological forecasts by running +ensembles of a terrestrial ecosystem model that is parameterized by the +posterior distribution from a meta-analysis of available plant trait data. +These trait data are assembled from field research and primary literature, +and are stored in a PostgreSQL database. Current development focused on +biofuel crops uses BETYdb. In addition to generating forecasts that reflect +available data, PEcAn quantifies the contribution of each parameter to model +uncertainty. This information informs targeted data collection and synthesis +efforts that most efficiently reduce forecast uncertainty. -Current development is focused on developing PEcAn into a real-time data assimilation and forecasting system. This system will provide a detailed analysis of the past and present ecosystem functioning that seamlessly transitions into forecasts. +Current development is focused on developing PEcAn into a real-time data +assimilation and forecasting system. This system will provide a detailed +analysis of the past and present ecosystem functioning that seamlessly +transitions into forecasts. } \author{ \strong{Maintainer}: Rob Kooper \email{kooper@illinois.edu} diff --git a/base/utils/man/as.sequence.Rd b/base/utils/man/as.sequence.Rd index 43327f14e38..d08c43347fa 100644 --- a/base/utils/man/as.sequence.Rd +++ b/base/utils/man/as.sequence.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/utils.R \name{as.sequence} \alias{as.sequence} -\title{as.sequence} +\title{Convert categorical variable into sequential integers} \usage{ as.sequence(x, na.rm = TRUE) } @@ -15,9 +15,6 @@ as.sequence(x, na.rm = TRUE) sequence from 1:length(unique(x)) } \description{ -Convert categorical variable into sequential integers -} -\details{ Turns any categorical variable into a sequential integer. This transformation is required for using data in BUGS/JAGS } diff --git a/base/utils/man/bibtexify.Rd b/base/utils/man/bibtexify.Rd index db981ef1ecc..71c2b0ce360 100644 --- a/base/utils/man/bibtexify.Rd +++ b/base/utils/man/bibtexify.Rd @@ -17,10 +17,7 @@ bibtexify(author, year, title) bibtex citation } \description{ -Convert author, year, title to bibtex citation format -} -\details{ -Converts author year title to author1999abc format +Converts author year title to bibtex \code{author1999abc} format } \author{ unknown diff --git a/base/utils/man/bugs.rdist.Rd b/base/utils/man/bugs.rdist.Rd index 6443e81cc52..13518777c45 100644 --- a/base/utils/man/bugs.rdist.Rd +++ b/base/utils/man/bugs.rdist.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/r2bugs.distributions.R \name{bugs.rdist} \alias{bugs.rdist} -\title{bugs.rdist} +\title{Sample from an R distribution using JAGS} \usage{ bugs.rdist( prior = data.frame(distn = "norm", parama = 0, paramb = 1), @@ -21,9 +21,6 @@ bugs.rdist( vector of samples } \description{ -Sample from an R distribution using JAGS -} -\details{ Takes a distribution with R parameterization, converts it to a BUGS parameterization, and then samples from the distribution using JAGS diff --git a/base/utils/man/clear.scratch.Rd b/base/utils/man/clear.scratch.Rd index 3a8cc6cccc6..1aaeb969887 100644 --- a/base/utils/man/clear.scratch.Rd +++ b/base/utils/man/clear.scratch.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/clear.scratch.R \name{clear.scratch} \alias{clear.scratch} -\title{Clear EBI-CLUSTER worker node local scratch directories of old PEcAn output} +\title{Removes previous model run output from worker node local scratch directories on EBI-CLUSTER} \usage{ clear.scratch(settings) } diff --git a/base/utils/man/convert.expr.Rd b/base/utils/man/convert.expr.Rd index 21cc7a95b78..605a17773c4 100644 --- a/base/utils/man/convert.expr.Rd +++ b/base/utils/man/convert.expr.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/utils.R \name{convert.expr} \alias{convert.expr} -\title{convert.expr} +\title{Convert expression to variable names} \usage{ convert.expr(expression) } diff --git a/base/utils/man/distn.table.stats.Rd b/base/utils/man/distn.table.stats.Rd index 34526bd1448..bd77cb13bf6 100644 --- a/base/utils/man/distn.table.stats.Rd +++ b/base/utils/man/distn.table.stats.Rd @@ -2,8 +2,7 @@ % Please edit documentation in R/distn.stats.R \name{distn.table.stats} \alias{distn.table.stats} -\title{return mean and standard deviation of a distribution for each distribution in a table with \code{colnames = c('distn', 'a', 'b')}, -e.g. in a table of priors} +\title{Helper function for computing summary statistics of a parametric distribution} \usage{ distn.table.stats(distns) } @@ -14,7 +13,8 @@ distn.table.stats(distns) named vector of mean and SD } \description{ -a helper function for computing summary statistics of a parametric distribution +return mean and standard deviation of a distribution for each distribution in a table with \code{colnames = c('distn', 'a', 'b')}, +e.g. in a table of priors } \author{ David LeBauer diff --git a/base/utils/man/download.url.Rd b/base/utils/man/download.url.Rd index 476ab869a24..9187d9f72c5 100644 --- a/base/utils/man/download.url.Rd +++ b/base/utils/man/download.url.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/download.url.R \name{download.url} \alias{download.url} -\title{Download file from the url.} +\title{Try and download a file.} \usage{ download.url(url, file, timeout = 600, .opts = list(), retry = TRUE) } @@ -22,9 +22,6 @@ protected site use list(userpwd=userpass, httpauth = 1L)} returns name of file if successful or NA if not. } \description{ -Try and download a file. -} -\details{ This will download a file, if retry is set and 404 is returned it will wait until the file is available. If the file is still not available after timeout tries, it will return NA. If the file is downloaded diff --git a/base/utils/man/download_file.Rd b/base/utils/man/download_file.Rd index d2f3bb302c9..97c660c8a81 100644 --- a/base/utils/man/download_file.Rd +++ b/base/utils/man/download_file.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/utils.R \name{download_file} \alias{download_file} -\title{download_file} +\title{Simple function to use ncftpget for FTP downloads behind a firewall.} \usage{ download_file(url, filename, method) } @@ -15,7 +15,6 @@ download_file(url, filename, method) example options(download.ftp.method="ncftpget")} } \description{ -Simple function to use ncftpget for FTP downloads behind a firewall. Requires ncftpget and a properly formatted config file in the users home directory } diff --git a/base/utils/man/full.path.Rd b/base/utils/man/full.path.Rd index 413c0f16435..5fe7d1bf162 100644 --- a/base/utils/man/full.path.Rd +++ b/base/utils/man/full.path.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/full.path.R \name{full.path} \alias{full.path} -\title{Creates an absolute path to a folder} +\title{Creates an absolute path to a folder.} \usage{ full.path(folder) } @@ -13,9 +13,6 @@ full.path(folder) absolute path } \description{ -Creates an absolute path to a folder. -} -\details{ This will take a folder and make it into an absolute folder name. It will normalize the path and prepend it with the current working folder if needed to get an absolute path name. diff --git a/base/utils/man/get.run.id.Rd b/base/utils/man/get.run.id.Rd index 0bbe9eac020..675d762416a 100644 --- a/base/utils/man/get.run.id.Rd +++ b/base/utils/man/get.run.id.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/utils.R \name{get.run.id} \alias{get.run.id} -\title{Get Run ID} +\title{returns an id representing a model run} \usage{ get.run.id(run.type, index, trait = NULL, pft.name = NULL, site.id = NULL) } @@ -22,9 +22,6 @@ ensemble or a quantile used to which a trait has been perturbed for sensitivity id representing a model run } \description{ -returns an id representing a model run -} -\details{ Provides a consistent method of naming runs; for use in model input files and indices } \examples{ diff --git a/base/utils/man/get.stats.mcmc.Rd b/base/utils/man/get.stats.mcmc.Rd index 00f6af0a576..f0b71ef60ca 100644 --- a/base/utils/man/get.stats.mcmc.Rd +++ b/base/utils/man/get.stats.mcmc.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/utils.R \name{get.stats.mcmc} \alias{get.stats.mcmc} -\title{Get stats for parameters in MCMC output} +\title{Further summarizes output from summary.mcmc} \usage{ get.stats.mcmc(mcmc.summary, sample.size) } diff --git a/base/utils/man/load.modelpkg.Rd b/base/utils/man/load.modelpkg.Rd index 95792b3cf6f..06d4aa6cbf7 100644 --- a/base/utils/man/load.modelpkg.Rd +++ b/base/utils/man/load.modelpkg.Rd @@ -13,7 +13,7 @@ load.modelpkg(model) FALSE if function returns error; else TRUE } \description{ -load model package +Load model package } \examples{ \dontrun{require.modelpkg(BioCro)} diff --git a/base/utils/man/misc.are.convertible.Rd b/base/utils/man/misc.are.convertible.Rd index eebddb8fe66..6364fb8e8c2 100644 --- a/base/utils/man/misc.are.convertible.Rd +++ b/base/utils/man/misc.are.convertible.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/utils.R \name{misc.are.convertible} \alias{misc.are.convertible} -\title{misc.are.convertible} +\title{function to check whether units are convertible by misc.convert function} \usage{ misc.are.convertible(u1, u2) } diff --git a/base/utils/man/misc.convert.Rd b/base/utils/man/misc.convert.Rd index 24b9d1e2a74..116bb896f55 100644 --- a/base/utils/man/misc.convert.Rd +++ b/base/utils/man/misc.convert.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/utils.R \name{misc.convert} \alias{misc.convert} -\title{misc.convert} +\title{conversion function for the unit conversions that udunits cannot handle but often needed in PEcAn calculations} \usage{ misc.convert(x, u1, u2) } diff --git a/base/utils/man/mstmipvar.Rd b/base/utils/man/mstmipvar.Rd index 111a79d3ee6..592cc971eae 100644 --- a/base/utils/man/mstmipvar.Rd +++ b/base/utils/man/mstmipvar.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/utils.R \name{mstmipvar} \alias{mstmipvar} -\title{MstMIP variable} +\title{return MstMIP variable as ncvar} \usage{ mstmipvar( name, @@ -30,9 +30,6 @@ mstmipvar( ncvar based on MstMIP definition } \description{ -return MstMIP variable as ncvar -} -\details{ returns a MstMIP variable as a ncvar based on name and other parameters passed in. } diff --git a/base/utils/man/newxtable.Rd b/base/utils/man/newxtable.Rd index 1d480debd1e..4f679494eb9 100644 --- a/base/utils/man/newxtable.Rd +++ b/base/utils/man/newxtable.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/utils.R \name{newxtable} \alias{newxtable} -\title{newxtable} +\title{New xtable} \usage{ newxtable( x, @@ -25,9 +25,6 @@ newxtable( Latex version of table, with percentages properly formatted } \description{ -New xtable -} -\details{ utility to properly escape the '\%' sign for latex } \author{ diff --git a/base/utils/man/pdf.stats.Rd b/base/utils/man/pdf.stats.Rd index ec4d297eaf1..7608980d4a9 100644 --- a/base/utils/man/pdf.stats.Rd +++ b/base/utils/man/pdf.stats.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/utils.R \name{pdf.stats} \alias{pdf.stats} -\title{Probability Distirbution Function Statistics} +\title{Probability Distribution Function Statistics} \usage{ pdf.stats(distn, A, B) } diff --git a/base/utils/man/r2bugs.distributions.Rd b/base/utils/man/r2bugs.distributions.Rd index 77d11fc8616..f900f747faa 100644 --- a/base/utils/man/r2bugs.distributions.Rd +++ b/base/utils/man/r2bugs.distributions.Rd @@ -15,9 +15,6 @@ r2bugs.distributions(priors, direction = "r2bugs") priors dataframe using JAGS default parameterizations } \description{ -convert R parameterizations to BUGS paramaterizations -} -\details{ R and BUGS have different parameterizations for some distributions. This function transforms the distributions from R defaults to BUGS defaults. BUGS is an implementation of the BUGS language, and these transformations are expected to work for bugs. } \examples{ diff --git a/base/utils/man/read.output.Rd b/base/utils/man/read.output.Rd index 89602be6a63..29e3dc3ae03 100644 --- a/base/utils/man/read.output.Rd +++ b/base/utils/man/read.output.Rd @@ -73,6 +73,7 @@ Carbon fluxes: GPP, NPP, NEE, TotalResp, AutoResp, HeteroResp, DOC_flux, Fire_flux, and Stem (Stem is specific to the BioCro model) and Water fluxes: Evaporation (Evap), Transpiration (TVeg), surface runoff (Qs), subsurface runoff (Qsb), and rainfall (Rainf). + For more details, see the \href{http://nacp.ornl.gov/MsTMIP_variables.shtml}{MsTMIP variables} documentation. } diff --git a/base/utils/man/retry.func.Rd b/base/utils/man/retry.func.Rd index e5b250e9f1e..7a3ff9216ef 100644 --- a/base/utils/man/retry.func.Rd +++ b/base/utils/man/retry.func.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/utils.R \name{retry.func} \alias{retry.func} -\title{retry.func} +\title{Retry function X times before stopping in error} \usage{ retry.func( expr, @@ -28,13 +28,10 @@ retval returns the results of the function call \description{ Retry function X times before stopping in error } -\details{ -Retry function X times before stopping in error -} \examples{ \dontrun{ - file_url <- paste0("https://thredds.daac.ornl.gov/", - "thredds/dodsC/ornldaac/1220", + file_url <- paste0("https://thredds.daac.ornl.gov/", + "thredds/dodsC/ornldaac/1220", "/mstmip_driver_global_hd_climate_lwdown_1999_v1.nc4") dap <- retry.func( ncdf4::nc_open(file_url), diff --git a/base/utils/man/rsync.Rd b/base/utils/man/rsync.Rd index b99d2a6b3fa..2beaa2f940b 100644 --- a/base/utils/man/rsync.Rd +++ b/base/utils/man/rsync.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/utils.R \name{rsync} \alias{rsync} -\title{rsync} +\title{R implementation of rsync} \usage{ rsync(args, from, to, pattern = "") } @@ -19,9 +19,6 @@ rsync(args, from, to, pattern = "") nothing, transfers files as a side effect } \description{ -R implementation of rsync -} -\details{ rsync is a file copying tool in bash } \author{ diff --git a/base/utils/man/ssh.Rd b/base/utils/man/ssh.Rd index bacc286f4d9..a7ad6d83503 100644 --- a/base/utils/man/ssh.Rd +++ b/base/utils/man/ssh.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/utils.R \name{ssh} \alias{ssh} -\title{SSH} +\title{R implementation of SSH} \usage{ ssh(host, ..., args = "") } diff --git a/base/utils/man/summarize.result.Rd b/base/utils/man/summarize.result.Rd index 28ad6262524..f7cba06d5f1 100644 --- a/base/utils/man/summarize.result.Rd +++ b/base/utils/man/summarize.result.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/utils.R \name{summarize.result} \alias{summarize.result} -\title{Summarize Results} +\title{Summarize results of replicate observations in trait data query} \usage{ summarize.result(result) } diff --git a/base/utils/man/temp.settings.Rd b/base/utils/man/temp.settings.Rd index fa5e643ba98..af37b29f347 100644 --- a/base/utils/man/temp.settings.Rd +++ b/base/utils/man/temp.settings.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/utils.R \name{temp.settings} \alias{temp.settings} -\title{temp.settings} +\title{Create a temporary settings file} \usage{ temp.settings(settings.txt) } @@ -13,9 +13,6 @@ temp.settings(settings.txt) character vector written to and read from a temporary file } \description{ -Create a temporary settings file -} -\details{ Uses \code{\link{tempfile}} function to provide a valid temporary file (OS independent) Useful for testing functions that depend on settings file Reference: http://stackoverflow.com/a/12940705/199217 diff --git a/base/utils/man/timezone_hour.Rd b/base/utils/man/timezone_hour.Rd index 225ae05ae58..f63c6485c7b 100644 --- a/base/utils/man/timezone_hour.Rd +++ b/base/utils/man/timezone_hour.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/timezone_hour.R \name{timezone_hour} \alias{timezone_hour} -\title{timezone_hour} +\title{Timezone Hour} \usage{ timezone_hour(timezone) } @@ -13,7 +13,7 @@ timezone_hour(timezone) hours offset of the timezone } \description{ -return the number of hours offset to UTC for a timezone. +Returns the number of hours offset to UTC for a timezone. } \examples{ \dontrun{ diff --git a/base/utils/man/tryl.Rd b/base/utils/man/tryl.Rd index 79d0789c5b4..9d011f2e15a 100644 --- a/base/utils/man/tryl.Rd +++ b/base/utils/man/tryl.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/utils.R \name{tryl} \alias{tryl} -\title{tryl} +\title{Test if function gives an error} \usage{ tryl(FUN) } @@ -13,9 +13,6 @@ tryl(FUN) FALSE if function returns error; else TRUE } \description{ -Test if function gives an error -} -\details{ adaptation of try that returns a logical value (FALSE if error) } \examples{ diff --git a/base/utils/man/vecpaste.Rd b/base/utils/man/vecpaste.Rd index 23b8e4d92e4..66ff229cdd3 100644 --- a/base/utils/man/vecpaste.Rd +++ b/base/utils/man/vecpaste.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/utils.R \name{vecpaste} \alias{vecpaste} -\title{vecpaste} +\title{Convert vector to comma delimited string} \usage{ vecpaste(x) } @@ -13,8 +13,5 @@ vecpaste(x) comma delimited string } \description{ -Convert vector to comma delimited string -} -\details{ vecpaste, turns vector into comma delimited string fit for SQL statements. } diff --git a/base/utils/man/zero.bounded.density.Rd b/base/utils/man/zero.bounded.density.Rd index c2b423e2c17..0a795c7938f 100644 --- a/base/utils/man/zero.bounded.density.Rd +++ b/base/utils/man/zero.bounded.density.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/utils.R \name{zero.bounded.density} \alias{zero.bounded.density} -\title{Zero Bounded Density} +\title{Zero bounded density using log density transform} \usage{ zero.bounded.density(x, bw = "SJ", n = 1001) } @@ -17,9 +17,6 @@ zero.bounded.density(x, bw = "SJ", n = 1001) data frame with back-transformed log density estimate } \description{ -Zero bounded density using log density transform -} -\details{ Provides a zero bounded density estimate of a parameter. Kernel Density Estimation used by the \code{\link[stats]{density}} function will cause problems at the left hand end because it will put some weight on negative values. diff --git a/base/utils/scripts/metutils.R b/base/utils/scripts/metutils.R index 79b28047077..0d25fc23506 100644 --- a/base/utils/scripts/metutils.R +++ b/base/utils/scripts/metutils.R @@ -1,11 +1,3 @@ -#------------------------------------------------------------------------------- -# Copyright (c) 2012 University of Illinois, NCSA. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the -# University of Illinois/NCSA Open Source License -# which accompanies this distribution, and is available at -# http://opensource.ncsa.illinois.edu/license.html -#------------------------------------------------------------------------------- #################################################################################################### #/file # diff --git a/base/utils/scripts/time.constants.R b/base/utils/scripts/time.constants.R index 25387507d69..b6daeb31122 100644 --- a/base/utils/scripts/time.constants.R +++ b/base/utils/scripts/time.constants.R @@ -1,12 +1,3 @@ -#------------------------------------------------------------------------------- -# Copyright (c) 2012 University of Illinois, NCSA. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the -# University of Illinois/NCSA Open Source License -# which accompanies this distribution, and is available at -# http://opensource.ncsa.illinois.edu/license.html -#------------------------------------------------------------------------------- -#==========================================================================================# #==========================================================================================# # Time conversion units # #------------------------------------------------------------------------------------------# diff --git a/base/utils/tests/Rcheck_reference.log b/base/utils/tests/Rcheck_reference.log index ac9acddcb22..025a87bfa66 100644 --- a/base/utils/tests/Rcheck_reference.log +++ b/base/utils/tests/Rcheck_reference.log @@ -12,38 +12,6 @@ Maintainer: ‘Rob Kooper ’ New submission -License components with restrictions and base license permitting such: - BSD_3_clause + file LICENSE -File 'LICENSE': - University of Illinois/NCSA Open Source License - - Copyright (c) 2012, University of Illinois, NCSA. All rights reserved. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal with the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimers. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. - - Neither the names of University of Illinois, NCSA, nor the names - of its contributors may be used to endorse or promote products - derived from this Software without specific prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR - ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. - Strong dependencies not in mainstream repositories: PEcAn.logger, PEcAn.remote @@ -57,7 +25,6 @@ Found the following (possibly) invalid URLs: Status: 404 Message: Not Found -The Date field is over a month old. * checking package namespace information ... OK * checking package dependencies ... OK * checking if this is a source package ... OK @@ -71,8 +38,7 @@ The Date field is over a month old. * checking installed package size ... OK * checking package directory ... OK * checking for future file timestamps ... OK -* checking DESCRIPTION meta-information ... NOTE -License stub is invalid DCF. +* checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking for left-over files ... OK * checking index information ... OK @@ -90,11 +56,7 @@ License stub is invalid DCF. * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK -* checking R code for possible problems ... NOTE -mcmc.list2init: no visible binding for global variable ‘nr’ - -Undefined global functions or variables: - nr years yieldarray +* checking R code for possible problems ... OK * checking Rd files ... OK * checking Rd metadata ... OK * checking Rd line widths ... OK @@ -109,10 +71,7 @@ See chapter ‘Writing R documentation files’ in the ‘Writing R Extensions’ manual. * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK -* checking Rd contents ... WARNING -Argument items with no description in Rd object 'get.sa.sample.list': - ‘env’ - +* checking Rd contents ... OK * checking for unstated dependencies in examples ... OK * checking contents of ‘data’ directory ... OK * checking data for non-ASCII characters ... OK diff --git a/base/utils/tests/testthat.R b/base/utils/tests/testthat.R index 7c41d64906e..fe77b4f21d0 100644 --- a/base/utils/tests/testthat.R +++ b/base/utils/tests/testthat.R @@ -1,11 +1,3 @@ -#------------------------------------------------------------------------------- -# Copyright (c) 2012 University of Illinois, NCSA. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the -# University of Illinois/NCSA Open Source License -# which accompanies this distribution, and is available at -# http://opensource.ncsa.illinois.edu/license.html -#------------------------------------------------------------------------------- library(testthat) library(PEcAn.utils) diff --git a/base/utils/tests/testthat/test.trait.dictionary.R b/base/utils/tests/testthat/test.trait.dictionary.R index 39da807c566..4330d518b65 100644 --- a/base/utils/tests/testthat/test.trait.dictionary.R +++ b/base/utils/tests/testthat/test.trait.dictionary.R @@ -1,12 +1,3 @@ -#------------------------------------------------------------------------------- -# Copyright (c) 2012 University of Illinois, NCSA. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the -# University of Illinois/NCSA Open Source License -# which accompanies this distribution, and is available at -# http://opensource.ncsa.illinois.edu/license.html -#------------------------------------------------------------------------------- - test_that("trait dictionary loads and has expected columns",{ rm(list = ls()) data(trait.dictionary, package = "PEcAn.utils") diff --git a/base/utils/tests/testthat/test.utils.R b/base/utils/tests/testthat/test.utils.R index 93337ba0856..37478cba081 100644 --- a/base/utils/tests/testthat/test.utils.R +++ b/base/utils/tests/testthat/test.utils.R @@ -1,11 +1,3 @@ -#------------------------------------------------------------------------------- -# Copyright (c) 2012 University of Illinois, NCSA. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the -# University of Illinois/NCSA Open Source License -# which accompanies this distribution, and is available at -# http://opensource.ncsa.illinois.edu/license.html -#------------------------------------------------------------------------------- context("Other utilities") test.stats <- data.frame(Y=rep(1,5), diff --git a/base/visualization/DESCRIPTION b/base/visualization/DESCRIPTION index 136d5a9dbbe..8b38be4c664 100644 --- a/base/visualization/DESCRIPTION +++ b/base/visualization/DESCRIPTION @@ -51,6 +51,6 @@ Copyright: Authors LazyLoad: yes LazyData: FALSE Encoding: UTF-8 -VignetteBuilder: knitr +VignetteBuilder: knitr, rmarkdown RoxygenNote: 7.3.2 Roxygen: list(markdown = TRUE) diff --git a/base/visualization/R/version.R b/base/visualization/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/base/visualization/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/base/workflow/R/version.R b/base/workflow/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/base/workflow/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/book_source/01_introduction/01_project_overview.Rmd b/book_source/01_introduction/01_project_overview.Rmd index 847072590b9..d9b00767bfb 100644 --- a/book_source/01_introduction/01_project_overview.Rmd +++ b/book_source/01_introduction/01_project_overview.Rmd @@ -2,7 +2,7 @@ The Predictive Ecosystem Analyzer (PEcAn) is an integrated informatics toolbox for ecosystem modeling (Dietze et al. 2013, LeBauer et al. 2013). PEcAn consists of: -1. An application program interface (API) that encapsulates an ecosystem model, providing a common interface, inputs, and output. +1. An application program interface (API) that encapsulates an ecosystem model, providing a common interface, inputs, and output 2. Core utilities for handling and tracking model runs and the flows of information and uncertainties into and out of models and analyses 3. An accessible web-based user interface and visualization tools 4. An extensible collection of modules to handle specific types of analyses (sensitivity, uncertainty, ensemble), model-data syntheses (benchmarking, parameter data assimilation, state data assimilation), and data processing (model inputs and data constraints) diff --git a/docker-compose.yml b/docker-compose.yml index da03250edc3..4a2adc17804 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,6 +2,7 @@ services: # webserver to handle all traffic. This can use let's encrypt to generate a SSL cert. traefik: + hostname: traefik image: "traefik:v2.9" command: - --log.level=INFO @@ -38,6 +39,7 @@ services: # rabbitmq to connect to extractors rabbitmq: + hostname: rabbitmq image: rabbitmq:3.8-management restart: unless-stopped networks: @@ -64,6 +66,7 @@ services: # postgresql + postgis to hold all the data postgres: + hostname: postgres image: mdillon/postgis:9.5 restart: unless-stopped networks: @@ -80,6 +83,7 @@ services: # BETY rails frontend to the database # ---------------------------------------------------------------------- bety: + hostname: bety image: pecan/bety:${BETY_VERSION:-latest} restart: unless-stopped networks: @@ -108,6 +112,7 @@ services: # RStudio # ---------------------------------------------------------------------- rstudio: + hostname: rstudio image: pecan/base:${PECAN_VERSION:-latest} command: /work/rstudio.sh restart: unless-stopped @@ -151,6 +156,7 @@ services: # PEcAn documentation as well as PEcAn home page docs: + hostname: docs image: pecan/docs:${PECAN_VERSION:-latest} restart: unless-stopped networks: @@ -167,6 +173,7 @@ services: # PEcAn web front end, this is just the PHP code pecan: + hostname: pecan-web user: "${UID:-1001}:${GID:-1001}" image: pecan/web:${PECAN_VERSION:-latest} restart: unless-stopped @@ -197,6 +204,7 @@ services: # PEcAn model monitor monitor: + hostname: monitor user: "${UID:-1001}:${GID:-1001}" image: pecan/monitor:${PECAN_VERSION:-latest} restart: unless-stopped @@ -225,6 +233,7 @@ services: # PEcAn executor, executes jobs. Does not the actual models executor: + hostname: executor user: "${UID:-1001}:${GID:-1001}" image: pecan/executor:${PECAN_VERSION:-latest} restart: unless-stopped @@ -248,6 +257,7 @@ services: # ---------------------------------------------------------------------- # PEcAn FATES model runner fates: + hostname: fates user: "${UID:-1001}:${GID:-1001}" image: ghcr.io/noresmhub/ctsm-api:latest restart: unless-stopped @@ -263,6 +273,7 @@ services: # PEcAn basgra model runner basgra: + hostname: basgra user: "${UID:-1001}:${GID:-1001}" image: pecan/model-basgra-basgra_n_v1.0:${PECAN_VERSION:-latest} restart: unless-stopped @@ -278,6 +289,7 @@ services: # PEcAn sipnet model runner sipnet: + hostname: sipnet-git user: "${UID:-1001}:${GID:-1001}" image: pecan/model-sipnet-git:${PECAN_VERSION:-latest} restart: unless-stopped @@ -293,6 +305,7 @@ services: # PEcAn ED model runner ed2: + hostname: ed2-2_2_0 user: "${UID:-1001}:${GID:-1001}" image: pecan/model-ed2-2.2.0:${PECAN_VERSION:-latest} restart: unless-stopped @@ -308,6 +321,7 @@ services: # PEcAn MAESPA model runner maespa: + hostname: maespa-git user: "${UID:-1001}:${GID:-1001}" image: pecan/model-maespa-git:${PECAN_VERSION:-latest} restart: unless-stopped @@ -323,6 +337,7 @@ services: # PEcAn BioCro model runner biocro: + hostname: biocro-0_95 user: "${UID:-1001}:${GID:-1001}" image: pecan/model-biocro-0.95:${PECAN_VERSION:-latest} restart: unless-stopped @@ -341,6 +356,7 @@ services: # ---------------------------------------------------------------------- # PEcAn DB Sync visualization dbsync: + hostname: dbsync image: pecan/shiny-dbsync:${PECAN_VERSION:-latest} restart: unless-stopped networks: @@ -363,6 +379,7 @@ services: # PEcAn API # ---------------------------------------------------------------------- api: + hostname: api user: "${UID:-1001}:${GID:-1001}" image: pecan/api:${PECAN_VERSION:-latest} restart: unless-stopped diff --git a/docker/depends/pecan_package_dependencies.csv b/docker/depends/pecan_package_dependencies.csv index c332b010bc0..1e8d04c40a9 100644 --- a/docker/depends/pecan_package_dependencies.csv +++ b/docker/depends/pecan_package_dependencies.csv @@ -495,6 +495,7 @@ "rmarkdown","*","models/biocro","Suggests",FALSE "rmarkdown","*","models/ed","Suggests",FALSE "rmarkdown","*","models/maat","Suggests",FALSE +"rmarkdown","*","modules/data.atmosphere","Suggests",FALSE "rmarkdown","*","modules/priors","Suggests",FALSE "rmarkdown","*","modules/rtm","Suggests",FALSE "rmarkdown",">= 2.19","base/db","Suggests",FALSE diff --git a/models/basgra/R/version.R b/models/basgra/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/models/basgra/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/models/biocro/DESCRIPTION b/models/biocro/DESCRIPTION index 981621c2129..51a2475e4dd 100644 --- a/models/biocro/DESCRIPTION +++ b/models/biocro/DESCRIPTION @@ -38,5 +38,5 @@ Remotes: License: BSD_3_clause + file LICENSE Copyright: Energy Biosciences Institute, Authors Encoding: UTF-8 -VignetteBuilder: knitr +VignetteBuilder: knitr, rmarkdown RoxygenNote: 7.3.2 diff --git a/models/biocro/LICENSE b/models/biocro/LICENSE index 5a9e44128f1..09ef35a60b4 100644 --- a/models/biocro/LICENSE +++ b/models/biocro/LICENSE @@ -1,34 +1,3 @@ -## This is the master copy of the PEcAn License - -University of Illinois/NCSA Open Source License - -Copyright (c) 2012, University of Illinois, NCSA. All rights reserved. - -PEcAn project -www.pecanproject.org - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal with the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -- Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimers. -- Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. -- Neither the names of University of Illinois, NCSA, nor the names - of its contributors may be used to endorse or promote products - derived from this Software without specific prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF -CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. - +YEAR: 2024 +COPYRIGHT HOLDER: PEcAn Project +ORGANIZATION: PEcAn Project, authors affiliations diff --git a/models/biocro/NEWS.md b/models/biocro/NEWS.md new file mode 100644 index 00000000000..9947d8a8ac0 --- /dev/null +++ b/models/biocro/NEWS.md @@ -0,0 +1,7 @@ +# PEcAn.BIOCRO 1.7.3.9000 + +## License change +* PEcAn.BIOCRO is now distributed under the BSD three-clause license instead of the NCSA Open Source license. + +## Added +* Added a `NEWS.md` file to track changes to the package. Prior to this point changes are tracked in the main CHANGELOG for the PEcAn repository. diff --git a/models/biocro/R/met2model.BIOCRO.R b/models/biocro/R/met2model.BIOCRO.R index 7cffbd98b62..9e993e59a6b 100644 --- a/models/biocro/R/met2model.BIOCRO.R +++ b/models/biocro/R/met2model.BIOCRO.R @@ -1,29 +1,23 @@ -#------------------------------------------------------------------------------- -# Copyright (c) 2012 University of Illinois, NCSA. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the -# University of Illinois/NCSA Open Source License -# which accompanies this distribution, and is available at -# http://opensource.ncsa.illinois.edu/license.html -#------------------------------------------------------------------------------- .datatable.aware <- TRUE + + ##-------------------------------------------------------------------------------------------------# -##' Converts a met CF file to a model specific met file. The input -##' files are called /.YYYY.cf -##' -##' @name met2model.BIOCRO -##' @title Write BioCro met files -##' @param in.path path on disk where CF file lives -##' @param in.prefix prefix for each file -##' @param outfolder location where model specific output is written -##' @param lat,lon Site latitude and longitude -##' @param start_date,end_date Date range to convert. Each year will be written to a separate file -##' @param overwrite logical: Write over any existing file of the same name? If FALSE, leaves the existing file untouched and skips to the next year. -##' @param ... other arguments passed from PEcAn, currently ignored -##' @return a dataframe of information about the written file -##' @export -##' @author Rob Kooper, David LeBauer +#' Write BioCro met files +#' +#' Converts a met CF file to a model specific met file. The input +#' files are called /.YYYY.cf +#' +#' @param in.path path on disk where CF file lives +#' @param in.prefix prefix for each file +#' @param outfolder location where model specific output is written +#' @param lat,lon Site latitude and longitude +#' @param start_date,end_date Date range to convert. Each year will be written to a separate file +#' @param overwrite logical: Write over any existing file of the same name? If FALSE, leaves the existing file untouched and skips to the next year. +#' @param ... other arguments passed from PEcAn, currently ignored +#' @return a dataframe of information about the written file +#' @export +#' @author Rob Kooper, David LeBauer ##-------------------------------------------------------------------------------------------------# met2model.BIOCRO <- function(in.path, in.prefix, outfolder, overwrite = FALSE, lat, lon, start_date, end_date, ...) { @@ -102,44 +96,42 @@ met2model.BIOCRO <- function(in.path, in.prefix, outfolder, overwrite = FALSE, ##-------------------------------------------------------------------------------------------------# -##' Converts a CF data frame into a BioCro met input -##' -##' @name cf2biocro -##' @title Convert CF-formatted met data to BioCro met -##' @param met data.table object with met for a single site; output from \code{\link{load.cfmet}} -##' \describe{ -##' \item{year}{int} -##' \item{month}{int} -##' \item{day}{int: day of month (1-31)} -##' \item{doy}{int: day of year (1-366)} -##' \item{hour}{int (0-23)} -##' \item{date}{YYYY-MM-DD HH:MM:SS POSIXct} -##' \item{wind_speed}{num m/s} -##' \item{northward_wind}{} -##' \item{eastward_wind}{} -##' \item{ppfd}{optional; if missing, requires surface_downwelling_shortwave_flux_in_air} -##' \item{surface_downwelling_shortwave_flux_in_air}{} -##' \item{air_pressure (Pa)}{optional; if missing, requires relative_humidity} -##' \item{specific_humidity}{optional; if missing, requires relative_humidity} -##' \item{relative_humidity}{optional; if missing, requires air_pressure and specific_humidity} -##' \item{precipitation_flux}{} -##' \item{air_temperature}{} -##' } -##' @param longitude in degrees east, used for calculating solar noon -##' @param zulu2solarnoon logical; if TRUE, convert time from GMT to local solar time. -##' @return data.table / data.frame with fields -##' \describe{ -##' \item{doy}{day of year} -##' \item{hr}{hour} -##' \item{solar}{solar radiation (PPFD)} -##' \item{temp}{temperature, degrees celsius} -##' \item{rh}{relative humidity, as fraction (0-1)} -##' \item{windspeed}{m/s} -##' \item{precip}{cm/h} -##' } -##' @export -##' @importFrom data.table := -##' @author David LeBauer +#' Converts a CF data frame into a BioCro met input +#' +#' @param met data.table object with met for a single site; output from \code{\link{load.cfmet}} +#' \describe{ +#' \item{year}{int} +#' \item{month}{int} +#' \item{day}{int: day of month (1-31)} +#' \item{doy}{int: day of year (1-366)} +#' \item{hour}{int (0-23)} +#' \item{date}{YYYY-MM-DD HH:MM:SS POSIXct} +#' \item{wind_speed}{num m/s} +#' \item{northward_wind}{} +#' \item{eastward_wind}{} +#' \item{ppfd}{optional; if missing, requires surface_downwelling_shortwave_flux_in_air} +#' \item{surface_downwelling_shortwave_flux_in_air}{} +#' \item{air_pressure (Pa)}{optional; if missing, requires relative_humidity} +#' \item{specific_humidity}{optional; if missing, requires relative_humidity} +#' \item{relative_humidity}{optional; if missing, requires air_pressure and specific_humidity} +#' \item{precipitation_flux}{} +#' \item{air_temperature}{} +#' } +#' @param longitude in degrees east, used for calculating solar noon +#' @param zulu2solarnoon logical; if TRUE, convert time from GMT to local solar time. +#' @return data.table / data.frame with fields +#' \describe{ +#' \item{doy}{day of year} +#' \item{hr}{hour} +#' \item{solar}{solar radiation (PPFD)} +#' \item{temp}{temperature, degrees celsius} +#' \item{rh}{relative humidity, as fraction (0-1)} +#' \item{windspeed}{m/s} +#' \item{precip}{cm/h} +#' } +#' @export +#' @importFrom data.table := +#' @author David LeBauer cf2biocro <- function(met, longitude = NULL, zulu2solarnoon = FALSE) { if (!data.table::is.data.table(met)) { diff --git a/models/biocro/R/model2netcdf.BIOCRO.R b/models/biocro/R/model2netcdf.BIOCRO.R index 03c7cab4238..d6fb4dbbff7 100644 --- a/models/biocro/R/model2netcdf.BIOCRO.R +++ b/models/biocro/R/model2netcdf.BIOCRO.R @@ -1,28 +1,16 @@ -#------------------------------------------------------------------------------- -# Copyright (c) 2012 University of Illinois, NCSA. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the -# University of Illinois/NCSA Open Source License -# which accompanies this distribution, and is available at -# http://opensource.ncsa.illinois.edu/license.html -#------------------------------------------------------------------------------- - -##--------------------------------------------------------------------------------------------------# -##' Convert BioCro output to netCDF -##' -##' Converts BioCro output to netCDF. -##' Modified from on model2netcdf.SIPNET and model2netcdf.ED2 by -##' @name model2netcdf.BIOCRO -##' @title Function to convert biocro model output to standard netCDF format -##' @param result a dataframe of model output to be converted -##' @param genus character: What kind of plant was being simulated? -##' Used to correct for some genus-specific differences in model output; -##' Eventually that will be handled inside BioCro and this argument will be removed. -##' @param outdir Location of model output -##' @param lat Latitude of the site -##' @param lon Longitude of the site -##' @export -##' @author David LeBauer, Deepak Jaiswal, Rob Kooper +#' Convert BioCro output to standard netCDF format +#' +#' Modified from on model2netcdf.SIPNET and model2netcdf.ED2 by +#' +#' @param result a dataframe of model output to be converted +#' @param genus character: What kind of plant was being simulated? +#' Used to correct for some genus-specific differences in model output; +#' Eventually that will be handled inside BioCro and this argument will be removed. +#' @param outdir Location of model output +#' @param lat Latitude of the site +#' @param lon Longitude of the site +#' @export +#' @author David LeBauer, Deepak Jaiswal, Rob Kooper model2netcdf.BIOCRO <- function(result, genus = NULL, outdir, lat = -9999, lon = -9999) { if (!("hour" %in% colnames(result))) { diff --git a/models/biocro/R/read.biocro.config.R b/models/biocro/R/read.biocro.config.R index 2a47069be15..e1a58b6b19f 100644 --- a/models/biocro/R/read.biocro.config.R +++ b/models/biocro/R/read.biocro.config.R @@ -1,10 +1,9 @@ -##' Read BioCro config file -##' -##' @title Read BioCro Config -##' @param config.file Path to XML file -##' @return list of run configuration parameters for PEcAn -##' @export -##' @author David LeBauer +#' Read BioCro config file +#' +#' @param config.file Path to XML file +#' @return list of run configuration parameters for PEcAn +#' @export +#' @author David LeBauer read.biocro.config <- function(config.file = "config.xml") { config <- XML::xmlToList(XML::xmlTreeParse(file = config.file, handlers = list(comment = function(x) { NULL }), diff --git a/models/biocro/R/version.R b/models/biocro/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/models/biocro/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/models/biocro/R/write.configs.BIOCRO.R b/models/biocro/R/write.configs.BIOCRO.R index 6bbca20db36..b7b869376a6 100644 --- a/models/biocro/R/write.configs.BIOCRO.R +++ b/models/biocro/R/write.configs.BIOCRO.R @@ -1,25 +1,16 @@ -#------------------------------------------------------------------------------- -# Copyright (c) 2012 University of Illinois, NCSA. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the -# University of Illinois/NCSA Open Source License -# which accompanies this distribution, and is available at -# http://opensource.ncsa.illinois.edu/license.html -#------------------------------------------------------------------------------- PREFIX_XML <- "\n\n" -##' convert parameters from PEcAn database default units to biocro defaults -##' -##' Performs model specific unit conversions on a list of trait values, -##' such as those provided to write.config -##' @name convert.samples.BIOCRO -##' @title Convert samples for biocro -##' @param trait.samples a matrix or dataframe of samples from the trait distribution -##' @param biocro_version numeric, but currently only checks whether version is less than 1.0 -##' @return dataframe with values transformed -##' @export -##' @author David LeBauer +#' convert parameters from PEcAn database default units to biocro defaults +#' +#' Performs model specific unit conversions on a list of trait values, +#' such as those provided to write.config +#' +#' @param trait.samples a matrix or dataframe of samples from the trait distribution +#' @param biocro_version numeric, but currently only checks whether version is less than 1.0 +#' @return dataframe with values transformed +#' @export +#' @author David LeBauer convert.samples.BIOCRO <- function(trait.samples, biocro_version=1.0) { trait.samples <- as.data.frame(trait.samples) @@ -64,19 +55,17 @@ convert.samples.BIOCRO <- function(trait.samples, biocro_version=1.0) { } # convert.samples.BIOCRO -##' Writes a configuration files for the biocro model -##' -##' @name write.config.BIOCRO -##' @title Write configuration files for the biocro model -##' @param defaults named list with default model parameter values -##' @param trait.values named list (or dataframe of trait values) -##' can either be a data.frame or named list of traits, e.g. -##' \code{data.frame(vmax = 1, b0 = 2)} or \code{list(vmax = 1, b0 = 2)} -##' @param settings pecan settings file configured for BioCro -##' @param run.id integer; a unique identifier for the run. -##' @export -##' @return nothing, writes configuration file as side effect -##' @author David LeBauer +#' Writes a configuration files for the biocro model +#' +#' @param defaults named list with default model parameter values +#' @param trait.values named list (or dataframe of trait values) +#' can either be a data.frame or named list of traits, e.g. +#' \code{data.frame(vmax = 1, b0 = 2)} or \code{list(vmax = 1, b0 = 2)} +#' @param settings pecan settings file configured for BioCro +#' @param run.id integer; a unique identifier for the run. +#' @export +#' @return nothing, writes configuration file as side effect +#' @author David LeBauer write.config.BIOCRO <- function(defaults = NULL, trait.values, settings, run.id) { ## find out where to write run/ouput @@ -209,15 +198,13 @@ write.config.BIOCRO <- function(defaults = NULL, trait.values, settings, run.id) } # write.config.BIOCRO -##' Clear out previous config and parameter files. -##' -##' @name remove.config.BIOCRO -##' @title Clear out previous biocro config and parameter files. -##' @param main.outdir Primary PEcAn output directory (will be depreciated) -##' @param settings PEcAn settings file -##' @return nothing, removes config files as side effect -##' @export -##' @author Shawn Serbin, David LeBauer +#' Clear out previous config and parameter files. +#' +#' @param main.outdir Primary PEcAn output directory (will be depreciated) +#' @param settings PEcAn settings file +#' @return nothing, removes config files as side effect +#' @export +#' @author Shawn Serbin, David LeBauer remove.config.BIOCRO <- function(main.outdir, settings) { ## Remove files on localhost diff --git a/models/biocro/man/cf2biocro.Rd b/models/biocro/man/cf2biocro.Rd index 30d359bc3e8..8999385451e 100644 --- a/models/biocro/man/cf2biocro.Rd +++ b/models/biocro/man/cf2biocro.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/met2model.BIOCRO.R \name{cf2biocro} \alias{cf2biocro} -\title{Convert CF-formatted met data to BioCro met} +\title{Converts a CF data frame into a BioCro met input} \usage{ cf2biocro(met, longitude = NULL, zulu2solarnoon = FALSE) } diff --git a/models/biocro/man/convert.samples.BIOCRO.Rd b/models/biocro/man/convert.samples.BIOCRO.Rd index 8964f3284de..28f50af2967 100644 --- a/models/biocro/man/convert.samples.BIOCRO.Rd +++ b/models/biocro/man/convert.samples.BIOCRO.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/write.configs.BIOCRO.R \name{convert.samples.BIOCRO} \alias{convert.samples.BIOCRO} -\title{Convert samples for biocro} +\title{convert parameters from PEcAn database default units to biocro defaults} \usage{ convert.samples.BIOCRO(trait.samples, biocro_version = 1) } @@ -15,9 +15,6 @@ convert.samples.BIOCRO(trait.samples, biocro_version = 1) dataframe with values transformed } \description{ -convert parameters from PEcAn database default units to biocro defaults -} -\details{ Performs model specific unit conversions on a list of trait values, such as those provided to write.config } diff --git a/models/biocro/man/model2netcdf.BIOCRO.Rd b/models/biocro/man/model2netcdf.BIOCRO.Rd index 236fe0879c0..acc489139f0 100644 --- a/models/biocro/man/model2netcdf.BIOCRO.Rd +++ b/models/biocro/man/model2netcdf.BIOCRO.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/model2netcdf.BIOCRO.R \name{model2netcdf.BIOCRO} \alias{model2netcdf.BIOCRO} -\title{Function to convert biocro model output to standard netCDF format} +\title{Convert BioCro output to standard netCDF format} \usage{ model2netcdf.BIOCRO(result, genus = NULL, outdir, lat = -9999, lon = -9999) } @@ -20,10 +20,6 @@ Eventually that will be handled inside BioCro and this argument will be removed. \item{lon}{Longitude of the site} } \description{ -Convert BioCro output to netCDF -} -\details{ -Converts BioCro output to netCDF. Modified from on model2netcdf.SIPNET and model2netcdf.ED2 by } \author{ diff --git a/models/biocro/man/read.biocro.config.Rd b/models/biocro/man/read.biocro.config.Rd index 6240c283018..2b4a5ac910f 100644 --- a/models/biocro/man/read.biocro.config.Rd +++ b/models/biocro/man/read.biocro.config.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/read.biocro.config.R \name{read.biocro.config} \alias{read.biocro.config} -\title{Read BioCro Config} +\title{Read BioCro config file} \usage{ read.biocro.config(config.file = "config.xml") } diff --git a/models/biocro/man/remove.config.BIOCRO.Rd b/models/biocro/man/remove.config.BIOCRO.Rd index 7ceb7aeed94..60b926e7980 100644 --- a/models/biocro/man/remove.config.BIOCRO.Rd +++ b/models/biocro/man/remove.config.BIOCRO.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/write.configs.BIOCRO.R \name{remove.config.BIOCRO} \alias{remove.config.BIOCRO} -\title{Clear out previous biocro config and parameter files.} +\title{Clear out previous config and parameter files.} \usage{ remove.config.BIOCRO(main.outdir, settings) } diff --git a/models/biocro/man/write.config.BIOCRO.Rd b/models/biocro/man/write.config.BIOCRO.Rd index 26505e69d8a..9856d784278 100644 --- a/models/biocro/man/write.config.BIOCRO.Rd +++ b/models/biocro/man/write.config.BIOCRO.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/write.configs.BIOCRO.R \name{write.config.BIOCRO} \alias{write.config.BIOCRO} -\title{Write configuration files for the biocro model} +\title{Writes a configuration files for the biocro model} \usage{ write.config.BIOCRO(defaults = NULL, trait.values, settings, run.id) } diff --git a/models/biocro/tests/Rcheck_reference.log b/models/biocro/tests/Rcheck_reference.log index 98b0a701e11..31fb6ae89ff 100644 --- a/models/biocro/tests/Rcheck_reference.log +++ b/models/biocro/tests/Rcheck_reference.log @@ -12,43 +12,6 @@ Maintainer: ‘David LeBauer ’ New submission -License components with restrictions and base license permitting such: - BSD_3_clause + file LICENSE -File 'LICENSE': - ## This is the master copy of the PEcAn License - - University of Illinois/NCSA Open Source License - - Copyright (c) 2012, University of Illinois, NCSA. All rights reserved. - - PEcAn project - www.pecanproject.org - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal with the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimers. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. - - Neither the names of University of Illinois, NCSA, nor the names - of its contributors may be used to endorse or promote products - derived from this Software without specific prior written permission. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR - ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. - Unknown, possibly misspelled, fields in DESCRIPTION: ‘Remotes’ @@ -58,7 +21,6 @@ Strong dependencies not in mainstream repositories: Suggests or Enhances not in mainstream repositories: BioCro, PEcAn.DB -The Date field is over a month old. * checking package namespace information ... OK * checking package dependencies ... OK * checking if this is a source package ... OK @@ -72,8 +34,7 @@ The Date field is over a month old. * checking installed package size ... OK * checking package directory ... OK * checking for future file timestamps ... OK -* checking DESCRIPTION meta-information ... NOTE -License stub is invalid DCF. +* checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking for left-over files ... OK * checking index information ... OK @@ -111,10 +72,7 @@ See section 'Cross-references' in the 'Writing R Extensions' manual. * checking Rd \usage sections ... OK * checking Rd contents ... OK * checking for unstated dependencies in examples ... OK -* checking files in ‘vignettes’ ... WARNING -Files in the 'vignettes' directory but no files in 'inst/doc': - ‘C4grass_sa_vd.Rmd’, ‘sa.output.Rdata’, ‘workflow.R’, ‘workflow.Rmd’ -Package has no Sweave vignette sources and no VignetteBuilder field. +* checking files in ‘vignettes’ ... OK * checking examples ... NONE * checking for unstated dependencies in ‘tests’ ... OK * checking tests ... SKIPPED diff --git a/models/biocro/tests/testthat.R b/models/biocro/tests/testthat.R index 31a95f2fe7e..da34f056ebe 100644 --- a/models/biocro/tests/testthat.R +++ b/models/biocro/tests/testthat.R @@ -1,10 +1,3 @@ -#------------------------------------------------------------------------------- -# Copyright (c) 2012 University of Illinois, NCSA. All rights reserved. This -# program and the accompanying materials are made available under the terms of -# the University of Illinois/NCSA Open Source License which accompanies this -# distribution, and is available at -# http://opensource.ncsa.illinois.edu/license.html -#------------------------------------------------------------------------------- library(PEcAn.utils) library(PEcAn.settings) library(testthat) diff --git a/models/clm45/R/version.R b/models/clm45/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/models/clm45/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/models/dalec/R/version.R b/models/dalec/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/models/dalec/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/models/dvmdostem/R/version.R b/models/dvmdostem/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/models/dvmdostem/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/models/ed/DESCRIPTION b/models/ed/DESCRIPTION index 91181d1f474..308781f1a39 100644 --- a/models/ed/DESCRIPTION +++ b/models/ed/DESCRIPTION @@ -63,7 +63,7 @@ Suggests: Additional_repositories: https://pecanproject.r-universe.dev/ License: BSD_3_clause + file LICENSE Copyright: Authors -VignetteBuilder: knitr +VignetteBuilder: knitr, rmarkdown LazyData: true Encoding: UTF-8 RoxygenNote: 7.3.2 diff --git a/models/ed/R/version.R b/models/ed/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/models/ed/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/models/fates/R/version.R b/models/fates/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/models/fates/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/models/gday/R/version.R b/models/gday/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/models/gday/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/models/jules/R/version.R b/models/jules/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/models/jules/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/models/ldndc/R/version.R b/models/ldndc/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/models/ldndc/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/models/linkages/R/version.R b/models/linkages/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/models/linkages/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/models/lpjguess/R/version.R b/models/lpjguess/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/models/lpjguess/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/models/maat/DESCRIPTION b/models/maat/DESCRIPTION index 47d8001c379..ce1684852b2 100644 --- a/models/maat/DESCRIPTION +++ b/models/maat/DESCRIPTION @@ -23,7 +23,7 @@ SystemRequirements: MAAT OS_type: unix License: BSD_3_clause + file LICENSE Copyright: Authors -VignetteBuilder: knitr +VignetteBuilder: knitr, rmarkdown LazyLoad: yes LazyData: FALSE Encoding: UTF-8 diff --git a/models/maat/R/version.R b/models/maat/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/models/maat/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/models/maespa/R/version.R b/models/maespa/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/models/maespa/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/models/preles/R/version.R b/models/preles/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/models/preles/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/models/sibcasa/R/version.R b/models/sibcasa/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/models/sibcasa/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/models/sipnet/R/version.R b/models/sipnet/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/models/sipnet/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/models/stics/R/version.R b/models/stics/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/models/stics/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/models/template/R/version.R b/models/template/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/models/template/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/modules/allometry/DESCRIPTION b/modules/allometry/DESCRIPTION index f53cf4c06ec..c031dc02766 100644 --- a/modules/allometry/DESCRIPTION +++ b/modules/allometry/DESCRIPTION @@ -30,4 +30,4 @@ LazyLoad: yes LazyData: FALSE Encoding: UTF-8 RoxygenNote: 7.3.2 -VignetteBuilder: knitr +VignetteBuilder: knitr, rmarkdown diff --git a/modules/allometry/R/version.R b/modules/allometry/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/modules/allometry/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/modules/assim.batch/DESCRIPTION b/modules/assim.batch/DESCRIPTION index e94c946485b..6283791ace5 100644 --- a/modules/assim.batch/DESCRIPTION +++ b/modules/assim.batch/DESCRIPTION @@ -14,7 +14,7 @@ Description: The Predictive Ecosystem Carbon Analyzer (PEcAn) is a scientific model parameterization, execution, and analysis. The goal of PECAn is to streamline the interaction between data and models, and to improve the efficacy of scientific investigation. -VignetteBuilder: knitr +VignetteBuilder: knitr, rmarkdown Imports: abind, BayesianTools, diff --git a/modules/assim.batch/R/version.R b/modules/assim.batch/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/modules/assim.batch/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/modules/assim.sequential/R/version.R b/modules/assim.sequential/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/modules/assim.sequential/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/modules/benchmark/R/version.R b/modules/benchmark/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/modules/benchmark/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/modules/data.atmosphere/DESCRIPTION b/modules/data.atmosphere/DESCRIPTION index fceb2f2d7f1..ebfc9bbc639 100644 --- a/modules/data.atmosphere/DESCRIPTION +++ b/modules/data.atmosphere/DESCRIPTION @@ -69,6 +69,7 @@ Suggests: PEcAn.settings, progress, reticulate, + rmarkdown, testthat (>= 3.1.7), withr Remotes: @@ -80,6 +81,6 @@ License: BSD_3_clause + file LICENSE Copyright: Authors LazyLoad: yes LazyData: FALSE -VignetteBuilder: knitr +VignetteBuilder: knitr, rmarkdown Encoding: UTF-8 RoxygenNote: 7.3.2 diff --git a/modules/data.atmosphere/R/version.R b/modules/data.atmosphere/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/modules/data.atmosphere/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/modules/data.land/R/version.R b/modules/data.land/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/modules/data.land/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/modules/data.remote/R/version.R b/modules/data.remote/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/modules/data.remote/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/modules/emulator/R/version.R b/modules/emulator/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/modules/emulator/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/modules/meta.analysis/DESCRIPTION b/modules/meta.analysis/DESCRIPTION index b231707a04b..60ba579a6e4 100644 --- a/modules/meta.analysis/DESCRIPTION +++ b/modules/meta.analysis/DESCRIPTION @@ -42,7 +42,7 @@ Suggests: testthat (>= 1.0.2) SystemRequirements: JAGS License: BSD_3_clause + file LICENSE -VignetteBuilder: knitr +VignetteBuilder: knitr, rmarkdown Copyright: Authors LazyData: FALSE Encoding: UTF-8 diff --git a/modules/meta.analysis/R/version.R b/modules/meta.analysis/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/modules/meta.analysis/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/modules/photosynthesis/DESCRIPTION b/modules/photosynthesis/DESCRIPTION index 2605358e806..b101522ae90 100644 --- a/modules/photosynthesis/DESCRIPTION +++ b/modules/photosynthesis/DESCRIPTION @@ -34,10 +34,6 @@ License: BSD_3_clause + file LICENSE Copyright: Authors LazyLoad: yes LazyData: FALSE -Collate: - fitA.R - Licor.QC.R - plots.R Encoding: UTF-8 RoxygenNote: 7.3.2 -VignetteBuilder: knitr +VignetteBuilder: knitr, rmarkdown diff --git a/modules/photosynthesis/R/version.R b/modules/photosynthesis/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/modules/photosynthesis/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/modules/priors/DESCRIPTION b/modules/priors/DESCRIPTION index 39b066910ec..abfc6f2bb56 100644 --- a/modules/priors/DESCRIPTION +++ b/modules/priors/DESCRIPTION @@ -24,5 +24,5 @@ Suggests: rmarkdown, testthat Encoding: UTF-8 -VignetteBuilder: knitr +VignetteBuilder: knitr, rmarkdown RoxygenNote: 7.3.2 diff --git a/modules/priors/R/version.R b/modules/priors/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/modules/priors/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/modules/rtm/DESCRIPTION b/modules/rtm/DESCRIPTION index 2c86cb2ba8d..2be3ff4f0a8 100644 --- a/modules/rtm/DESCRIPTION +++ b/modules/rtm/DESCRIPTION @@ -37,6 +37,6 @@ Copyright: Authors LazyLoad: yes LazyData: FALSE Encoding: UTF-8 -VignetteBuilder: knitr +VignetteBuilder: knitr, rmarkdown Roxygen: list(markdown = TRUE) RoxygenNote: 7.3.2 diff --git a/modules/rtm/R/version.R b/modules/rtm/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/modules/rtm/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/modules/uncertainty/R/version.R b/modules/uncertainty/R/version.R new file mode 100644 index 00000000000..0e58d885272 --- /dev/null +++ b/modules/uncertainty/R/version.R @@ -0,0 +1,3 @@ +# Set at package install time, used by pecan.all::pecan_version() +# to identify development versions of packages +.build_hash <- Sys.getenv("PECAN_GIT_REV", "unknown") diff --git a/scripts/qsub_build.sh b/scripts/qsub_build.sh deleted file mode 100755 index bb2974543c1..00000000000 --- a/scripts/qsub_build.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -#PBS -N pecan-build.sh -#PBS -j oe -#PBS -S /bin/bash -#PBS -d /home/a-m/dlebauer/dev/pecan/ -#PBS -m abe -#PBS -e dlebauer+biocluster@gmail.com - -source ${HOME}/.profile - -${HOME}/dev/pecan/scripts/install.dependencies.R -${HOME}/dev/pecan/scripts/build.sh #--force --check --install --test