Skip to content

Commit

Permalink
Merge branch 'develop' into memoize-commit-at-build-time
Browse files Browse the repository at this point in the history
  • Loading branch information
infotroph authored Nov 1, 2024
2 parents 83af3ed + 5970ffd commit edd24b0
Show file tree
Hide file tree
Showing 76 changed files with 861 additions and 1,187 deletions.
3 changes: 3 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
- [ ] 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.
Expand Down
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
32 changes: 3 additions & 29 deletions base/utils/LICENSE
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions base/utils/NEWS.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
5 changes: 3 additions & 2 deletions base/utils/R/Defunct.R
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion base/utils/R/cf2date.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ datetime2doy <- function(datetime, tz = "UTC") {
#'
#' @author Alexey Shiklomanov
#'
cf2doy <- function(value, unit, tz = "UTC") datetime2doy(cf2datetime(value, unit, tz), tz)
cf2doy <- function(value, unit, tz = "UTC") datetime2doy(cf2datetime(value, unit, tz), tz)
30 changes: 10 additions & 20 deletions base/utils/R/clear.scratch.R
Original file line number Diff line number Diff line change
@@ -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
Expand Down
42 changes: 22 additions & 20 deletions base/utils/R/distn.stats.R
Original file line number Diff line number Diff line change
@@ -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") {
Expand Down Expand Up @@ -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))) {
Expand Down
42 changes: 20 additions & 22 deletions base/utils/R/download.url.R
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
34 changes: 12 additions & 22 deletions base/utils/R/full.path.R
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
22 changes: 12 additions & 10 deletions base/utils/R/get.ensemble.inputs.R
Original file line number Diff line number Diff line change
@@ -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){

Expand Down
77 changes: 42 additions & 35 deletions base/utils/R/help.R
Original file line number Diff line number Diff line change
@@ -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"
16 changes: 8 additions & 8 deletions base/utils/R/listToArgString.R
Original file line number Diff line number Diff line change
@@ -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 <- ""
Expand Down
Loading

0 comments on commit edd24b0

Please sign in to comment.