From fb17ac487535194cf63cc3586083949d1383870f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Darius=20G=C3=B6rgen?= Date: Sat, 21 Jan 2023 15:04:38 +0100 Subject: [PATCH] reactivate s2 calculations and tests on macos (#131) * CRAN release 0.3.0 * reactivate s2 calculations and tests on macos * include error and instructions for SSL certificate issue with nasa_srtm * bump version to 0.3.0 * not manuals for internal functions * disable gfw examples on cran --- DESCRIPTION | 2 +- NEWS.md | 33 +++++++++++---- R/calc_indicator.R | 13 +----- R/calc_treecover_area.R | 2 + R/calc_treecover_area_and_emissions.R | 2 + R/calc_treecoverloss_emissions.R | 2 + R/get_nasa_grace.R | 1 + R/get_nasa_srtm.R | 40 ++++++++++++++++--- R/get_resource.R | 1 + R/utils.R | 2 +- man/dot-get_nasagrace_url.Rd | 18 --------- man/dot-get_single_indicator.Rd | 21 ---------- man/dot-get_single_resource.Rd | 29 -------------- man/nasa_srtm.Rd | 27 ++++++++++--- man/treecover_area.Rd | 2 + man/treecover_area_and_emissions.Rd | 2 + man/treecoverloss_emissions.Rd | 2 + tests/testthat.R | 2 +- .../_snaps/calc_active_fire_properties.md | 2 - tests/testthat/_snaps/calc_landcover.md | 1 - .../testthat/_snaps/calc_population_count.md | 5 --- .../_snaps/calc_precipitation_chirps.md | 5 --- tests/testthat/test-calc_active_fire_counts.R | 1 - .../test-calc_active_fire_properties.R | 1 - tests/testthat/test-calc_biome.R | 1 - tests/testthat/test-calc_ecoregion.R | 1 - tests/testthat/test-calc_mangroves_area.R | 1 - tests/testthat/test-get_nasa_srtm.R | 10 ++++- tests/testthat/test-get_resources.R | 10 +---- tests/testthat/test-portfolio.R | 1 - 30 files changed, 107 insertions(+), 133 deletions(-) delete mode 100644 man/dot-get_nasagrace_url.Rd delete mode 100644 man/dot-get_single_indicator.Rd delete mode 100644 man/dot-get_single_resource.Rd diff --git a/DESCRIPTION b/DESCRIPTION index c6a1b10b..76f07811 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: mapme.biodiversity Title: Efficient Monitoring of Global Biodiversity Portfolios -Version: 0.2.1.9000 +Version: 0.3.0 Authors@R: c( person("Darius A.", "Görgen", , "darius2402@web.de", role = c("aut", "cre")), person("Om Prakash", "Bhandari", role = "aut") diff --git a/NEWS.md b/NEWS.md index 6592c9e8..1646f4b8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,19 +1,31 @@ -# mapme.biodiversity (development version) +# mapme.biodiversity 0.3.0 + +## Breaking changes + +- on MacOS s2-based calculations are now enabled so users can expect the package + to return numerically equivalent results on any operating system (#131) + +- the online source for the `nasa_srtm` resource shows an expired SSL certificate + since November 2022. The get_resources()` function now includes an error and + instructions how to disable SSL certification at a users own risk. The + websites maintainers have been contacted and asked to renew the certification. (#131) ## New features + - GFW resources are now updated to use the latest version allowing analysis for the additional year of 2021 (#123, @fBedecarrats) -- GFW indicators now accecpt numeric `min_size` argument allowing to specify +- GFW indicators now accept numeric `min_size` argument allowing to specify fractional covers (#110) - fire indicators now allow the simultaneous calculation of indicators based on MODIS and VIIRS. Before users had to chose between one of the instruments for each analysis (#126) - + ## Bug fixes + - case when one or multiple assets return NA instead of a tibble is now properly -tested and handled (#101) + tested and handled (#101) - Rasters are no longer temporary written to disk to omit a bug caused by applying mask/classify to an already existing raster file (#108, @Jo-Schie) @@ -23,14 +35,19 @@ tested and handled (#101) - both, `treecoverloss_emissions` and `treecover_area_and_emissions` now return 0 instead of NaN for observation years where now forest loss occurred (#120) - - + ## Internal + - `.make_global_grid()` now specifies the CRS when constructing the bounding box - and returns the grid in the specified CRS instead of Lat/Lon (#113) + and returns the grid in the specified CRS instead of Lat/Lon (#113) - `.calc_active_fire_properties` now uses st_coordinates to retrieve locations - of fires (#119, @DavisVaughan) + of fires (#119, @DavisVaughan) + +- tests for MacOS have been re-enabled (#131) + +- tests for downloading `nasa_srtm` resource are skipped because the SSL certificate + of the online source has expired (#131) # mapme.biodiversity 0.2.1 diff --git a/R/calc_indicator.R b/R/calc_indicator.R index 93c9f85d..68a22914 100644 --- a/R/calc_indicator.R +++ b/R/calc_indicator.R @@ -32,18 +32,6 @@ calc_indicators <- function(x, indicators, ...) { existing_resources, required_resources, needed = TRUE ) - # Fix for MacOS CI error with duplicated vertices in vector resources - # Error in s2_geography_from_wkb(x, oriented = oriented, check = check) : - # Evaluation error: Found 1 feature with invalid spherical geometry. - # [1] Loop 0 is not valid: Edge 821 is degenerate (duplicate vertex). - # https://github.com/r-spatial/sf/issues/1762 suggests to deactivate s2, - # proposition of https://github.com/r-spatial/sf/issues/1902 to dissable - # s2 and fix the geometry has failed, thus for now falling back to lwgeom - if (Sys.info()["sysname"] == "Darwin" | grepl("darwin", Sys.info()["sysname"])) { - s2_org <- sf_use_s2() - suppressMessages(sf_use_s2(FALSE)) - on.exit(suppressMessages(sf_use_s2(s2_org))) - } for (indicator in indicators) x <- .get_single_indicator(x, indicator, ...) x } @@ -59,6 +47,7 @@ calc_indicators <- function(x, indicators, ...) { #' @param ... Additional arguments required by the requested indicators. #' #' @keywords internal +#' @noRd #' @importFrom dplyr relocate last_col #' @importFrom tidyr nest .get_single_indicator <- function(x, indicator, ...) { diff --git a/R/calc_treecover_area.R b/R/calc_treecover_area.R index b7db7673..0f64c35d 100644 --- a/R/calc_treecover_area.R +++ b/R/calc_treecover_area.R @@ -19,6 +19,7 @@ #' @keywords indicator #' @format A tibble with a column for years and treecover (in ha) #' @examples +#' if (Sys.getenv("NOT_CRAN") == "true") { #' library(sf) #' library(mapme.biodiversity) #' @@ -47,6 +48,7 @@ #' ) %>% #' calc_indicators("treecover_area", min_size = 1, min_cover = 30) %>% #' tidyr::unnest(treecover_area))) +#' } NULL #' Calculate tree cover per year based on GFW data sets diff --git a/R/calc_treecover_area_and_emissions.R b/R/calc_treecover_area_and_emissions.R index 8e60ccc0..04f32f38 100644 --- a/R/calc_treecover_area_and_emissions.R +++ b/R/calc_treecover_area_and_emissions.R @@ -21,6 +21,7 @@ #' @keywords indicator #' @format A tibble with a column for years, treecover (in ha), and emissions (in Mg CO2) #' @examples +#' if (Sys.getenv("NOT_CRAN") == "true") { #' library(sf) #' library(mapme.biodiversity) #' @@ -49,6 +50,7 @@ #' ) %>% #' calc_indicators("treecover_area_and_emissions", min_size = 1, min_cover = 30) %>% #' tidyr::unnest(treecover_area_and_emissions))) +#' } NULL diff --git a/R/calc_treecoverloss_emissions.R b/R/calc_treecoverloss_emissions.R index fc25d020..005b2825 100644 --- a/R/calc_treecoverloss_emissions.R +++ b/R/calc_treecoverloss_emissions.R @@ -21,6 +21,7 @@ #' @keywords indicator #' @format A tibble with a column for years and emissions (in Mg) #' @examples +#' if (Sys.getenv("NOT_CRAN") == "true") { #' library(sf) #' library(mapme.biodiversity) #' @@ -49,6 +50,7 @@ #' ) %>% #' calc_indicators("treecoverloss_emissions", min_size = 1, min_cover = 30) %>% #' tidyr::unnest(treecoverloss_emissions))) +#' } NULL #' Calculate emissions statistics diff --git a/R/get_nasa_grace.R b/R/get_nasa_grace.R index 9ac142e5..bc5f0eb1 100644 --- a/R/get_nasa_grace.R +++ b/R/get_nasa_grace.R @@ -50,6 +50,7 @@ NULL #' #' @return A character vector #' @keywords internal +#' @noRd .get_nasagrace_url <- function(target_year) { available_years <- c(2003:2022) dates <- seq.Date(as.Date("2003/02/03"), as.Date("2022/05/16"), by = "week") diff --git a/R/get_nasa_srtm.R b/R/get_nasa_srtm.R index 8916fcdc..5f692569 100644 --- a/R/get_nasa_srtm.R +++ b/R/get_nasa_srtm.R @@ -1,19 +1,33 @@ #' SRTM 30m Digital Elevation Model (DEM) layer #' -#' This resource is published by Farr et al. (2007) "The Shuttle Radar Topography -#' Mission". The layer represents the 30m global terrestrial digital elevation model +#' This resource is published by Jarvis et al. (2008) "Hole-filled seamless SRTM data V4". +#' The layer represents the 30m global terrestrial digital elevation model #' from the NASA Shuttle Radar Topographic Mission (SRTM), available for download as #' 5 degree x 5 degree tiles. It is encoded as meter, representing the elevation #' at the particular grid cell. #' +#' **Important Note**: +#' +#' As of January 2023, the SSL certificate of the website where this resource is downloaded +#' from has expired. We include a check and inform users that this resource might not +#' be downloaded without unsetting SSL certification checks on their own risk. +#' The maintainers of the website have been contacted and asked to renew the +#' certificate. Until then, users can decide to disable the SSL certification +#' checks for their preferred downloading method. Using wget as an example, the +#' following options can be set to disable the SSL checks at your own risk: +#' +#' \code{httr::set_config(httr::config(ssl_verifypeer = 0L))} +#' \code{options(download.file.method="wget", download.file.extra="--no-check-certificate")} +#' +#' This assumes that your are *not* using the aria2 downloader. +#' #' @name nasa_srtm #' @docType data #' @keywords resource #' @format A global tiled raster resource available for all land areas. -#' @references NASA Shuttle Radar Topography Mission (SRTM)(2013). Shuttle Radar -#' Topography Mission (SRTM) Global. Distributed by OpenTopography. -#' https://doi.org/10.5069/G9445JDF. Accessed: 2022-03-17 -#' @source \url{https://srtm.csi.cgiar.org/} +#' @references Jarvis A., H.I. Reuter, A. Nelson, E. Guevara, 2008, +#' Hole-filled seamless SRTM data V4, International Centre for Tropical Agriculture (CIAT). +#' @source https://srtm.csi.cgiar.org/ NULL @@ -29,6 +43,7 @@ NULL .get_nasa_srtm <- function(x, rundir = tempdir(), verbose = TRUE) { + .warn_about_ssl() # make the SRTM grid and construct urls for intersecting tiles grid_srtm <- .make_global_grid( xmin = -180, xmax = 180, dx = 5, @@ -82,3 +97,16 @@ NULL tileId, ".zip" ) } + +.warn_about_ssl <- function(){ + status <- try(httr::http_error("https://srtm.csi.cgiar.org/"), silent = TRUE) + if(inherits(status, "try-error")){ + msg <- paste0( + "The data source for 'nasa_srtm' has an expired SSL certificate.\n ", + "You can disable SSL checks if you still want to download the resource.\n ", + "Note, that when disabling SSL certification you understand and accept\n ", + "the associated risks. See `?nasa_srtm` for further information." + ) + stop(msg) + } +} diff --git a/R/get_resource.R b/R/get_resource.R index d235a5e6..e2049c28 100644 --- a/R/get_resource.R +++ b/R/get_resource.R @@ -63,6 +63,7 @@ get_resources <- function(x, resources, ...) { #' function are matched. If there are missing arguments, the default value is #' used. #' @keywords internal +#' @noRd .get_single_resource <- function(x, resource, ...) { args <- list(...) atts <- attributes(x) diff --git a/R/utils.R b/R/utils.R index a8bdc906..e0376732 100644 --- a/R/utils.R +++ b/R/utils.R @@ -302,7 +302,7 @@ } status <- download.file(missing_urls[i], missing_filenames[i], - quiet = TRUE, "libcurl", + quiet = TRUE, mode = ifelse(Sys.info()["sysname"] == "Windows", "wb", "w") ) if (status != 0) { diff --git a/man/dot-get_nasagrace_url.Rd b/man/dot-get_nasagrace_url.Rd deleted file mode 100644 index 1eb19b4d..00000000 --- a/man/dot-get_nasagrace_url.Rd +++ /dev/null @@ -1,18 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_nasa_grace.R -\name{.get_nasagrace_url} -\alias{.get_nasagrace_url} -\title{Helper function to construct GRACE URLs} -\usage{ -.get_nasagrace_url(target_year) -} -\arguments{ -\item{target_year}{} -} -\value{ -A character vector -} -\description{ -Helper function to construct GRACE URLs -} -\keyword{internal} diff --git a/man/dot-get_single_indicator.Rd b/man/dot-get_single_indicator.Rd deleted file mode 100644 index 41cc9061..00000000 --- a/man/dot-get_single_indicator.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/calc_indicator.R -\name{.get_single_indicator} -\alias{.get_single_indicator} -\title{Calculation of an indicator} -\usage{ -.get_single_indicator(x, indicator, ...) -} -\arguments{ -\item{x}{A sf object returned by init_portfolio().} - -\item{indicator}{A variable length character vector with the indicators to -calculate.} - -\item{...}{Additional arguments required by the requested indicators.} -} -\description{ -This functions let's users calculate on or more biodiversity indicators for -a portfolio. -} -\keyword{internal} diff --git a/man/dot-get_single_resource.Rd b/man/dot-get_single_resource.Rd deleted file mode 100644 index 41ccc42d..00000000 --- a/man/dot-get_single_resource.Rd +++ /dev/null @@ -1,29 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_resource.R -\name{.get_single_resource} -\alias{.get_single_resource} -\title{Internal function used to process a single resource} -\usage{ -.get_single_resource(x, resource, ...) -} -\arguments{ -\item{x}{A portfolio object} - -\item{resource}{A character vector of length one indicating a supported -resource} - -\item{...}{Any additional arguments. The relevant arguments for the indicator -function are matched. If there are missing arguments, the default value is -used.} -} -\description{ -This function is called internally by \code{get_resources()} to process -a single resource. It does argument matching filling any argument not -specified by the user with its default value from the backlog functions. It -informs users about the resource, the argument and the default value. It does -not check for the correctness of user specified arguments (this is handled -within the respective resource function). In the case the resource function -issues a warning or error it fails gracefully informing the user but -continuing processing other requested resources. -} -\keyword{internal} diff --git a/man/nasa_srtm.Rd b/man/nasa_srtm.Rd index 19217691..f250dd4d 100644 --- a/man/nasa_srtm.Rd +++ b/man/nasa_srtm.Rd @@ -8,18 +8,33 @@ A global tiled raster resource available for all land areas. } \source{ -\url{https://srtm.csi.cgiar.org/} +https://srtm.csi.cgiar.org/ } \description{ -This resource is published by Farr et al. (2007) "The Shuttle Radar Topography -Mission". The layer represents the 30m global terrestrial digital elevation model +This resource is published by Jarvis et al. (2008) "Hole-filled seamless SRTM data V4". +The layer represents the 30m global terrestrial digital elevation model from the NASA Shuttle Radar Topographic Mission (SRTM), available for download as 5 degree x 5 degree tiles. It is encoded as meter, representing the elevation at the particular grid cell. } +\details{ +\strong{Important Note}: + +As of January 2023, the SSL certificate of the website where this resource is downloaded +from has expired. We include a check and inform users that this resource might not +be downloaded without unsetting SSL certification checks on their own risk. +The maintainers of the website have been contacted and asked to renew the +certificate. Until then, users can decide to disable the SSL certification +checks for their preferred downloading method. Using wget as an example, the +following options can be set to disable the SSL checks at your own risk: + +\code{httr::set_config(httr::config(ssl_verifypeer = 0L))} +\code{options(download.file.method="wget", download.file.extra="--no-check-certificate")} + +This assumes that your are \emph{not} using the aria2 downloader. +} \references{ -NASA Shuttle Radar Topography Mission (SRTM)(2013). Shuttle Radar -Topography Mission (SRTM) Global. Distributed by OpenTopography. -https://doi.org/10.5069/G9445JDF. Accessed: 2022-03-17 +Jarvis A., H.I. Reuter, A. Nelson, E. Guevara, 2008, +Hole-filled seamless SRTM data V4, International Centre for Tropical Agriculture (CIAT). } \keyword{resource} diff --git a/man/treecover_area.Rd b/man/treecover_area.Rd index 9a8ad821..39fd8d15 100644 --- a/man/treecover_area.Rd +++ b/man/treecover_area.Rd @@ -26,6 +26,7 @@ The following arguments can be set: } } \examples{ +if (Sys.getenv("NOT_CRAN") == "true") { library(sf) library(mapme.biodiversity) @@ -55,4 +56,5 @@ if (!file.exists(temp_loc)) { calc_indicators("treecover_area", min_size = 1, min_cover = 30) \%>\% tidyr::unnest(treecover_area))) } +} \keyword{indicator} diff --git a/man/treecover_area_and_emissions.Rd b/man/treecover_area_and_emissions.Rd index 7ce496c2..4311ae21 100644 --- a/man/treecover_area_and_emissions.Rd +++ b/man/treecover_area_and_emissions.Rd @@ -28,6 +28,7 @@ The following arguments can be set: } } \examples{ +if (Sys.getenv("NOT_CRAN") == "true") { library(sf) library(mapme.biodiversity) @@ -57,4 +58,5 @@ if (!file.exists(temp_loc)) { calc_indicators("treecover_area_and_emissions", min_size = 1, min_cover = 30) \%>\% tidyr::unnest(treecover_area_and_emissions))) } +} \keyword{indicator} diff --git a/man/treecoverloss_emissions.Rd b/man/treecoverloss_emissions.Rd index c1745bd5..893bd853 100644 --- a/man/treecoverloss_emissions.Rd +++ b/man/treecoverloss_emissions.Rd @@ -28,6 +28,7 @@ The following arguments can be set: } } \examples{ +if (Sys.getenv("NOT_CRAN") == "true") { library(sf) library(mapme.biodiversity) @@ -57,4 +58,5 @@ if (!file.exists(temp_loc)) { calc_indicators("treecoverloss_emissions", min_size = 1, min_cover = 30) \%>\% tidyr::unnest(treecoverloss_emissions))) } +} \keyword{indicator} diff --git a/tests/testthat.R b/tests/testthat.R index 90c9cc72..65029260 100644 --- a/tests/testthat.R +++ b/tests/testthat.R @@ -3,5 +3,5 @@ library(mapme.biodiversity) library(pbapply) pboptions(type = "none") -options(pillar.advice = TRUE) +options(pillar.advice = FALSE) test_check("mapme.biodiversity") diff --git a/tests/testthat/_snaps/calc_active_fire_properties.md b/tests/testthat/_snaps/calc_active_fire_properties.md index aa61e96c..aa292b1d 100644 --- a/tests/testthat/_snaps/calc_active_fire_properties.md +++ b/tests/testthat/_snaps/calc_active_fire_properties.md @@ -20,7 +20,6 @@ # type , longitude , latitude , and abbreviated variable names # 1: bright_ti4, 2: acq_date, 3: acq_time, 4: satellite, 5: instrument, # 6: confidence, 7: bright_ti5 - # i Use `print(n = ...)` to see more rows, and `colnames()` to see all variable names --- @@ -44,5 +43,4 @@ # type , longitude , latitude , and abbreviated variable names # 1: bright_ti4, 2: acq_date, 3: acq_time, 4: satellite, 5: instrument, # 6: confidence, 7: bright_ti5 - # i Use `print(n = ...)` to see more rows, and `colnames()` to see all variable names diff --git a/tests/testthat/_snaps/calc_landcover.md b/tests/testthat/_snaps/calc_landcover.md index 93a5187f..8c5b4e9e 100644 --- a/tests/testthat/_snaps/calc_landcover.md +++ b/tests/testthat/_snaps/calc_landcover.md @@ -17,5 +17,4 @@ 9 herbaceous_vegetation 2018 1836. 10 herbaceous_vegetation 2019 1836. # ... with 45 more rows - # i Use `print(n = ...)` to see more rows diff --git a/tests/testthat/_snaps/calc_population_count.md b/tests/testthat/_snaps/calc_population_count.md index 43fe4917..25f71ea8 100644 --- a/tests/testthat/_snaps/calc_population_count.md +++ b/tests/testthat/_snaps/calc_population_count.md @@ -17,7 +17,6 @@ 9 4784. 2008 10 4923. 2009 # ... with 11 more rows - # i Use `print(n = ...)` to see more rows --- @@ -38,7 +37,6 @@ 9 20.9 17.7 12.3 2008 10 21.5 17.7 12.7 2009 # ... with 11 more rows - # i Use `print(n = ...)` to see more rows --- @@ -59,7 +57,6 @@ 9 4784. 2008 10 4923. 2009 # ... with 11 more rows - # i Use `print(n = ...)` to see more rows --- @@ -80,7 +77,6 @@ 9 4804. 2008 10 4946. 2009 # ... with 11 more rows - # i Use `print(n = ...)` to see more rows --- @@ -101,5 +97,4 @@ 9 7518. 2008 10 7718. 2009 # ... with 11 more rows - # i Use `print(n = ...)` to see more rows diff --git a/tests/testthat/_snaps/calc_precipitation_chirps.md b/tests/testthat/_snaps/calc_precipitation_chirps.md index ec5462fd..31a8c011 100644 --- a/tests/testthat/_snaps/calc_precipitation_chirps.md +++ b/tests/testthat/_snaps/calc_precipitation_chirps.md @@ -18,7 +18,6 @@ 9 2000-09-01 142 -10.3 0.342 10 2000-10-01 131 -15.2 0.253 # ... with 122 more rows - # i Use `print(n = ...)` to see more rows --- @@ -41,7 +40,6 @@ 9 2000-09-01 142 -10.3 0.747 0.0848 10 2000-10-01 131 -15.2 0.272 0.138 # ... with 122 more rows - # i Use `print(n = ...)` to see more rows --- @@ -64,7 +62,6 @@ 9 2000-09-01 142 -10.3 0.342 10 2000-10-01 131 -15.2 0.253 # ... with 122 more rows - # i Use `print(n = ...)` to see more rows --- @@ -87,7 +84,6 @@ 9 2000-09-01 130. -9.78 0.299 10 2000-10-01 120. -18.8 0.164 # ... with 122 more rows - # i Use `print(n = ...)` to see more rows --- @@ -110,6 +106,5 @@ 9 1985-09-01 185 32.7 -0.675 -0.270 10 1985-10-01 176 29.8 -0.106 -0.486 # ... with 182 more rows - # i Use `print(n = ...)` to see more rows diff --git a/tests/testthat/test-calc_active_fire_counts.R b/tests/testthat/test-calc_active_fire_counts.R index 4f595095..bb14273e 100644 --- a/tests/testthat/test-calc_active_fire_counts.R +++ b/tests/testthat/test-calc_active_fire_counts.R @@ -1,5 +1,4 @@ test_that("active fire count works", { - skip_on_os("mac") shp <- read_sf( system.file("extdata", "sierra_de_neiba_478140_2.gpkg", package = "mapme.biodiversity" diff --git a/tests/testthat/test-calc_active_fire_properties.R b/tests/testthat/test-calc_active_fire_properties.R index 7a604e07..8848f22e 100644 --- a/tests/testthat/test-calc_active_fire_properties.R +++ b/tests/testthat/test-calc_active_fire_properties.R @@ -1,5 +1,4 @@ test_that("active fire properties works", { - skip_on_os("mac") shp <- read_sf( system.file("extdata", "sierra_de_neiba_478140_2.gpkg", package = "mapme.biodiversity" diff --git a/tests/testthat/test-calc_biome.R b/tests/testthat/test-calc_biome.R index 419b7628..a8860318 100644 --- a/tests/testthat/test-calc_biome.R +++ b/tests/testthat/test-calc_biome.R @@ -1,5 +1,4 @@ test_that("biome computation works", { - skip_on_os("mac") shp <- read_sf( system.file("extdata", "sierra_de_neiba_478140.gpkg", package = "mapme.biodiversity" diff --git a/tests/testthat/test-calc_ecoregion.R b/tests/testthat/test-calc_ecoregion.R index 2a351265..98bf894c 100644 --- a/tests/testthat/test-calc_ecoregion.R +++ b/tests/testthat/test-calc_ecoregion.R @@ -1,5 +1,4 @@ test_that("ecoregion computation works", { - skip_on_os("mac") shp <- read_sf( system.file("extdata", "sierra_de_neiba_478140.gpkg", package = "mapme.biodiversity" diff --git a/tests/testthat/test-calc_mangroves_area.R b/tests/testthat/test-calc_mangroves_area.R index 459f2512..ef7a04a3 100644 --- a/tests/testthat/test-calc_mangroves_area.R +++ b/tests/testthat/test-calc_mangroves_area.R @@ -1,5 +1,4 @@ test_that("mangrove extent works", { - skip_on_os("mac") shp <- read_sf( system.file("extdata", "shell_beach_protected_area_41057_B.gpkg", package = "mapme.biodiversity" diff --git a/tests/testthat/test-get_nasa_srtm.R b/tests/testthat/test-get_nasa_srtm.R index c0baf0a9..8142ac21 100644 --- a/tests/testthat/test-get_nasa_srtm.R +++ b/tests/testthat/test-get_nasa_srtm.R @@ -26,8 +26,14 @@ test_that(".get_nasa_srtm works", { # Add testing attribute in order to skip downloads attributes(portfolio)$testing <- TRUE - expect_equal( + expect_error( .get_nasa_srtm(portfolio), + "SSL certification" + ) + + skip("Disabled until SSL certification is renewed.") + expect_equal( + suppressWarnings(.get_nasa_srtm(portfolio)), "srtm_22_09.zip" ) @@ -43,7 +49,7 @@ test_that(".get_nasa_srtm works", { ) attributes(portfolio)$testing <- TRUE expect_equal( - .get_nasa_srtm(portfolio), + suppressWarnings(.get_nasa_srtm(portfolio)), "srtm_22_09.zip" ) }) diff --git a/tests/testthat/test-get_resources.R b/tests/testthat/test-get_resources.R index 0f18c3c2..a4efda62 100644 --- a/tests/testthat/test-get_resources.R +++ b/tests/testthat/test-get_resources.R @@ -22,14 +22,6 @@ test_that("get_resources works", { verbose = FALSE ) - expect_message( - get_resources(portfolio, - resources = c("gfw_treecover", "gfw_lossyear", "gfw_emissions"), - vers_lossyear = "GFC-2020-v1.8" - ), - "Setting to default value of" - ) - expect_error( get_resources(portfolio, resources = c("not_available") @@ -50,6 +42,6 @@ test_that("get_resources works", { ) expect_warning( - get_resources(portfolio, "treecover2000") + get_resources(portfolio, "treecover2000", vers_treecover="GFC-2020-v1.8") ) }) diff --git a/tests/testthat/test-portfolio.R b/tests/testthat/test-portfolio.R index ec1b251c..deb87433 100644 --- a/tests/testthat/test-portfolio.R +++ b/tests/testthat/test-portfolio.R @@ -1,5 +1,4 @@ test_that("init_portfolio works", { - options(pillar.advice = FALSE) aoi <- read_sf( system.file("extdata", "sierra_de_neiba_478140.gpkg", package = "mapme.biodiversity"