GarrettLab / HabitatConnectivity

geohabnet R package
https://garrettlab.github.io/HabitatConnectivity/
GNU General Public License v3.0
7 stars 4 forks source link

errors in #103

Closed ricardoi closed 4 months ago

ricardoi commented 6 months ago

Hello,

I was exploring the package last week, and I had these issues:

geohabnet::senstivity_analysis()
Error: 'senstivity_analysis' is not an exported object from 'namespace:geohabnet'

I also tried the example for avocado, changing the potato to avocado, and got an error. For "potato," it kind of worked.

avocado_mon <- geohabnet::cropharvest_rast("avocado", "monfreda")
> avocado_result <- geohabnet::msean(avocado_mon, global = TRUE, link_threshold  = 0.000001,
+                                    inv_pl = list(beta = c(0.05),
+                                                  metrics = c("betweeness"),
+                                                  weights = c(100),
+                                                  cutoff = -1), res = 24,
+                                    neg_exp = list(gamma = c(0.05),
+                                                   metrics = c("betweeness"),
+                                                   weights = c(100), cutoff = -1))
Error in legend(x, y, legend, fill = fill, xpd = xpd, bty = bty, cex = cex,  : 
  unused arguments (ext = c(-110, 150, -88, -78), horizontal = TRUE)

similar for this:

# A test for berries
> berries_mon <- geohabnet::cropharvest_rast("berries", "monfreda")
Error in geodata::crop_monfreda(crop = crop_name, path = tempdir(), var = "area_f") : 
   is not available; see monfredaCrops()
> monfredaCrops()
Error in monfredaCrops() : could not find function "monfredaCrops"
> geohabnet::monfredaCrops()
Error: 'monfredaCrops' is not an exported object from 'namespace:geohabnet'
AaronPlex commented 6 months ago

@krishnakeshav, could you check these issues?

geohabnet::sensitivity_analysis() works on my Windows laptop.

Your analysis of betweenness centrality in avocado_result works for me, but displays the error you are mentioning. That would be an issue for betweenness calculation, which provides only one value (so a continuous legend makes no sense). We are still working on the best way to calculate betweenness centrality in cropland connectivity. @ricardoi, could you use closeness or any other network metrics? It seems that the other metrics are working okay.

@ricardoi, please try geodata::monfredaCrops(). I see blueberry and cherry in the list of crops available in Monfreda et al. (2008). @krishnakeshav, could we change the error message for monfredaCrops()?

ricardoi commented 6 months ago

Hi @AaronPlex,

I am working on Mac OS and Ubuntu Linux (to install geohabnet in Linux, you need to install via apt gdal-bin && r-cran-sf ). The issue with geohabnet::sensitivity_analysis() on Mac OS was a problem with rnaturalearthdata. Reinstalling that solved the problem. Closeness centrality worked. To avoid that error, the example should probably have closeness instead of betweenness—or document the issue with the betweenness calculation. monfredaCrops() does not work, but geodata::monfredaCrops() worked. Thanks.

krishnakeshav commented 6 months ago

Hey @ricardoi , @AaronPlex , Also checkout geohabnet::crop_search() . This is more robust and future oriented.

AaronPlex commented 4 months ago

I am closing this issue since it seems to be resolved. Thanks for your feedback.