Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge v2.1.3 into biomodelos #437

Merged
merged 27 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f7ef4e6
fixed FAIL in test_occs_queryDB
bjohnso005 Feb 28, 2024
a57fd44
fixed bug w/ error msgs for xfer_time
bjohnso005 Feb 28, 2024
b2dbe0f
fixed broken link in v1 vignette
bjohnso005 Feb 28, 2024
a64223e
updates to team members
bjohnso005 Feb 28, 2024
8b2549f
added AP
bjohnso005 Feb 28, 2024
4bdadab
team updates: added dani photo; reduced file sizes
bjohnso005 Mar 6, 2024
11fb289
markdown fix
bjohnso005 Mar 8, 2024
82329f4
[v2.1.2] Fixed FAIL in test_occs_queryDB; bug w/ error msgs for xfer_…
bjohnso005 Mar 8, 2024
8bdb0e7
[v2.1.2]
bjohnso005 Mar 8, 2024
b4ea6c4
Added `occs.sel` to the return() in the `poccs_selectOccs` function. …
mlammens Mar 12, 2024
45bbf6d
Merge pull request #417 from bjohnso005/BAJdev
danflop Mar 18, 2024
a81510f
Merge pull request #418 from mlammens/master
bjohnso005 Apr 11, 2024
661fab9
updated version # and added news [v2.1.3_draft]
bjohnso005 Jul 10, 2024
da47b90
add Results tab msg to bioclim envelope plots
bjohnso005 Jul 10, 2024
111a867
fixed typos
bjohnso005 Jul 10, 2024
c98f965
updated JK email
bjohnso005 Jul 10, 2024
fe7d3ae
add model to file name when saving; Fixes #406
bjohnso005 Jul 10, 2024
0a89862
DL Fix: Response curves code can now be added to session code file
bjohnso005 Jul 10, 2024
5cc995e
warning instead of error with userEnvs NA values; fixed disable_modul…
bjohnso005 Jul 16, 2024
0c2a4dd
replace `raster::getdata()` with `geodata::` for envs_worldclim; upda…
bjohnso005 Jul 16, 2024
aa3e875
replace `raster::getdata()` with `geodata::` for xfer_time; update GT…
bjohnso005 Jul 17, 2024
76885f2
trycatch for worldclim data
bjohnso005 Jul 17, 2024
57ec6fa
predictor variable bug fix in vis_responsePlot Rmd
bjohnso005 Jul 17, 2024
104317c
fixed warnings with tidyselect
bjohnso005 Jul 18, 2024
622e8a0
team updates [v2.1.3]
bjohnso005 Jul 18, 2024
259a5a8
Merge pull request #436 from bjohnso005/2.1.3_draft
danflop Jul 19, 2024
b723597
merge v2.1.3 into biomodelos (now v2024.08.02)
bjohnso005 Aug 2, 2024
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
41 changes: 22 additions & 19 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: wallace
Version: 2024.02.23
Date: 2024-02-23
Version: 2024.08.02
Date: 2024-08-02
Title: A Modular Platform for Reproducible Modeling of Species Niches
and Distributions
Description: The 'shiny' application Wallace is a modular platform for
Expand All @@ -12,24 +12,24 @@ Description: The 'shiny' application Wallace is a modular platform for
most package functionality can be found on the package's GitHub Pages
website: <https://wallaceecomod.github.io/wallace/articles/tutorial-v2.html>.
Authors@R:
c(person("Jamie M.", "Kass", email = "[email protected]", role = "aut"),
c(person("Bethany A.", "Johnson", email = "[email protected]", role = "aut"),
person("Jamie M.", "Kass", email = "[email protected]", role = "aut"),
person("Gonzalo E.", "Pinilla-Buitrago", email = "[email protected]", role = "aut"),
person("Andrea", "Paz", email = "[email protected]", role = "aut"),
person("Bethany A.", "Johnson", email = "[email protected]", role = "aut"),
person("Valentina", "Grisales-Betancur", email = "[email protected]", role = "aut"),
person("Dean", "Attali", email = "[email protected]", role = "aut"),
person("Matthew E.", "Aiello-Lammens", email = "[email protected]", role = "aut"),
person("Cory", "Merow", email = "[email protected]", role = "aut"),
person("Mary E.", "Blair", email = "[email protected]", role = c("aut", "cre")),
person("Robert P.", "Anderson", email = "[email protected]", role = "aut"),
person("Sarah I.", "Meenan", email = "[email protected]", role = "ctb"),
person("Olivier", "Broennimann", email = "[email protected]", role = "ctb"),
person("Peter J.", "Galante", email = "[email protected]", role = "ctb"),
person("Brian S.", "Maitner", email = "[email protected]", role = "ctb"),
person("Hannah L.", "Owens", email = "[email protected]", role = "ctb"),
person("Sara", "Varela", email = "[email protected]", role = "ctb"),
person("Bruno", "Vilela", email = "[email protected]", role = "ctb"),
person("Robert", "Muscarella", email = "[email protected]", role = "ctb"))
person("Andrea", "Paz", email = "[email protected]", role = "aut"),
person("Valentina", "Grisales-Betancur", email = "[email protected]", role = "aut"),
person("Dean", "Attali", email = "[email protected]", role = "aut"),
person("Matthew E.", "Aiello-Lammens", email = "[email protected]", role = "aut"),
person("Cory", "Merow", email = "[email protected]", role = "aut"),
person("Mary E.", "Blair", email = "[email protected]", role = c("aut", "cre")),
person("Robert P.", "Anderson", email = "[email protected]", role = "aut"),
person("Sarah I.", "Meenan", email = "[email protected]", role = "ctb"),
person("Olivier", "Broennimann", email = "[email protected]", role = "ctb"),
person("Peter J.", "Galante", email = "[email protected]", role = "ctb"),
person("Brian S.", "Maitner", email = "[email protected]", role = "ctb"),
person("Hannah L.", "Owens", email = "[email protected]", role = "ctb"),
person("Sara", "Varela", email = "[email protected]", role = "ctb"),
person("Bruno", "Vilela", email = "[email protected]", role = "ctb"),
person("Robert", "Muscarella", email = "[email protected]", role = "ctb"))
Depends:
R (>= 3.5.0),
shiny (>= 1.6.0),
Expand All @@ -40,11 +40,14 @@ Imports:
DT (>= 0.5),
ecospat (>= 4.0.0),
ENMeval (>= 2.0.3),
geodata,
knitcitations,
leafem,
leaflet.extras (>= 1.0.0),
magrittr,
maskRangeR,
markdown,
methods,
RColorBrewer,
rJava,
rlang,
Expand Down
21 changes: 21 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
wallace 2.1.3
=============
- Fixed NULL error in poccs_selectOccs Rmd code
- Updated JK's email
- Added model name (FC + RM) to file name when prediction downloaded
- Fixed vis_responsePlot knitting to Rmd
- Fixed predictor variable bug in vis_responsePlot Rmd
- Fixed NA value warning in userEnvs
- Fixed broken function to disable `xfer_time` when using `envs_userEnvs`
- Replaced `raster::getdata` with `geodata` functions
- WorldClim v2.1 bioclimatic variables now available for Envs & Xfer_time!
- Added tryCatch for querying worldclim data (envs_wc & xfer_time)

