Giter VIP home page Giter VIP logo

birds's People

Contributors

aleruete avatar antpn avatar deboraarlt avatar greensway avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

rsbivand

birds's Issues

makegrid for the whole world

the function makeGrid became better for regional-local scales, but it does not work for continental to intercontinental scales.
It has to do with poly <- st_transform(poly, crs = st_crs(getUTMproj(poly))) to choose planar coordinates.

A solution is to let the user choose a planar CRS, else pick a UTM.

Grid with attributes makes error when using SummariseBirds(spillOver = "unique")

Description
When using a grid which has attributes it results in an error when running summariseBirds() with spillOver = "unique".
The reason lies in the function includeUniqueSpillover(), overlayBirds.R, line 68. Where obs[,"grid"] should be a vector but instead is a data.frame when the input grid has attributes.

To Reproduce
Link to grid.
Link to data.

data <- read.csv("path/to/data.csv")
grid <- rgdal::readOGR("path/grid/with/attributes/grid.shp")
ob <- BIRDS::organiseBirds(data)
BIRDS::summariseBirds(ob, grid, "unique")

exploreVisits error when timeInVisits != "day"

Description
When setting other than the default ”day” for the variable timeInVisits in organizeBirds () the following function exploreVisits () returns with an error.

To Reproduce

library(BIRDS)
ob <- organizeBirds(bombusObs, timeInVisits = "year")
e <- exploreVisits(ob, attr(ob, "visitCol"))

Expected behavior
There should not be an error.

migrate to 'sf'

Change all dependencies of sp to sf. And make examples accordingly.

Error in matrix(unlist(dataRes), nrow = length(dataRes), byrow = TRUE)

Description
When running the summarizeBirds() it can result in error with certain data in combination with spillOver = "unique".

The error is:

Error in matrix(unlist(dataRes), nrow = length(dataRes), byrow = TRUE) : 
  'data' must be of a vector type, was 'NULL'

The error can occur in different grid types. That seems not to be relevant.

To Reproduce
Link to data.

data <- read.csv("path/to/data.csv")
ob <- organiseBirds(data)
bboxMat <- as.matrix(ob$spdf@bbox)
bboxMat <- matrix(c(bboxMat[1,1], bboxMat[2,1],bboxMat[1,1], 
                    bboxMat[2,2],bboxMat[1,2], bboxMat[2,2],
                    bboxMat[1,2], bboxMat[2,1],bboxMat[1,1],
                    bboxMat[2,1]), ncol = 2, nrow = 5, byrow = TRUE)
bbPol <- SpatialPolygons(list(
  Polygons(list(Polygon(bboxMat)), 1)
  ))
proj4string(bbPol) <- CRS("+init=epsg:4326")
grid <- makeDggrid(bbPol, 100)
sb <- summarizeBirds(ob, grid, "unique")

clusters and outliers

The way outliers were calculated based on a boxplot of the distnaces to the ceintroid made sets of too few points where there are e.g. 3 unique locations be considered as 1 outlier even if the distances between the points wasnt unreasonable long.

Describe the solution you'd like
The solution is to think about the pertenence of the observations to clusters based on the median distance between observations not to a centroid. I use the DBSCAN algorithm to search for groups of at least three point within the median distance between the points. Else they are too spread or there are too few points to be considered a cluster.

Then issue #18 can be reopened.

BIRDS::spatialVisits(): identicalCRS(x, y) is not TRUE

Description
When running the spatialVisits() it can result in error with certain data.

The error is:

Error in .local(x, y, returnList, fn, ...) : 
  identicalCRS(x, y) is not TRUE
In addition: Warning messages:
1: In proj4string(spdf) : CRS object has comment, which is lost in output
2: In spTransform(xSP, CRSobj, ...) :
  NULL source CRS comment, falling back to PROJ string
3: In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded datum WGS_1984 in CRS definition,
 but +towgs84= values preserved

To Reproduce
Link to data.

data <- read.csv("path/to/data.csv")
ob <- organiseBirds(data)
visitStats <- exploreVisits(ob)
spV<-spatialVisits(visitStats)

add function for ES50 calculations:

https://data-blog.gbif.org/post/exploring-es50-for-gbif/

https://obis.org/indicators/documentation/

ES50 (Hulbert index)
The expected number of marine species in a random sample of 50 individuals (records) is an indicator on marine biodiversity richness.

The ES50 is defined in OBIS as the sum(esi) over all species of the following per species calculation:

when n - ni >= 50 (with n as the total number of records in the cell and ni the total number of records for the ith-species)
esi = 1 - exp(lngamma(n-ni+1) + lngamma(n-50+1) - lngamma(n-ni-50+1) - lngamma(n+1))
when n >= 50
esi = 1
else
esi = NULL
Warning: ES50 assumes that individuals are randomly distributed, the sample size is sufficiently large, the samples are taxonomically similar, and that all of the samples have been taken in the same manner.

CRS issue in organizeBirds(x=data, grid=grid)

Decription
When a grid is added to organizeBirds(x=data, grid=grid) it results in an error "identicalCRS(x, y) is not TRUE".
The error comes from the function getGridIDs (line 139) in organizeBIRDS. In sp::over() the inputs don't have the same CRS, even thou they should have.

To Reproduce

grid <- rgdal::readOGR(dsn="path/to/.shp")
grid <- sp::spTransform(grid, CRSobj = CRS("+init=epsg:4326"))
ob <- BIRDS::organizeBirds(x = BIRDS::bombusObs, dataCRS = "+init=epsg:4326", grid = grid)

Expected behavior
There shouldn’t be an error.

Stuck in removeObs()

Description
When running removeObs() on certain datasets it seems to get stuck and not returning any results.
The terminal returns “Chunks to big, next…” two times then it seems to get stuck in an infinite loop

To Reproduce
Link to sample data

data <- read.csv("path/to/data.csv")
ob <- BIRDS::organiseBirds(data)
ev <- BIRDS::exploreVisits(ob)
ro <- BIRDS::removeObs(ob, ev,criteria = "SLL",percent = 75,stepChunk = 0.05)

Expected behavior
The function should terminate.

compatibility to new sp/rgdal

In reverse dependency checks, there appear to be more problems with current sp from github - rsbivand/sp and R-Forge rgdal. The underlying problem seems to stem from CRS(proj4string(x)), testing that proj4string() values are equal, and so on. Be aware that proj4string() values are retained only for out-of-date PROJ/GDAL versions, and that other mechanisms are used replacing the use of Proj4 strings with WKT2_2019 strings for PROJ >= 6 and GDAL >= 3 (already in the CRAN Windows binaries of sf and rgdal). You also use constructions like points@proj4string which should always be slot(points, "proj4string"). This is certainly not resolved. There are multiple errors when running soon to be released sp/rgdal with current PROJ/GDAL both on released BIRDS, and possibly more problems with BIRDS master.

Originally posted by @rsbivand in #9 (comment)

Gini index

add possibility to calculate Gini index for different exported results

rm.outliers()

possibility to remove individual observations that are outliers from too wide visits.

zoo:index(x)

Describe the bug
Sometimes when reloading summarise birds it trows the following error when I run focalSpReport:

Error in as.POSIXlt.numeric(zoo::index(x)) : 'origin' must be supplied

It doens't happens always.

To Reproduce
Steps to reproduce the behavior:
Likely yearsAll <- sort(unique(lubridate::year(x$temporal)))

Reported by Charles

'visits' & 'visits<-'

Now they only accept birds_spdf. It should also accept other types of BIRDS-classes

simplifySpp()

Describe the bug
"Falco peregrinus, 1771" gets to "Falco"

Expected behavior
should be "Falco peregrinus"

Organize birds problem with sf objetcs

The function organiseBirds will not organise an sf object.

Error is:
"Error in organiseBirds(dat, sppCol = "vetenskapligt_namn", idCols = c("lokal", :
The column names defined for the coordinates could not be found in the data set"

I think the reason is that at line 520
the function calls:
if (any(class(x) == "data.frame"))

an sf object gives a response of
"sf" "data.frame"
so is assumed to not be spatial by default as the code is now

possible solution would be
all( any( class(x)%in%"sf"), any( class(x) %in% "data.frame"))

Charlie

using a polygon with data.frame as grid produce errors in Summary

Describe the bug
using a polygon with data.frame (e.g. reading a shape file) as grid produce errors in SummariseBirds, actually in includeUniqueSpillover(). This function Assumes that grid only has IDs in the data.frame an nothing else.

To Reproduce
Steps to reproduce the behavior:

  1. Load a shape file with an attribute table with many columns
  2. use it as grid in SummarizeBirds(..., sippover="unique") or overlay(.., spilover="unique") or BIRDS:::includeUniqueSpillOver()

Expected behavior
should interpret the grid in its various forms

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.