Giter Club home page Giter Club logo

gapanalysis's People

Contributors

ccsosa avatar dcarver1 avatar jramirezv avatar stevensotelo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gapanalysis's Issues

Remove use of `cat` and `print`

In GetDatasets use message instead of cat (it's used in two different lines)

In ERSex.R (line 158) use warning() instead of print
In GRSex.R (line 126) use warning() instead of print
In SRSin.R (line 134) use warning instead of print

FCSex function failing on rgoes dependency

I'm noting here because I've got a band-aid fix worked out on this fork

It's not quality enough to try to merge back into the actual library bit it should keep the ship afloat while we work on removing all the sp/raster dependencies.

Details on the changes on written out in the readme on the forked repo.

Add additional authors to DESCRIPTION file

Add other authors in description file:

Valentin Stefan
Harold A. Achicanoy
Maria Victoria Diaz
Steven Sotelo
Nora P. Castaneda-Alvarez
Kaue de Sousa

All with a role=ctb (i.e. contributor)

Error installing Github

Loading required package: raster
Error: package or namespace load failed for ‘raster’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘Rcpp’
Error in .requirePackage(package) :
unable to find required package ‘raster’
Loading required package: raster
Error: package or namespace load failed for ‘raster’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘Rcpp’
Error in .requirePackage(package) :
unable to find required package ‘raster’
Loading required package: raster
Error: package or namespace load failed for ‘raster’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘Rcpp’
Error in .requirePackage(package) :
unable to find required package ‘raster’

improve documention for loading full datasets(Ecoregions and protected areas)

The GetDatasets() funcitons stores downloads files into a specific repo.

Currently, all functions will pull the worldwide ecoregion and protected areas file if those parameters are kept blank.

How every if someone want to put to those files directly, there is not any documentation to tell them look in system.file("data/preloaded_data/ecoRegion/tnc_terr_ecoregions.shp",package = "GapAnalysis")

I'm not sure how to best work this into the process, but we should try to make it more clear to users.

species list and raster list indexing

Currently users have to ensure that the order of species listed in the occurrence data matches the order the SDM rasters.

I was working with the package and had mismatched the order. It took me a while to determine the cause of the issue and there was little indicaiton of what was causing the errors.

I am wondering if we could better document this requirement or add some suggestions within functions that remind users to double check the order.

I don't think there is a comprehensive means of ensuring the indexing between the occurrence data and rasters is correct as each user will define the structures of those datasets.

Native area in summary html maps

    So, I have another question now @dcarver1. I'll put it in this thread but you can move to a separate issue as desired!

With the SummaryHTML function running, I've looked more closely at the output and realized the map labels are not quite right. After a deeper look, I've determined that the rasters I’m using are missing the “Native area (ecoregions within countries where species has been observed in the field)” designation – they only have the modeled potential distribution from Khoury et al 2020. So, my maps are missing one element in the legend, which shifts the remaining parts up so they are incorrect. For example, the purple designation is missing in the GRSex map – below is my Juglans major map and then one of the Cucurbita examples from the README for comparison.

Screen Shot 2022-11-09 at 4 06 18 PM

Screen Shot 2022-11-09 at 4 31 11 PM

I (wrongly) assumed that the "native area" designation was added somewhere within the GapAnalysis package workflow, since it wasn't mentioned explicitly in the README. Wondering what you suggest as the easiest workaround? I'm guessing I should just add the "native area" myself? I'm not as proficient with rasters, so if you have relevant code to share, that would be amazing. Otherwise, I'm sure I can figure it out.

Thanks, as always!

Originally posted by @eb-bruns in #22 (comment)

error in scales::colour_ramp

Hello! I'm trying to run the SummaryHTML function by following the Cucurbita example but using occurrence points and raster files for my own target species. Everything prior in the Cucurbita example has worked using my data, but I get this error within the "Calculating ERSex gap map" step:

Quitting from lines 439-458 (summaryHTML.Rmd) 
Error in scales::colour_ramp(colors, alpha = alpha) : 
  Must provide at least one colour to create a colour ramp

I'm using my own occurrence data and your raster files for J. californica and J. hindsii from the 2020 PNAS paper, found here: https://github.com/dcarver1/cwr_pnas_results/tree/main/speciesLevelData20210706/Juglans

Thanks and let me know what other information you may need!

NULL object in raster postion into HTML

SRSin, ERSex, and GRSex all have the potential to pass a null object into the map feature position.
Ensure there is a conditional test on the object type before attempting to map the outputs of these features.

Fix Gbuffer function

Change in the line 124 of Gbuffer.R
spolys_buff <- sp::disaggregate(spolys) by spolys_buff = raster::aggregate(spolys, dissolve = TRUE)
This will fix the issue to run GRSex.

Please remove dependencies on **rgdal**, **rgeos**, and/or **maptools**

This package depends on (depends, imports or suggests) raster and one or more of the retiring packages rgdal, rgeos or maptools (https://r-spatial.org/r/2022/04/12/evolution.html, https://r-spatial.org/r/2022/12/14/evolution2.html). Since raster 3.6.3, all use of external FOSS library functionality has been transferred to terra, making the retiring packages very likely redundant. It would help greatly if you could remove dependencies on the retiring packages as soon as possible.

Error in ERSex

Trying to solve the following error in the Script ERSex.

gPoints <- sp::SpatialPoints(raster::rasterToPoints(buffer_rs))
The following error was found: Error in .bboxCoords(coords) : nrow(coords) > 0 is not TRUE

Any suggestions?

Error: nrow(coords)>0 is not TRUE

Hello DAPA team,
I am currently using your team's package and I came across the following error: nrow(coords)>0 is not TRUE (that was mentioned in one of the closed discussions).
I then tried each function separately to figure out where the error occurs exactly.
It turned out it was the ERSex function.

I also saw that you talked about passing a dataframe instead of the sp object into the gBuffer function but couldn't quite figure out how to do so.
Could you please shed some light and help me on the matter ?

Thank you very much,
Marwa

ERSex function issue with ECO_ID_U

Ecoregion shapefile needs a column called ECO_ID_U (Integer) to run properly

This is how to fix the issue:
ecoreg$ECO_ID_U <- as.numeric(ecoreg$OBJECTID)

html updates 2

The summaryHTML function works with a for loop over the species. so it functions a bit differently from the rest of the functions. Need to implement some changes as a result of this.

  1. Add preprocessing to the ecoregion and protected areas files. - crop to extent of sdm, this step is part of multiple functions to it's inefficient.
  2. Ensure the raster about is inputted as list
  3. utilize only the FCS functions for data and map generation
  4. Evaluating replacing the sp::over for ERS functions, it's very slow.

add features to paramtest

Currently the paramtest function does not account for species with occurrence data but no SDM. I thought there would error with that case before users got into the function. However, folks are getting that far.

I added the solution, which is very simple to paramTest.R on the test02 branch. The troublesome element will be we need to add an addational check to all functions that use the paramtest. I'd like to figure out how this is happening before putting that work in.

The error user are seeing is something that does not indicate a missing SDM, so it's not very informative.

Error installing Gap analysis

These errors appears:

Loading required package: raster
Error: package or namespace load failed for ‘raster’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘Rcpp’
Error in .requirePackage(package) :
unable to find required package ‘raster’
Loading required package: raster
Error: package or namespace load failed for ‘raster’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘Rcpp’
Error in .requirePackage(package) :
unable to find required package ‘raster’
Loading required package: raster
Error: package or namespace load failed for ‘raster’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘Rcpp’
Error in .requirePackage(package) :
unable to find required package ‘raster’

ERSex -- no functional condition

this conditional statement

if(length(speciesOcc$type == "G") == 0){
  df$species[i] <- Species_list[i]
  df$ERSex[i] <- 0
}else{

is not going to work as a filtering processes as it is written.

html updates

  1. add clause to switch the map visualization type from categorical to continue if the number of unqiue features is above 30 or so.
  2. add clause to remove occurrences with no valid lat and long values from all map visulaizations.

Add references to DESCRIPTION file

References describing the methods in your package need to be added in the description field of your DESCRIPTION file in the form
authors (year) doi:...
authors (year) arXiv:...
authors (year, ISBN:...)
or if those are not available: https:...
with no space after 'doi:', 'arXiv:', 'https:' and angle brackets for
auto-linking.
(If you want to add a title as well please put it in quotes: "Title")

References to include:
Castañeda-Álvarez NP, Khoury CK, Achicanoy HA, Bernau V, Dempewolf H, Eastwood RJ, Guarino L, Harker RH, Jarvis A, Maxted N, Mueller JV, Ramirez-Villegas J, Sosa CC, Struik PC, Vincent H, and Toll J (2016) Global conservation priorities for crop wild relatives. Nature Plants 2(4): 16022. doi: 10.1038/nplants.2016.22

Khoury CK, Amariles D, Soto JS, Diaz MV, Sotelo S, Sosa CC, Ramirez-Villegas J, Achicanoy HA, Velásquez-Tibata J, Guarino L, Leon B, Navarro-Racines C, Castañeda-Álvarez NP, Dempewolf H, Wiersema JH, and Jarvis A (2019a) Comprehensiveness of conservation of useful wild plants: an operational indicator for biodiversity and sustainable development targets. Ecological Indicators 98: 420-429. doi: 10.1016/j.ecolind.2018.11.016

Khoury CK, Carver D, Barchenger DW, Barboza G, van Zonneweld M, Jarret R, Bohs L, Kantar MB, Uchanski M, Mercer K, Nabhan GP, Bosland PW, and Greene SL (2019b) Modeled distributions and conservation status of the wild relatives of chile peppers (Capsicum L). Diversity and Distributions 26(2): 209-225. doi: 10.1111/DDI.13008. https://doi.org/10.1111/DDI.13008

Ramirez-Villegas J, Khoury CK, Jarvis A, Debouck DG, Guarino L (2010) A gap analysis methodology for collecting crop genepools: a case study with Phaseolus beans. PLoS One 5, e13497. doi:10.1371/journal.pone.0013497

writeRasters sames not work

summaryHTML_file <- SummaryHTML(Species_list=speciesList, Occurrence_data = CucurbitaData, Raster_list=CucurbitaRasters, Buffer_distance=50000, Ecoregions_shp=ecoregions, Pro_areas=ProtectedAreas, Output_Folder=".", writeRasters=T)

When I running the above demo code, and I only change the para writeRasters=T, but can't find any gap raster file been write out to local disk

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.