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

Remove USGS BISON via the package rbison as a data source in spocc #252

Merged
merged 1 commit into from
Nov 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 7 additions & 10 deletions DESCRIPTION
@@ -1,14 +1,12 @@
Package: spocc
Title: Interface to Species Occurrence Data Sources
Description: A programmatic interface to many species occurrence data sources,
including Global Biodiversity Information Facility ('GBIF'), 'USGSs'
Biodiversity Information Serving Our Nation ('BISON'), 'iNaturalist',
'eBird', Integrated Digitized
'Biocollections' ('iDigBio'), 'VertNet', Ocean 'Biogeographic' Information
System ('OBIS'), and Atlas of Living Australia ('ALA'). Includes
functionality for retrieving species occurrence data, and combining
those data.
Version: 1.2.0.91
including Global Biodiversity Information Facility ('GBIF'), 'iNaturalist',
'eBird', Integrated Digitized 'Biocollections' ('iDigBio'), 'VertNet',
Ocean 'Biogeographic' Information System ('OBIS'), and
Atlas of Living Australia ('ALA'). Includes functionality for retrieving
species occurrence data, and combining those data.
Version: 1.2.1.91
License: MIT + file LICENSE
Authors@R:
c(person(given = "Hannah", family = "Owens",
Expand Down Expand Up @@ -36,7 +34,6 @@ Language: en-US
Imports:
utils,
rgbif,
rbison,
rebird,
rvertnet,
ridigbio,
Expand All @@ -51,7 +48,7 @@ Suggests:
testthat,
taxize,
vcr
RoxygenNote: 7.1.1
RoxygenNote: 7.2.1
X-schema.org-applicationCategory: Biodiversity
X-schema.org-keywords: specimens, API, web-services, occurrences, species, taxonomy, GBIF, INAT, BISON, Vertnet, eBird, iDigBio, OBIS, ALA
X-schema.org-isPartOf: https://ropensci.org
11 changes: 0 additions & 11 deletions NAMESPACE
Expand Up @@ -6,13 +6,6 @@ S3method(as.ala,data.frame)
S3method(as.ala,list)
S3method(as.ala,occdat)
S3method(as.ala,occkey)
S3method(as.bison,bisonkey)
S3method(as.bison,character)
S3method(as.bison,data.frame)
S3method(as.bison,list)
S3method(as.bison,numeric)
S3method(as.bison,occdat)
S3method(as.bison,occkey)
S3method(as.gbif,character)
S3method(as.gbif,data.frame)
S3method(as.gbif,gbifkey)
Expand Down Expand Up @@ -56,7 +49,6 @@ S3method(print,occnames)
S3method(summary,occdat)
S3method(summary,occdatind)
export(as.ala)
export(as.bison)
export(as.ecoengine)
export(as.gbif)
export(as.idigbio)
Expand Down Expand Up @@ -84,9 +76,6 @@ importFrom(lubridate,ydm_hm)
importFrom(lubridate,ymd)
importFrom(lubridate,ymd_hm)
importFrom(lubridate,ymd_hms)
importFrom(rbison,bison)
importFrom(rbison,bison_solr)
importFrom(rbison,bison_tax)
importFrom(rebird,ebirdgeo)
importFrom(rebird,ebirdregion)
importFrom(rgbif,name_lookup)
Expand Down
78 changes: 0 additions & 78 deletions R/as.bison.R

This file was deleted.

6 changes: 2 additions & 4 deletions R/inspect.R
Expand Up @@ -9,14 +9,14 @@
#' @export
#' @param x The output from [occ()] call, output from call to
#' [occ2df()], or an occurrence ID as a occkey class.
#' @param from (character) The data provider. One of gbif, bison, inat,
#' @param from (character) The data provider. One of gbif, inat,
#' or vertnet
#' @return A list, with each slot named for the data source, and then
#' within data sources is a slot for each taxon, named by it's occurrence ID.
#'
#' @examples \dontrun{
#' spnames <- c('Accipiter striatus', 'Spinus tristis')
#' out <- occ(query=spnames, from=c('gbif','bison'),
#' out <- occ(query=spnames, from=c('gbif','idigbio'),
#' gbifopts=list(hasCoordinate=TRUE), limit=2)
#' res <- occ2df(out)
#' inspect(res)
Expand Down Expand Up @@ -55,7 +55,6 @@ inspect.occdat <- function(x, from="gbif") {
inspect.occkey <- function(x, from="gbif"){
switch(class(x)[1],
gbifkey = as.gbif(x),
bisonkey = as.bison(x),
idigbiokey = as.idigbio(x))
}

Expand All @@ -66,7 +65,6 @@ make_df <- function(x){
out[[ names(obj)[i] ]] <-
switch(names(obj)[i],
gbif = as.gbif(obj[[i]]),
bison = as.bison(obj[[i]]),
idigbio = as.idigbio(obj[[i]])
)
}
Expand Down
12 changes: 5 additions & 7 deletions R/occ.r
Expand Up @@ -10,7 +10,7 @@
occ <- function(query = NULL, from = "gbif", limit = 500, start = NULL,
page = NULL, geometry = NULL, has_coords = NULL, ids = NULL, date = NULL,
callopts=list(),
gbifopts = list(), bisonopts = list(), inatopts = list(),
gbifopts = list(), inatopts = list(),
ebirdopts = list(), vertnetopts = list(), idigbioopts = list(),
obisopts = list(), alaopts = list(), throw_warnings = TRUE) {

Expand All @@ -29,12 +29,12 @@ occ <- function(query = NULL, from = "gbif", limit = 500, start = NULL,
type <- "sci"

geometry <- occ_geom(geometry)
sources <- match.arg(from, choices = c("gbif", "bison", "inat", "ebird",
sources <- match.arg(from, choices = c("gbif", "inat", "ebird",
"vertnet", "idigbio", "obis", "ala"),
several.ok = TRUE)

# collect all data sources opts into named list to index to later
ds <- list(gbif=gbifopts, bison=bisonopts, inat=inatopts,
ds <- list(gbif=gbifopts, inat=inatopts,
ebird=ebirdopts, vertnet=vertnetopts,
idigbio=idigbioopts, obis=obisopts, ala=alaopts)

Expand Down Expand Up @@ -80,7 +80,7 @@ occ <- function(query = NULL, from = "gbif", limit = 500, start = NULL,
} else if (is.null(query) && is.null(geometry) && !is.null(ids)) {
ids <- occ_unlistids(ids)
# if ids is not null (taxon identifiers passed in)
# ids can only be passed to gbif and bison for now
# ids can only be passed to gbif for now
# so don't pass anything on to inat or ebird
tmp <- lapply(ids, occ_loopids, y = limit, s = start, p = page,
z = geometry, hc = has_coords, d = date, w = callopts,
Expand All @@ -106,8 +106,6 @@ occ <- function(query = NULL, from = "gbif", limit = 500, start = NULL,

gbif_sp <- occ_getsplist(tmp, "gbif", sources, type, ds$gbif, query, geometry,
ids)
bison_sp <- occ_getsplist(tmp, "bison", sources, type, ds$bison, query, geometry,
ids)
inat_sp <- occ_getsplist(tmp, "inat", sources, type, ds$inat, query, geometry,
ids)
ebird_sp <- occ_getsplist(tmp, "ebird", sources, type, ds$ebird, query, geometry,
Expand All @@ -120,7 +118,7 @@ occ <- function(query = NULL, from = "gbif", limit = 500, start = NULL,
ids)
ala_sp <- occ_getsplist(tmp, "ala", sources, type, ds$ala,
query, geometry, ids)
p <- list(gbif = gbif_sp, bison = bison_sp, inat = inat_sp, ebird = ebird_sp,
p <- list(gbif = gbif_sp, inat = inat_sp, ebird = ebird_sp,
vertnet = vertnet_sp, idigbio = idigbio_sp, obis = obis_sp,
ala = ala_sp)
structure(p, class = "occdat", searched = from)
Expand Down
15 changes: 7 additions & 8 deletions R/occ2df.R
Expand Up @@ -30,10 +30,10 @@
#'
#' out <- occ(
#' query='Accipiter striatus',
#' from=c('gbif','bison','ebird','inat'),
#' from=c('gbif','ebird','inat'),
#' gbifopts=list(hasCoordinate=TRUE), limit=2)
#' occ2df(out)
#' occ2df(out$bison)
#' occ2df(out$gbif)
#'
#' # or combine many results from a single data source
#' spnames <- c('Accipiter striatus', 'Spinus tristis')
Expand Down Expand Up @@ -61,7 +61,6 @@ foolist <- function(x) {
occ2df.occdat <- function(obj, what = "data") {
what <- match.arg(what, choices = c("all", "data"))
aa <- foolist(obj$gbif)
bb <- foolist(obj$bison)
cc <- foolist(obj$inat)
dd <- foolist(obj$ebird)
vn <- foolist(obj$vertnet)
Expand All @@ -86,25 +85,25 @@ occ2df.occdat <- function(obj, what = "data") {
rename(dat, stats::setNames("key", keymap[[y]]))
}
},
list(aa, bb, cc, dd, vn, id, ob, ala),
c('gbif','bison','inat','ebird',
list(aa, cc, dd, vn, id, ob, ala),
c('gbif','inat','ebird',
'vertnet','idigbio','obis','ala')
)
)
tmpout <- list(
meta = list(obj$gbif$meta, obj$bison$meta, obj$inat$meta,
meta = list(obj$gbif$meta, obj$inat$meta,
obj$ebird$meta, obj$vn$meta, obj$id$meta,
obj$ob$meta, obj$ala$meta),
data = tmp
)
if (what %in% "data") as_tibble(tmpout$data) else tmpout
}

datemap <- list(gbif = 'eventDate', bison = 'date', inat = 'observed_on',
datemap <- list(gbif = 'eventDate', inat = 'observed_on',
ebird = 'obsDt', vertnet = "eventdate",
idigbio = "datecollected", obis = "eventDate",
ala = "eventDate")

keymap <- list(gbif = "key", bison = "occurrenceID", inat = "id",
keymap <- list(gbif = "key", inat = "id",
ebird = "locID", vertnet = "occurrenceid", idigbio = "uuid",
obis = "id", ala = "uuid")
7 changes: 2 additions & 5 deletions R/occ_funs.R
Expand Up @@ -6,14 +6,13 @@ occ_loopfun <- function(x, y, s, p, z, hc, d, w, sources, ds) {
# x = query; y = limit; s = start; p = page;
# z = geometry; hc = has_coords; d = date; w = callopts
gbif_res <- foo_gbif(sources, x, y, s, z, hc, d, w, ds$gbif)
bison_res <- foo_bison(sources, x, y, s, z, d, w, ds$bison)
inat_res <- foo_inat(sources, x, y, p, z, hc, d, w, ds$inat)
ebird_res <- foo_ebird(sources, x, y, w, ds$ebird)
vertnet_res <- foo_vertnet(sources, x, y, hc, d, w, ds$vertnet)
idigbio_res <- foo_idigbio(sources, x, y, s, z, hc, d, w, ds$idigbio)
obis_res <- foo_obis(sources, x, y, s, z, hc, d, w, ds$obis)
ala_res <- foo_ala(sources, x, y, s, z, hc, d, w, ds$ala)
list(gbif = gbif_res, bison = bison_res, inat = inat_res, ebird = ebird_res,
list(gbif = gbif_res, inat = inat_res, ebird = ebird_res,
vertnet = vertnet_res,
idigbio = idigbio_res, obis = obis_res, ala = ala_res)
}
Expand All @@ -25,13 +24,11 @@ occ_loopids <- function(x, y, s, p, z, hc, d, w, sources, ds) {
call. = FALSE)
if (inherits(x, 'gbifid')) {
gbif_res <- foo_gbif(sources, x, y, s, z, hc, d, w, ds$gbif)
bison_res <- empty_time_data()
} else if (inherits(x, 'tsn')) {
bison_res <- foo_bison(sources, x, y, s, z, d, w, ds$bison)
gbif_res <- empty_time_data()
warning("bison no longer supported", call. = FALSE)
}
list(gbif = gbif_res,
bison = bison_res,
inat = empty_time_data(),
ebird = empty_time_data(),
vertnet = empty_time_data(),
Expand Down