Closed mdsumner closed 5 years ago
Saved this set of meta objects into many_meta.rds
f <- raadfiles::get_raad_filenames() %>% dplyr::filter(stringr::str_detect(file, "nc$")) %>%
group_by((dirname(dirname(file)))) %>% slice(1) %>% ungroup() %>% sample_frac(1) %>% transmute(fullname = file.path(root, file))
dim(f)
f <- f[!grepl("RRS.nc$",basename(f$fullname)), ]
dim(f)
safefun <- purrr::safely(function(x) ncmeta::nc_meta(x))
system.time(a <- furrr::future_map(f$fullname, safefun))
#get all attribute tables
##d <- purrr::map_dfr(a, ~if (is.null(.x$error)) .x$result$attribute else NULL, .id = "ch")
Another problem is $attribute sometimes 0-rows (becomes NULL in tidync)
ncmeta::nc_atts("~/Git/rasterwise/extdata/high-dim/test-1.nc")
# A tibble: 0 x 0
Now fixed:
nc_atts(f[1])
# A tibble: 48 x 4
id name variable value
<dbl> <chr> <chr> <list>
1 -1 product_name NC_GLOBAL <chr [1]>
2 -1 title NC_GLOBAL <chr [1]>
3 -1 instrument NC_GLOBAL <chr [1]>
4 -1 platform NC_GLOBAL <chr [1]>
5 -1 temporal_range NC_GLOBAL <chr [1]>
6 -1 start_orbit_number NC_GLOBAL <dbl [1]>
7 -1 end_orbit_number NC_GLOBAL <dbl [1]>
8 -1 date_created NC_GLOBAL <chr [1]>
9 -1 processing_version NC_GLOBAL <chr [1]>
10 -1 history NC_GLOBAL <chr [1]>
# … with 38 more rows
Warning message:
In nc_atts.NetCDF(nc, variable = variable) : no variables recognizable
> nc_atts(f[2])
# A tibble: 124 x 4
id name variable value
<dbl> <chr> <chr> <list>
1 0 standard_name lon <chr [1]>
ncmeta::nc_atts("~/Git/rasterwise/extdata/high-dim/test-1.nc")
# A tibble: 0 x 4
# … with 4 variables: id <dbl>, name <chr>, variable <chr>, value <list>
Compare
It should probably include the ID, but at least make sure that dummy NC_GLOBAL thing is consistent: