Some scripts that might be useful when dealing with GBIF data
Calculates the shortest over-water distance between a new observation and all georeferenced GBIF occurrences of a list of species. Returns the shortest of all these distances.
- The script expects a .csv file with species names as provided in the example. This file should be in the same directory as the script.
- Provide your GBIF credentials at the beginning of the script.
- Run the code that saves 'range_expansion' as a function.
- Use the long/lat parameters to locate your study site.
- The 'o' parameter defines the polygon within which GBIF occurrences will be considered for analysis. (In the future, I will re-program this parameter to be more dynamic in order to speed up computing time for species with many occurrences.)
- If necessary, adjust the name of the .csv file with species names. For now it is called 'species_list.csv'.
Known issues (working on it in the coming weeks):
- Store all results (paths, distances, maps, etc.) in an object from which they can be re-called after the analysis completed.
- Script takes quite a while to run to calculate all over-water distances. Should be parallelized.
- Code might not work if a species name is misspelled.
Makes gifs for the reports of species on GBIF through time. Keep in mind that more points on the map might not only indicate range expansion, but possibly also more sampling effort or other biases.