Skip to main content

5. stars testing

  • number: 5
  • opened: 2019-01-24
  • state when archived: open
  • url when archived: https://github.com/rgdal-dev/rasterwise/issues/5
  • archived: 2026-11-06 (authors omitted; email addresses and reply headers redacted; non-ASCII transliterated)

Opening post


files <- fs::dir_ls("../rasterwise/extdata/", recursive = TRUE, glob = "*.nc")
x <- purrr::map(files, purrr::possibly(read_ncdf, NULL))
bad <- purrr::map_lgl(x, is.null)
sum(bad)  ## 1 is bad, for some reason the 1-dim first dimension of /rasterwise/extdata/R13352.nc is
          ## dropped even is collapse = FALSE (not TRUE for basic other cases)

ebad <- logical(length(bad))

for (i in seq_along(files)) {
  if (bad[i]) next;
  x <- purrr::map(ncmeta::nc_vars(files[i])$name, 
                  ~purrr::safely(read_ncdf)(files[i], var = .x))
  ibad <- purrr::map_lgl(x, ~!is.null(.x$error))
  if (any(ibad)) ebad[i] <- TRUE
}