Skip to content

Commit

Permalink
Merge pull request #3237 from infotroph/check-on-newer-R
Browse files Browse the repository at this point in the history
Misc fixes found when running package checks on newer releases of R
  • Loading branch information
infotroph authored Feb 21, 2024
2 parents ea75942 + 29b7108 commit 6b22467
Show file tree
Hide file tree
Showing 77 changed files with 594 additions and 1,279 deletions.
2 changes: 1 addition & 1 deletion Makefile.depends
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ $(call depends,modules/data.hydrology): | .install/base/logger .install/base/uti
$(call depends,modules/data.land): | .install/base/db .install/base/logger .install/base/remote .install/base/settings .install/base/utils .install/base/visualization .install/modules/benchmark .install/modules/data.atmosphere
$(call depends,modules/data.remote): | .install/base/db .install/base/logger .install/base/remote .install/base/utils
$(call depends,modules/meta.analysis): | .install/base/db .install/base/logger .install/base/settings .install/base/utils
$(call depends,modules/priors): | .install/base/logger .install/base/utils .install/base/visualization .install/modules/meta.analysis
$(call depends,modules/priors): | .install/base/logger .install/base/visualization .install/modules/meta.analysis
$(call depends,modules/rtm): | .install/base/logger .install/base/utils .install/models/ed .install/modules/assim.batch
$(call depends,modules/uncertainty): | .install/base/db .install/base/logger .install/base/settings .install/base/utils .install/modules/emulator .install/modules/priors
6 changes: 3 additions & 3 deletions base/db/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Authors@R: c(person("David", "LeBauer", role = c("aut", "cre"),
person("Chris", "Black", role = c("aut"),
email = "[email protected]"),
person("Liam", "Burke", role = c("aut"),
email = "[email protected]>"),
email = "[email protected]"),
person("Ryan", "Kelly", role = c("aut"),
email = "[email protected]"),
person("Dan", "Wang", role = c("aut")),
Expand All @@ -43,8 +43,8 @@ Description: The Predictive Ecosystem Carbon Analyzer (PEcAn) is a scientific
Imports:
curl,
DBI,
dbplyr,
dplyr,
dbplyr (>= 2.4.0),
dplyr (>= 1.1.2),
fs,
glue,
lubridate,
Expand Down
2 changes: 1 addition & 1 deletion base/db/man/PEcAn.DB-package.Rd

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

7 changes: 3 additions & 4 deletions base/remote/R/merge_job_files.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#' merge_job_files
#' Merge multiple job.sh files into one larger file.
#'
#' @param settings PEcAn.settings object with host section.
#' @param jobs_per_file the number of files you want to merge.
#' @param outdir output directory of merged job files.
#'
#' @return
#' @return vector of the newly created filenames
#' @export
#' @author Dongchen Zhang
#'
#' @examples
merge_job_files <- function(settings, jobs_per_file = 10, outdir = NULL){
# default outdir
if(is.null(outdir)){
Expand Down Expand Up @@ -39,4 +38,4 @@ merge_job_files <- function(settings, jobs_per_file = 10, outdir = NULL){
i <- i + jobs_per_file
}
files
}
}
7 changes: 4 additions & 3 deletions base/remote/man/merge_job_files.Rd

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

2 changes: 1 addition & 1 deletion base/utils/R/mcmc.list2init.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ mcmc.list2init <- function(dat) {

## define variables
ic <- list()
n <- nrow(dat[[1]])
nr <- nrow(dat[[1]])
nc <- coda::nchain(dat)
for(c in seq_len(nc)) ic[[c]] <- list()

Expand Down
6 changes: 2 additions & 4 deletions docker/depends/pecan_package_dependencies.csv
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,13 @@
"DBI","*","base/db","Imports",FALSE
"DBI","*","modules/assim.sequential","Suggests",FALSE
"DBI","*","modules/data.remote","Imports",FALSE
"dbplyr","*","base/db","Imports",FALSE
"dbplyr","*","modules/benchmark","Imports",FALSE
"dbplyr",">= 2.4.0","base/db","Imports",FALSE
"devtools","*","models/ed","Suggests",FALSE
"doParallel","*","modules/data.atmosphere","Suggests",FALSE
"doParallel","*","modules/data.remote","Imports",FALSE
"doSNOW","*","base/remote","Suggests",FALSE
"dplR","*","modules/data.land","Imports",FALSE
"dplyr","*","base/db","Imports",FALSE
"dplyr","*","base/qaqc","Imports",FALSE
"dplyr","*","base/remote","Imports",FALSE
"dplyr","*","base/utils","Imports",FALSE
Expand All @@ -62,6 +61,7 @@
"dplyr","*","modules/data.land","Imports",FALSE
"dplyr","*","modules/data.remote","Suggests",FALSE
"dplyr","*","modules/uncertainty","Imports",FALSE
"dplyr",">= 1.1.2","base/db","Imports",FALSE
"ellipse","*","modules/assim.batch","Imports",FALSE
"emdbook","*","modules/assim.sequential","Suggests",FALSE
"foreach","*","base/remote","Imports",FALSE
Expand Down Expand Up @@ -401,7 +401,6 @@
"PEcAn.utils","*","modules/data.land","Imports",TRUE
"PEcAn.utils","*","modules/data.remote","Imports",TRUE
"PEcAn.utils","*","modules/meta.analysis","Imports",TRUE
"PEcAn.utils","*","modules/priors","Imports",TRUE
"PEcAn.utils","*","modules/rtm","Suggests",TRUE
"PEcAn.utils","*","modules/uncertainty","Imports",TRUE
"PEcAn.utils",">= 1.4.8","models/basgra","Imports",TRUE
Expand Down Expand Up @@ -551,7 +550,6 @@
"stringr",">= 1.1.0","base/visualization","Imports",FALSE
"stringr",">= 1.1.0","models/ed","Imports",FALSE
"stringr",">= 1.1.0","modules/data.atmosphere","Imports",FALSE
"stringr",">= 1.1.0","modules/data.remote","Imports",FALSE
"suntools","*","modules/data.atmosphere","Imports",FALSE
"swfscMisc","*","modules/data.land","Imports",FALSE
"terra","*","modules/data.atmosphere","Imports",FALSE
Expand Down
2 changes: 1 addition & 1 deletion models/ed/R/other.helpers.ED2.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' @title List only files in a directory
#' List only files in a directory
#'
#' Mostly useful when `recursive` and `full.names` are both FALSE:
#' The current implementation sets `full.names` internally, and for recursive
Expand Down
8 changes: 1 addition & 7 deletions models/ed/man/list.files.nodir.Rd

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

5 changes: 1 addition & 4 deletions models/sipnet/R/veg2model.SIPNET.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#' veg2model.SIPNET
#' @name veg2model.SIPNET
#' @title veg2model.SIPNET
#'
#' veg2model.SIPNET
#'
#' @param outfolder location to store ncdf files
#' @param poolinfo object passed from write_ic contains output from cohort2pool function
Expand Down
1 change: 0 additions & 1 deletion modules/data.atmosphere/R/ERA5_met_process.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#' @author Dongchen Zhang
#' @importFrom magrittr %>%
#'
#' @examples
ERA5_met_process <- function(settings, in.path, out.path, write.db=FALSE, write = TRUE){
#Initialize the multicore computation.
if (future::supportsMulticore()) {
Expand Down
6 changes: 2 additions & 4 deletions modules/data.atmosphere/R/download.FACE.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
##' Download Raw FACE data from the internet
##'
##' @name download.FACE
##' @title download.FACE
##' @export
##'
##' @param sitename sitename
##' @param outfolder location where output is stored
Expand All @@ -12,8 +9,9 @@
##' @param end_date desired end date YYYY-MM-DD
##' @param overwrite overwrite existing files? Default is FALSE
##' @param ... other inputs
##'
##'
##' @author Betsy Cowdery
##' @export
download.FACE <- function(sitename, outfolder, start_date, end_date, overwrite = FALSE, method, ...) {
# download.FACE <-
# function(data.set,outfolder,pkg,raw.host,start_year,end_year,site.id,dbparams,con){
Expand Down
1 change: 0 additions & 1 deletion modules/data.atmosphere/R/half_hour_downscale.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#'
#' @export
#'
#' @examples
temporal_downscale_half_hour <- function(input_file, output_file, overwrite = TRUE, hr = 0.5){

# open netcdf
Expand Down
18 changes: 8 additions & 10 deletions modules/data.atmosphere/R/met.process.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
##' @name met.process
##' @title met.process
##'
##' met.process
##'
##' @param site Site info from settings file
##' @param input_met Which data source to process.
Expand Down Expand Up @@ -556,19 +554,19 @@ browndog.met <- function(browndog, source, site, start_date, end_date, model, di

#################################################################################################################################

##' @name site_from_tag
##' @title site_from_tag
##' @export
##' @param sitename
##' @param tag
##' @author Betsy Cowdery
##'
##' Function to find the site code for a specific tag
##'
##' Example:
##' sitename = 'Rhinelander Aspen FACE Experiment (FACE-RHIN)'
##' tag = 'FACE'
##' site_from_tag(sitename,tag) = 'RHIN'
##' Requires that site names be set up specifically with (tag-sitecode) - this may change
##'
##' @param sitename full name of site
##' @param tag abbreviated name of site
##' @author Betsy Cowdery
##'
##' @export
site_from_tag <- function(sitename, tag) {
temp <- regmatches(sitename, gregexpr("(?<=\\().*?(?=\\))", sitename, perl = TRUE))[[1]]
pref <- paste0(tag, "-")
Expand Down
7 changes: 3 additions & 4 deletions modules/data.atmosphere/R/met.process.stage.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
##' @name met.process.stage
##' @title met.process.stage
##' met.process.stage
##' @export
##'
##' @param input.id
##' @param raw.id
##' @param input.id bety db for input format
##' @param raw.id format id for the raw met data
##' @param con database connection
##'
##' @author Elizabeth Cowdery
Expand Down
30 changes: 22 additions & 8 deletions modules/data.atmosphere/R/met2CF.FACE.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
##' convert FACE files to CF files
##' @export
##'
##' @param in.path
##' @param in.prefix
##' @param outfolder
##' @author Elizabeth Cowdery

#' convert FACE files to CF files
#'
#' Note: `in.path` and `in.prefix` together must identify exactly one file,
#' or this function returns NULL.
#' Further note that despite its name, `in.prefix` will match anywhere in
#' the filename: met2CF.FACE("dir", "a", ...)` will find both `dir/a_b.nc`
#' and `dir/b_a.nc`!
#'
#' @param in.path directory in which to find inputs (as `*.nc`)
#' @param in.prefix pattern to match to select a file within `in.path`
#'
#' @param outfolder path to write output.
#' Should contain the substring "FACE", which will be rewritten to "FACE_a" and "FACE_e"
#' for the corresponding treatments.
#' @param start_date,end_date ignored. Time is taken from the input files.
#' @param input.id ignored
#' @param site list[like]. Only components `lat` and `lon` (both in decimal degrees) are currently used
#' @param format specification of variable names and units in the format returned by `PEcAn.DB::query.format.vars`
#' @param ... other arguments, currently ignored
#' @author Elizabeth Cowdery
#'
#' @export
met2CF.FACE <- function(in.path,in.prefix,outfolder,start_date,end_date,input.id,site,format, ...) {

files <- dir(in.path, in.prefix)
Expand Down
12 changes: 6 additions & 6 deletions modules/data.atmosphere/R/met2CF.NARR.R
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
##' Convert NARR files to CF files
##' @name met2CF.NARR
##' @title met2CF.NARR
##' @export
##'
##' @param in.path
##' @param in.prefix
##' @param outfolder
##' @param in.path directory in which to find NARR files
##' @param in.prefix pattern to match to find NARR files inside `in.path`
##' @param outfolder directory name to write CF outputs
##' @param start_date the start date of the data to be downloaded (will only use the year part of the date)
##' @param end_date the end date of the data to be downloaded (will only use the year part of the date)
##' @param overwrite should existing files be overwritten
##' @param verbose should ouput of function be extra verbose
##' @param ... other arguments, currently ignored
##'
##' @author Elizabeth Cowdery, Rob Kooper
##' @export
met2CF.NARR <- function(in.path, in.prefix, outfolder, start_date, end_date,
overwrite = FALSE, verbose = FALSE, ...) {

Expand Down
Loading

0 comments on commit 6b22467

Please sign in to comment.