get_gfw_emissions() works from CRAN version but not from github main version
Closed this issue · 2 comments
fBedecarrats commented
I guess you @goergen95 are aware of this and it is normal due to the work in progress, but I just wanted to report it in case it was not expected.
Here is a reproducible example (forgive my R's French):
# CRAN version
install.packages("mapme.biodiversity")
library(mapme.biodiversity)
library(sf)
library(dplyr)
library(tidyr)
aoi_path <- system.file("extdata", "sierra_de_neiba_478140.gpkg", package = "mapme.biodiversity")
aoi <- st_read(aoi_path, quiet = TRUE) %>%
st_cast("POLYGON")
aoi
outdir <- "my_test"
dir.create(outdir, showWarnings = FALSE)
mapme_options(
outdir = outdir,
verbose = TRUE
)
aoi <- get_resources(
x = aoi,
get_gfw_emissions())
file.exists("my_test/gfw_emissions/gfw_forest_carbon_gross_emissions_Mg_CO2e_px_20N_080W.tif")
# [1] TRUE
# Github version
detach("package:mapme.biodiversity", unload = TRUE)
devtools::install_github("https://github.com/mapme-initiative/mapme.biodiversity")
library(mapme.biodiversity)
aoi_path <- system.file("extdata", "sierra_de_neiba_478140.gpkg", package = "mapme.biodiversity")
aoi2 <- st_read(aoi_path, quiet = TRUE) %>%
st_cast("POLYGON")
aoi2
outdir2 <- "my_test2"
dir.create(outdir2, showWarnings = FALSE)
mapme_options(
outdir = outdir2,
verbose = TRUE
)
aoi2 <- get_resources(
x = aoi2,
get_gfw_emissions())
# Error in purrr::map(seq_along(missing_urls), function(i) { :
# ℹ In index: 1.
# Caused by error in `download.file()`:
# ! impossible d'ouvrir l'URL 'NA'
# De plus : Message d'avis :
# Dans download.file(missing_urls[i], missing_filenames[i], quiet = TRUE, :
# URL 'http://NA/': statut 'Couldn't resolve host name'
# Erreur dans .get_single_resource(x, fun) :
# Download for resource gfw_emissions failed. Returning unmodified portfolio object.
file.exists("my_test2/gfw_emissions/gfw_forest_carbon_gross_emissions_Mg_CO2e_px_20N_080W.tif")
# [1] FALSE
fBedecarrats commented
Yes, now it works, thanks @goergen95 !
detach("package:mapme.biodiversity", unload = TRUE)
devtools::install_github("https://github.com/mapme-initiative/mapme.biodiversity")
library(mapme.biodiversity)
aoi_path <- system.file("extdata", "sierra_de_neiba_478140.gpkg", package = "mapme.biodiversity")
aoi2 <- st_read(aoi_path, quiet = TRUE) %>%
st_cast("POLYGON")
aoi2
outdir2 <- "my_test2"
dir.create(outdir2, showWarnings = FALSE)
mapme_options(
outdir = outdir2,
verbose = TRUE
)
aoi2 <- get_resources(
x = aoi2,
get_gfw_emissions())
file.exists("my_test2/gfw_emissions/gfw_forest_carbon_gross_emissions_Mg_CO2e_px_20N_080W.tif")
# [1] TRUE