wallace 2.1.2
=============
- Fixed FAIL in test_occs_queryDB
- Fixed bug in error msgs for xfer_time
- Fixed broken link in v1 vignette
- Added `markdown` to imports
- Updated team members

wallace 2.1.1
=============
- Fixed bug in occ density grid & niche overlap
Expand Down
41 changes: 32 additions & 9 deletions R/envs_worldclim.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Wallace EcoMod: a flexible platform for reproducible modeling of
# species niches and distributions.
#
#
# envs_worldclim.R
# File author: Wallace EcoMod Dev Team. 2023.
# --------------------------------------------------------------------------
Expand Down Expand Up @@ -53,8 +53,9 @@
#'
#' @author Jamie Kass <jamie.m.kass@@gmail.com>
#' @author Gonzalo E. Pinilla-Buitrago <gepinillab@@gmail.com>
#' @author Bethany A. Johnson <bjohnso005@@citymail.cuny.edu>
#'
#' @seealso \code{\link[raster]{getData}}
#' @seealso \code{\link[geodata]{worldclim_global}}, \code{\link[geodata]{worldclim_tile}}
#'
#' @export

Expand All @@ -66,20 +67,42 @@ envs_worldclim <- function(bcRes, bcSel, mapCntr, doBrick = FALSE,
}

