Closed mdsumner closed 5 years ago
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) ## e.g. # nc <- create.nc("d.nc") # dim.def.nc(nc, "a", 1) # dim.def.nc(nc, "b", 2) # dim.def.nc(nc, "c", 3) # dim.def.nc(nc, "d", 1) # var.def.nc(nc, "data", "NC_DOUBLE", c(0,1,2,3)) # var.put.nc(nc, "data", array(1, dim = c(1, 2, 3, 1))) # close.nc(nc) dim(var.get.nc(open.nc("d.nc"), "data", collapse = FALSE)) # 1, 2, 3, 1
Why that no work in R13352.nc?
because ncdf4 and RNetCDF drop the NC_CHAR dimension and return a vector of strings, and not padded to the dim length
Why that no work in R13352.nc?