ropensci / rgbif

Interface to the Global Biodiversity Information Facility API
https://docs.ropensci.org/rgbif
Other
155 stars 50 forks source link

elevation: warning for coordinates not within ±90° and ±180° #176

Closed luisDVA closed 9 years ago

luisDVA commented 9 years ago

Hi,

I recently struggled with client-side error messages in the elevation function when there were typos or weird NA strings in my coordinates and the values ended up being beyond ±90° and ±180°. Can a warning or ifelse test be put into the function to let users know that something is wrong with their lat/long data?

Thanks, Luis Verde

sckott commented 9 years ago

@luisDVA thanks for opening the issue. Looking at the function now to see what the best approach will be to handling different user inputs

sckott commented 9 years ago

@luisDVA install from github, let me know if it works better

added a number of checks for impossible values of either variable, incomplete cases, and values at 0,0

luisDVA commented 9 years ago

thanks for adding those checks, I installed from github, looked at the function, and also tried it out. The checks work fine and should save people lots of grief. I doubt anyone will be trying to get elevations in the Gulf of Guinea (near 0,0).

I just saw a minor typo in the error message, it says "longitude between 180 amd -180"

Great work with the package and the quick support. Cheers, Luis

sckott commented 9 years ago

I doubt anyone will be trying to get elevations in the Gulf of Guinea (near 0,0).

right, not many intentionally use those coords, but they show up quite often, perhaps some default setting in various pieces of software.

I just saw a minor typo in the error message, it says "longitude between 180 amd -180"

will fix, thx

jarioksa commented 9 years ago

https://github.com/ejedwards/reanalysis_zanne2014 has some more tests to detect probably bad coordinates. This is what they say in their README.md about their Python function: cleanGbifCoords.1.0.py : This is a general-use version of a portion of the script that we developed to clean the Zanne et al. climate data. Specifially, this script will remove political centroids and locations of major herbaria from a collection of latitudes/longitudes. If used, please cite our BCA: Edwards EJ, J de Vos, MJ Donoghue. 2015. Brief Communications Arising: Doubtful pathways to cold tolerance in plants. Nature doi:10.1038/nature14393.

sckott commented 9 years ago

@jarioksa thanks for this. Have you used the code yourself?

jarioksa commented 9 years ago

No, I just found it and haven't had time to try this. I sure do have a need for this. Imagine where is the centroid for a record in "Norway" — any land nearby? Major botanical gardens should be removed as well, but probably most go with herbaria.

sckott commented 9 years ago

Thanks. I have been working in cleaning utilities in spoccutils, so it may make sense to break out functions useful for cleaning occurrence records that are not tied to a specific data source - like the one you linked to above for removing herbaria, etc.

As opposed to e.g., GBIF includes a set of issues that users can use here to filter results - so that would make sense to leave in this pkg

sckott commented 9 years ago

repo started at https://github.com/sckott/cleanoccs