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
}