Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ For more information about this file see also [Keep a Changelog](http://keepacha
- Sensitivity analysis and ensemble runs now generate separate input design matrices with appropriate dimensions, fixing dimension mismatch errors in multisite workflows. (#3708)
- Generated runs are now stored in a `runs_manifest.csv` file in the output directory instead of modifying `samples.Rdata` (#3708)
- SDA workflows now maintain joint input sampling, via internal calls to `generate_joint_ensemble_design()` (#3634).
* `PEcAn.data.land`: Moved optional dependencies `doSNOW`, `dplR`, `httr`,
`MCMCpack`, `mvtnorm`, `neonUtilities`, `neonstore`, `PEcAn.benchmark`,
`PEcAn.visualization`, `rjags`, `sirt`, and `sp` from `Imports` to
`Suggests` (@omkarrr2533, #3599).



Expand Down
3 changes: 3 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ authors:
affiliation: CMR Institute of Technology, Bengaluru
- given-names: Aritra Dey
affiliation: National Institute of Technology, Tiruchirappalli
- given-names: Om Kapale
affiliation: Chatrapati Shahu Maharaj CSCOE, Maharashtra


preferred-citation:
type: article
Expand Down
24 changes: 12 additions & 12 deletions docker/depends/pecan_package_dependencies.csv
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
"doSNOW","*","base/utils","Suggests",FALSE
"doSNOW","*","modules/assim.sequential","Suggests",FALSE
"doSNOW","*","modules/data.atmosphere","Suggests",FALSE
"doSNOW","*","modules/data.land","Imports",FALSE
"doSNOW","*","modules/data.land","Suggests",FALSE
"doSNOW","*","modules/data.remote","Suggests",FALSE
"dplR","*","modules/data.land","Imports",FALSE
"dplR","*","modules/data.land","Suggests",FALSE
"dplyr","*","base/qaqc","Imports",FALSE
"dplyr","*","base/remote","Imports",FALSE
"dplyr","*","base/utils","Imports",FALSE
Expand Down Expand Up @@ -127,7 +127,7 @@
"here","*","base/db","Suggests",FALSE
"httr","*","base/remote","Imports",FALSE
"httr","*","modules/data.atmosphere","Imports",FALSE
"httr","*","modules/data.land","Imports",FALSE
"httr","*","modules/data.land","Suggests",FALSE
"httr","*","modules/data.remote","Suggests",FALSE
"IDPmisc","*","modules/assim.batch","Imports",FALSE
"itertools","*","modules/assim.sequential","Suggests",FALSE
Expand Down Expand Up @@ -201,7 +201,7 @@
"mclust","*","modules/rtm","Suggests",FALSE
"MCMCpack","*","modules/allometry","Imports",FALSE
"MCMCpack","*","modules/assim.batch","Imports",FALSE
"MCMCpack","*","modules/data.land","Imports",FALSE
"MCMCpack","*","modules/data.land","Suggests",FALSE
"MCMCpack","*","modules/emulator","Imports",FALSE
"methods","*","base/db","Imports",FALSE
"methods","*","base/settings","Depends",FALSE
Expand Down Expand Up @@ -229,7 +229,7 @@
"mvtnorm","*","modules/allometry","Imports",FALSE
"mvtnorm","*","modules/assim.batch","Imports",FALSE
"mvtnorm","*","modules/assim.sequential","Suggests",FALSE
"mvtnorm","*","modules/data.land","Imports",FALSE
"mvtnorm","*","modules/data.land","Suggests",FALSE
"mvtnorm","*","modules/emulator","Imports",FALSE
"ncdf4","*","base/db","Imports",FALSE
"ncdf4","*","models/basgra","Imports",FALSE
Expand Down Expand Up @@ -258,8 +258,8 @@
"ncdf4",">= 1.15","modules/benchmark","Imports",FALSE
"ncdf4",">= 1.15","modules/data.atmosphere","Imports",FALSE
"ncdf4",">= 1.15","modules/data.land","Imports",FALSE
"neonstore","*","modules/data.land","Imports",FALSE
"neonUtilities","*","modules/data.land","Imports",FALSE
"neonstore","*","modules/data.land","Suggests",FALSE
"neonUtilities","*","modules/data.land","Suggests",FALSE
"nimble","*","modules/assim.sequential","Imports",FALSE
"nneo","*","modules/data.atmosphere","Imports",FALSE
"optparse","*","base/settings","Imports",FALSE
Expand All @@ -272,7 +272,7 @@
"PEcAn.benchmark","*","base/all","Depends",TRUE
"PEcAn.benchmark","*","modules/assim.batch","Imports",TRUE
"PEcAn.benchmark","*","modules/assim.sequential","Suggests",TRUE
"PEcAn.benchmark","*","modules/data.land","Imports",TRUE
"PEcAn.benchmark","*","modules/data.land","Suggests",TRUE
"PEcAn.BIOCRO","*","base/all","Suggests",TRUE
"PEcAn.BIOCRO","*","base/qaqc","Suggests",TRUE
"PEcAn.DALEC","*","base/all","Suggests",TRUE
Expand Down Expand Up @@ -439,7 +439,7 @@
"PEcAn.utils",">= 1.4.8","models/template","Imports",TRUE
"PEcAn.utils",">= 1.8.0","models/rothc","Imports",TRUE
"PEcAn.visualization","*","modules/assim.sequential","Suggests",TRUE
"PEcAn.visualization","*","modules/data.land","Imports",TRUE
"PEcAn.visualization","*","modules/data.land","Suggests",TRUE
"PEcAn.visualization","*","modules/priors","Suggests",TRUE
"PEcAn.workflow","*","base/all","Depends",TRUE
"PEcAn.workflow","*","modules/assim.batch","Imports",TRUE
Expand Down Expand Up @@ -491,7 +491,7 @@
"reticulate","*","modules/data.remote","Imports",FALSE
"rjags","*","base/utils","Suggests",FALSE
"rjags","*","modules/assim.batch","Imports",FALSE
"rjags","*","modules/data.land","Imports",FALSE
"rjags","*","modules/data.land","Suggests",FALSE
"rjags","*","modules/meta.analysis","Imports",FALSE
"rjags","*","modules/photosynthesis","Depends",FALSE
"rjags","*","modules/priors","Suggests",FALSE
Expand Down Expand Up @@ -576,11 +576,11 @@
"sf","*","modules/data.land","Imports",FALSE
"sf","*","modules/data.remote","Suggests",FALSE
"SimilarityMeasures","*","modules/benchmark","Imports",FALSE
"sirt","*","modules/data.land","Imports",FALSE
"sirt","*","modules/data.land","Suggests",FALSE
"sp","*","base/visualization","Suggests",FALSE
"sp","*","modules/assim.sequential","Suggests",FALSE
"sp","*","modules/data.atmosphere","Imports",FALSE
"sp","*","modules/data.land","Imports",FALSE
"sp","*","modules/data.land","Suggests",FALSE
"sp","*","modules/data.remote","Imports",FALSE
"stats","*","base/qaqc","Imports",FALSE
"stats","*","models/rothc","Imports",FALSE
Expand Down
34 changes: 17 additions & 17 deletions modules/data.land/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,21 @@ Depends: R (>= 4.1.0)
Imports:
coda,
curl,
doSNOW,
dplyr,
dplR,
foreach,
fs,
future,
furrr,
httr,
lubridate,
magrittr,
MCMCpack,
mvtnorm,
ncdf4 (>= 1.15),
neonUtilities,
neonstore,
PEcAn.benchmark,
PEcAn.DB,
PEcAn.logger,
PEcAn.remote,
PEcAn.utils,
PEcAn.visualization,
purrr,
rjags,
rlang,
sf,
sirt,
sp,
stringr,
terra,
tidyr,
Expand All @@ -62,18 +50,30 @@ Imports:
Suggests:
dataone,
datapack,
jsonlite,
jsonvalidate,
doSNOW,
dplR,
getPass,
glue,
httr,
jsonlite,
jsonvalidate,
MASS,
MCMCpack,
mvtnorm,
neonUtilities,
neonstore,
PEcAn.benchmark,
PEcAn.settings,
redland,
PEcAn.visualization,
raster,
redland,
reticulate,
rjags,
sirt,
sp,
testthat (>= 3.1.0),
traits,
withr,
MASS
withr
Remotes:
github::ropensci/traits
License: BSD_3_clause + file LICENSE
Expand Down
5 changes: 4 additions & 1 deletion modules/data.land/NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
## Changed

* Package `traits`, used by `match_pft()` and `match_species_id()` only when no database connection is provided, is now suggested rather than required.

* Packages `doSNOW`, `dplR`, `httr`, `MCMCpack`, `mvtnorm`, `neonUtilities`,
`neonstore`, `PEcAn.benchmark`, `PEcAn.visualization`, `rjags`, `sirt`, and
`sp` are now suggested rather than required. They are only needed for
specific optional functionality. (#3599)
Comment thread
infotroph marked this conversation as resolved.

# PEcAn.data.land 1.9.0

Expand Down
6 changes: 5 additions & 1 deletion modules/data.land/R/IC_BADM_Utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,11 @@ EPA_ecoregion_finder <- function(Lat, Lon, folder.path = NULL){
U.S.SB.sp <-
data.frame(Lati = Lat %>% as.numeric(),
Long = Lon %>% as.numeric())

if (!requireNamespace("sp", quietly = TRUE)) {
PEcAn.logger::logger.severe(
"Package 'sp' is required for spatial data processing but is not installed.",
"Please install it with: install.packages('sp')")
}
sp::coordinates(U.S.SB.sp) <- ~ Long + Lati
# L1 layer
L1 <-
Expand Down
6 changes: 5 additions & 1 deletion modules/data.land/R/InventoryGrowthFusion.R
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,12 @@ model{


PEcAn.logger::logger.info("COMPILE JAGS MODEL")
if (!requireNamespace("rjags", quietly = TRUE)) {
PEcAn.logger::logger.severe(
"Package 'rjags' is required for JAGS model fitting but is not installed.",
"Please install it with: install.packages('rjags')")
}
Comment thread
infotroph marked this conversation as resolved.
j.model <- rjags::jags.model(file = textConnection(TreeDataFusionMV), data = data, inits = init, n.chains = 3)

if(n.burn > 0){
PEcAn.logger::logger.info("BURN IN")
jags.out <- rjags::coda.samples(model = j.model,
Expand Down
8 changes: 6 additions & 2 deletions modules/data.land/R/InventoryGrowthFusionDiagnostics.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
##' @author Michael Dietze
##' @export
InventoryGrowthFusionDiagnostics <- function(jags.out, combined=NULL) {

out <- as.matrix(jags.out)
if (!requireNamespace("PEcAn.visualization", quietly = TRUE)) {
PEcAn.logger::logger.severe(
"Package 'PEcAn.visualization' is required for diagnostic plots but is not installed.",
"Please install it via the PEcAn project: https://github.com/PecanProject/pecan")
}
out <- as.matrix(jags.out)
x.cols <- which(substr(colnames(out), 1, 1) == "x")
if(length(x.cols) > 0){
ci <- apply(out[, x.cols], 2, stats::quantile, c(0.025, 0.5, 0.975))
Expand Down
7 changes: 6 additions & 1 deletion modules/data.land/R/Read_Tuscon.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,15 @@ Read_Tucson <- function(folder) {
if (length(corrected) > 0) {
filenames <- filenames[-corrected]
}
if (!requireNamespace("dplR", quietly = TRUE)) {
PEcAn.logger::logger.severe(
"Package 'dplR' is required for reading Tucson format files but is not installed.",
"Please install it with: install.packages('dplR')")
}
filedata <- list()
for (file in filenames) {
file <- Clean_Tucson(file)
filedata[[file]] <- dplR::read.tucson(file, header = FALSE)
filedata[[file]] <- dplR::read.tucson(file, header = FALSE)
}

return(filedata)
Expand Down
7 changes: 6 additions & 1 deletion modules/data.land/R/download_NEON_soilmoisture.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ download_NEON_soilmoist <- function(site, avg = "all", var = "all",
outdir) {


#################### Data Download from NEON ####################
if (!requireNamespace("neonUtilities", quietly = TRUE)) {
PEcAn.logger::logger.severe(
"Package 'neonUtilities' is required for downloading NEON soil moisture data but is not installed.",
"Please install it with: install.packages('neonUtilities')")
}
#################### Data Download from NEON ####################
soil.raw = neonUtilities::loadByProduct(dpID = "DP1.00094.001", site = site, avg = avg, startdate = startdate, enddate = enddate, check.size = FALSE)

# Export into new folder in outdir
Expand Down
6 changes: 5 additions & 1 deletion modules/data.land/R/extract_NEON_veg.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
#' start_date = as.Date("2020-01-01")
#' end_date = as.Date("2021-09-01")
extract_NEON_veg <- function(lon, lat, start_date, end_date, store_dir, neonsites = NULL, ...){

if (!requireNamespace("neonstore", quietly = TRUE)) {
PEcAn.logger::logger.severe(
"Package 'neonstore' is required for extracting NEON vegetation data but is not installed.",
"Please install it with: install.packages('neonstore')")
}
#Function to grab the first measurements for each plot between start and end date.
Grab_First_Measurements_of_Each_Plot <- function(temp_data){
Plot_Year <- paste0(temp_data$plot, temp_data$year)
Expand Down
5 changes: 5 additions & 0 deletions modules/data.land/R/extract_SM_CDS.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ extract_SM_CDS <- function(site_info,
out.path = NULL,
allow.download = TRUE,
search_window = 10){
if (!requireNamespace("sp", quietly = TRUE)) {
PEcAn.logger::logger.severe(
"Package 'sp' is required for spatial data processing but is not installed.",
"Please install it with: install.packages('sp')")
}
#find downloaded files and the corresponding dates.
ncfiles <- base::list.files(in.path, full.names = T)
available.dates <- ncfiles %>% purrr::map(function(file){
Expand Down
11 changes: 7 additions & 4 deletions modules/data.land/R/extract_soil_nc.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
#' @export
#'
extract_soil_gssurgo <- function(outdir, lat, lon, size=1, grid_size=3, grid_spacing=100, depths=c(0.15,0.30,0.60)){
if (!requireNamespace("sirt", quietly = TRUE)) {
PEcAn.logger::logger.severe(
"Package 'sirt' is required for Dirichlet distribution functions but is not installed.",
"Please install it with: install.packages('sirt')")
}
# I keep all the ensembles here
all.soil.ens <-list()

Expand Down Expand Up @@ -250,13 +255,11 @@ extract_soil_gssurgo <- function(outdir, lat, lon, size=1, grid_size=3, grid_spa
split(list(soilprop.new.grouped$DepthL, soilprop.new.grouped$mukey)) %>%
purrr::map_df(function(DepthL.Data){
tryCatch({
# I model the soil properties for this depth
dir.model <-DepthL.Data[,c(1:3)] %>%
dir.model <- DepthL.Data[,c(1:3)] %>%
as.matrix() %>%
sirt::dirichlet.mle(.)
# Monte Carlo sampling based on my dirichlet model
alpha <- dir.model$alpha
alpha <- matrix(alpha, nrow= size, ncol=length(alpha), byrow=TRUE )
alpha <- matrix(alpha, nrow= size, ncol=length(alpha), byrow=TRUE)
simulated.soil <- sirt::dirichlet.simul(alpha)
# Validate SOC data before processing
if (any(is.na(DepthL.Data$soil_organic_carbon_stock))) {
Expand Down
5 changes: 5 additions & 0 deletions modules/data.land/R/gSSURGO_Query.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ gSSURGO.Query <- function(mukeys,
</soap:Body>
</soap:Envelope>')

if (!requireNamespace("httr", quietly = TRUE)) {
PEcAn.logger::logger.severe(
"Package 'httr' is required for gSSURGO queries but is not installed.",
"Please install it with: install.packages('httr')")
}
out <- httr::POST(
url = "https://SDMDataAccess.nrcs.usda.gov/Tabular/SDMTabularService.asmx",
config = list(
Expand Down
5 changes: 5 additions & 0 deletions modules/data.land/R/load_veg.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ load_veg <- function(new_site, start_date, end_date,
# query format info
format <- PEcAn.DB::query.format.vars(bety = con, input.id = source_id)

if (!requireNamespace("PEcAn.benchmark", quietly = TRUE)) {
PEcAn.logger::logger.severe(
"Package 'PEcAn.benchmark' is required for loading vegetation data but is not installed.",
"Please install it with: install.packages('PEcAn.benchmark')")
}
Comment thread
infotroph marked this conversation as resolved.
# load_data{benchmark}
obs <- PEcAn.benchmark::load_data(data.path = data_path, format, site = new_site)

Expand Down
8 changes: 6 additions & 2 deletions modules/data.land/R/matchInventoryRings.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
#'
##' @export
matchInventoryRings <- function(trees, rings, extractor = "TreeCode", nyears = 30, coredOnly = TRUE) {

if (!requireNamespace("dplR", quietly = TRUE)) {
PEcAn.logger::logger.severe(
"Package 'dplR' is required for tree ring processing but is not installed.",
"Please install it with: install.packages('dplR')")
}
## build tree codes
id.build <- function(x) {
do.call(paste0("to.", extractor), x)
Expand All @@ -19,7 +23,7 @@ matchInventoryRings <- function(trees, rings, extractor = "TreeCode", nyears = 3
## build tree ring codes
if (is.list(rings)) {
ring.file <- rep(names(rings), times = sapply(rings, ncol))
rings <- dplR::combine.rwl(rings)
rings <- dplR::combine.rwl(rings)
}
ring.ID <- names(rings)
id.extract <- function(x) {
Expand Down
5 changes: 5 additions & 0 deletions modules/data.land/R/plot2AGB.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ plot2AGB <- function(combined, out, outfolder, allom.stats, unit.conv = 0.02) {
biomass_thoc2 <- array(NA, c(mplot, nrep, nt))

## sample over tree chronologies
if (!requireNamespace("mvtnorm", quietly = TRUE)) {
PEcAn.logger::logger.severe(
"Package 'mvtnorm' is required for multivariate normal sampling but is not installed.",
"Please install it with: install.packages('mvtnorm')")
}
pb <- utils::txtProgressBar(min = 0, max = nrep, style = 3)
for (g in seq_len(nrep)) {

Expand Down
Loading
Loading