Skip to content

Commit

Permalink
error trap call to robis::occurence(geometry)
Browse files Browse the repository at this point in the history
  • Loading branch information
btupper committed Mar 25, 2021
1 parent bf0d973 commit 9c11ab9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/CalculatingES50.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ ES50_df$Phylum_after120 = NA
for (i in 1:nrow(ES50_df)){
hull = st_convex_hull(ES50_df$geom[[i]]) #find the convex hull for the polygon
text = st_as_text(hull) #convert it to text
SpeciesOccurence = occurrence(geometry = text) #query OBIS for species within that polygon
SpeciesOccurence = try(occurrence(geometry = text)) #query OBIS for species within that polygon
if (inherits(SpeciesOccurence, "try-error")) SpeciesOccurence <- NULL
if (!is_empty(SpeciesOccurence)){ #if there is OBIS data..
if ("individualCount" %in% colnames(SpeciesOccurence)){ #if individualCount is an available column..
SpeciesOccurence$individualCount <- suppressWarnings(as.numeric(SpeciesOccurence$individualCount)) #introduces NAs
Expand Down

0 comments on commit 9c11ab9

Please sign in to comment.