smartProgress(logger, message = "Retrieving WorldClim data...", {
wcbc <- raster::getData(name = "worldclim", var = "bio", res = bcRes,
lon = mapCntr[1], lat = mapCntr[2])
# change names if bio01 is bio1, and so forth
if (bcRes == 0.5) {
names(wcbc) <- gsub("_.*", "", names(wcbc))
}
if (bcRes == 0.5) {
wcbc <- tryCatch(expr = geodata::worldclim_tile(var = "bio",
lon = mapCntr[1], lat = mapCntr[2],
path = tempdir(),
version="2.1"),
error = function(e) NULL)
} else {
wcbc <- tryCatch(expr = geodata::worldclim_global(var = "bio",
res = bcRes,
path = tempdir(),
version = "2.1"),
error= function(e) NULL)
}
#trycatch error
if (is.null(wcbc)) {
logger %>% writeLog(
type = "error",
paste0("Unable to retrieve data from WorldClim.
Server may be down.
Please use User-Specified module instead."))
return()
} else {
# change names to bioXX
names(wcbc) <- gsub(".*_", "bio", names(wcbc))
# change names if bio01 is bio1, and so forth
i <- grep('bio[0-9]$', names(wcbc))
editNames <- paste('bio', sapply(strsplit(names(wcbc)[i], 'bio'),
function(x) x[2]), sep = '0')
names(wcbc)[i] <- editNames

wcbc <- wcbc[[bcSel]]
}
})

# convert from spatraster to raster
wcbc <- raster::stack(wcbc)

# convert to brick for faster processing
if(doBrick == TRUE) {
smartProgress(logger,
Expand Down
3 changes: 2 additions & 1 deletion R/helper_functions.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Wallace EcoMod: a flexible platform for reproducible modeling of
# species niches and distributions.
#
#
# helper_functions.R
# File author: Wallace EcoMod Dev Team. 2023.
# --------------------------------------------------------------------------
Expand Down Expand Up @@ -74,6 +74,7 @@ spurious <- function(x) {
RColorBrewer::brewer.pal(x)
leafem::addMouseCoordinates(x)
leaflet.extras::removeDrawToolbar(x)
markdown::html_format()
rmarkdown::github_document(x)
shinyWidgets::pickerInput(x)
shinyjs::disable(x)
Expand Down
8 changes: 4 additions & 4 deletions R/model_bioclim.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Wallace EcoMod: a flexible platform for reproducible modeling of
# species niches and distributions.
#
#
# model_bioclim.R
# File author: Wallace EcoMod Dev Team. 2023.
# --------------------------------------------------------------------------
Expand Down Expand Up @@ -61,7 +61,7 @@
#' @return Function returns an ENMevaluate object with all the evaluated models
#' and a selection of appropriate fields.

#' @author Jamie M. Kass <jkass@@gradcenter.cuny.edu>
#' @author Jamie M. Kass <jamie.m.kass@@gmail.com>
#' @author Gonzalo E. Pinilla-Buitrago <gepinillab@@gmail.com>
# @note

Expand All @@ -73,8 +73,8 @@ model_bioclim <- function(occs, bg, user.grp, bgMsk, logger = NULL,
spN = NULL) {

# get just coordinates
occs.xy <- occs %>% dplyr::select(.data$longitude, .data$latitude)
bg.xy <- bg %>% dplyr::select(.data$longitude, .data$latitude)
occs.xy <- occs %>% dplyr::select("longitude", "latitude")
bg.xy <- bg %>% dplyr::select("longitude", "latitude")

smartProgress(logger,
message = paste0("Building/Evaluating BIOCLIM model for ",
Expand Down
8 changes: 4 additions & 4 deletions R/model_maxent.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Wallace EcoMod: a flexible platform for reproducible modeling of
# species niches and distributions.
#
#
# model_maxent.R
# File author: Wallace EcoMod Dev Team. 2023.
# --------------------------------------------------------------------------
Expand Down Expand Up @@ -83,7 +83,7 @@
#'
#' @return Function returns an ENMevaluate object with all the evaluated models
#' and a selection of appropriate fields.
#' @author Jamie M. Kass <jkass@@gradcenter.cuny.edu>
#' @author Jamie M. Kass <jamie.m.kass@@gmail.com>
#' @author Gonzalo E. Pinilla-Buitrago <gepinillab@@gmail.com>
# @note

Expand Down Expand Up @@ -189,8 +189,8 @@ model_maxent <- function(occs, bg, user.grp, bgMsk, rms, rmsStep, fcs,
}

# get just coordinates
occs.xy <- occs %>% dplyr::select(.data$longitude, .data$latitude)
bg.xy <- bg %>% dplyr::select(.data$longitude, .data$latitude)
occs.xy <- occs %>% dplyr::select("longitude", "latitude")
bg.xy <- bg %>% dplyr::select("longitude", "latitude")
# run ENMeval
e <- ENMeval::ENMevaluate(occs = as.data.frame(occs.xy),
bg = as.data.frame(bg.xy),
Expand Down
28 changes: 14 additions & 14 deletions R/occs_queryDb.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Wallace EcoMod: a flexible platform for reproducible modeling of
# species niches and distributions.
#
#
# occs_queryDb.R
# File author: Wallace EcoMod Dev Team. 2023.
# --------------------------------------------------------------------------
Expand Down Expand Up @@ -259,12 +259,12 @@ occs_queryDb <- function(spNames, occDb, occNum = NULL, doCitations = FALSE,
"institutionCode", "elevation", "coordinateUncertaintyInMeters")
for (i in fields) if (!(i %in% names(occs))) occs[i] <- NA
occs <- occs %>%
dplyr::rename(scientific_name = .data$name,
state_province = .data$stateProvince,
record_type = .data$basisOfRecord,
institution_code = .data$institutionCode,
catalog_number = .data$catalogNumber,
uncertainty = .data$coordinateUncertaintyInMeters)
dplyr::rename(scientific_name = "name",
state_province = "stateProvince",
record_type = "basisOfRecord",
institution_code = "institutionCode",
catalog_number = "catalogNumber",
uncertainty = "coordinateUncertaintyInMeters")

} else if (occDb == 'vertnet') { # standardize VertNet column names
fields <- c("name", "longitude", "latitude", "country", "stateprovince",
Expand All @@ -273,13 +273,13 @@ occs_queryDb <- function(spNames, occDb, occNum = NULL, doCitations = FALSE,
"coordinateuncertaintyinmeters")
for (i in fields) if (!(i %in% names(occs))) occs[i] <- NA
occs <- occs %>%
dplyr::rename(scientific_name = .data$name,
state_province = .data$stateprovince,
record_type = .data$basisofrecord,
institution_code = .data$institutioncode,
catalog_number = .data$catalognumber,
elevation = .data$maximumelevationinmeters,
uncertainty = .data$coordinateuncertaintyinmeters)
dplyr::rename(scientific_name = "name",
state_province = "stateprovince",
record_type = "basisofrecord",
institution_code = "institutioncode",
catalog_number = "catalognumber",
elevation = "maximumelevationinmeters",
uncertainty = "coordinateuncertaintyinmeters")
# } else if (occDb == 'bison') { # standardize BISON column names
# fields <- c("providedScientificName", "longitude", "latitude", "countryCode",
# "stateProvince", "verbatimLocality", "year", "basisOfRecord",
Expand Down
6 changes: 3 additions & 3 deletions R/part_partitionOccs.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Wallace EcoMod: a flexible platform for reproducible modeling of
# species niches and distributions.
#
#
# part_partitionOccs.R
# File author: Wallace EcoMod Dev Team. 2023.
# --------------------------------------------------------------------------
Expand Down Expand Up @@ -96,8 +96,8 @@ part_partitionOccs <- function(occs, bg, method, kfolds = NULL, bgMask = NULL,
return()
}

occs.xy <- occs %>% dplyr::select(.data$longitude, .data$latitude)
bg.xy <- bg %>% dplyr::select(.data$longitude, .data$latitude)
occs.xy <- occs %>% dplyr::select("longitude", "latitude")
bg.xy <- bg %>% dplyr::select("longitude", "latitude")

if (method == 'jack') {
group.data <- ENMeval::get.jackknife(occs.xy, bg.xy)
Expand Down
4 changes: 2 additions & 2 deletions R/penvs_bgSample.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Wallace EcoMod: a flexible platform for reproducible modeling of
# species niches and distributions.
#
#
# penvs_bgSample.R
# File author: Wallace EcoMod Dev Team. 2023.
# --------------------------------------------------------------------------
Expand Down Expand Up @@ -78,7 +78,7 @@ penvs_bgSample <- function(occs, bgMask, bgPtsNum, logger = NULL, spN = NULL) {
smartProgress(logger, message = "Generating background points...", {
bgXY <- dismo::randomPoints(bgMask, bgPtsNum)
bgXY <- bgXY %>% as.data.frame() %>%
dplyr::select(longitude = .data$x, latitude = .data$y)
dplyr::select(longitude = "x", latitude = "y")
bgNonNA <- raster::ncell(bgMask) - raster::freq(bgMask, value = NA)[[1]]
})
bg.prop <- round(nrow(bgXY)/bgPtsNum, digits = 2)
Expand Down
4 changes: 2 additions & 2 deletions R/poccs_selectOccs.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Wallace EcoMod: a flexible platform for reproducible modeling of
# species niches and distributions.
#
#
# poccs_selectOccs.R
# File author: Wallace EcoMod Dev Team. 2023.
# --------------------------------------------------------------------------
Expand Down Expand Up @@ -98,7 +98,7 @@ poccs_selectOccs <- function(occs, polySelXY, polySelID = 1, logger = NULL,
hlSpp(spN),
"Your polygon is selecting all occurrences. None will be removed.")
occs.sel <- occs
return()
return(occs.sel)
}
occs.sel <- occs[-ptRemIndex,]

Expand Down
4 changes: 2 additions & 2 deletions R/run_wallace.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Wallace EcoMod: a flexible platform for reproducible modeling of
# species niches and distributions.
#
#
# run_wallace.R
# File author: Wallace EcoMod Dev Team. 2023.
# --------------------------------------------------------------------------
Expand Down Expand Up @@ -36,7 +36,7 @@
#' if(interactive()) {
#' run_wallace()
#' }
#' @author Jamie Kass <jkass@@gradcenter.cuny.edu>
#' @author Jamie Kass <jamie.m.kass@@gmail.com>
#' @author Gonzalo E. Pinilla-Buitrago <gepinillab@@gmail.com>
#' @export
run_wallace <- function(launch.browser = TRUE, port = getOption("shiny.port"),
Expand Down
4 changes: 2 additions & 2 deletions R/vis_bioclimPlot.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Wallace EcoMod: a flexible platform for reproducible modeling of
# species niches and distributions.
#
#
# vis_bioclimPlot.R
# File author: Wallace EcoMod Dev Team. 2023.
# --------------------------------------------------------------------------
Expand Down Expand Up @@ -66,7 +66,7 @@
#' that are inside the envelope for all layers (included those not plotted)
#' are shown as green circles and those outside of the envelope for one ore
#' more variables are plotted as orange triangles.
#' @author Jamie Kass <jkass@@gradcenter.cuny.edu>
#' @author Jamie Kass <jamie.m.kass@@gmail.com>
#' @author Gonzalo E. Pinilla-Buitrago <gepinillab@@gmail.com>
# @note
#' @seealso
Expand Down
5 changes: 3 additions & 2 deletions R/xfer_area.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Wallace EcoMod: a flexible platform for reproducible modeling of
# species niches and distributions.
#
#
# xfer_area.R
# File author: Wallace EcoMod Dev Team. 2023.
# --------------------------------------------------------------------------
Expand Down Expand Up @@ -81,9 +81,10 @@
#' RasterBrick or a RasterStack of the environmental variables cropped to the
#' area of transfer. The second element is a raster of the transferred model with
#' the specified output type.
#' @author Jamie Kass <jkass@@gradcenter.cuny.edu>
#' @author Jamie Kass <jamie.m.kass@@gmail.com>
#' @author Andrea Paz <paz.andreita@@gmail.com>
#' @author Gonzalo E. Pinilla-Buitrago <gepinillab@@gmail.com>
#' @author Bethany A. Johnson <bjohnso005@@citymail.cuny.edu>
# @note
#' @seealso \code{\link[dismo]{predict}}, \code{\link{xfer_time}}
#' \code{\link{xfer_userEnvs}}
Expand Down
Loading
Loading