hyper_tbl_cube {tidync} | R Documentation |
A dplyr cube tbl
Description
Produce a tbl_cube from NetCDF. This is a delay-breaking function and causes data to be read from the source into the tbl cube format defined in the dplyr package.
Usage
hyper_tbl_cube(x, ..., force = FALSE)
## S3 method for class 'tidync'
hyper_tbl_cube(x, ..., force = FALSE)
## S3 method for class 'character'
hyper_tbl_cube(x, ..., force = FALSE)
Arguments
x |
tidync object |
... |
arguments for |
force |
ignore caveats about large extraction and just do it |
Details
The size of an extraction is checked and if quite large there is an a user-controlled
prompt to proceed or cancel. This can be disabled with options(tidync.large.data.check = FALSE)
please see
hyper_array()
for more details.
The tbl cube is a very general and arbitrarily-sized array that can be used with tidyverse functionality. Dimension coordinates are stored with the tbl cube, derived from the grid transforms.
Value
tbl_cube
dplyr::tbl_cube
See Also
hyper_array()
and hyper_tibble()
which are also delay-breaking
functions that cause data to be read
Examples
f <- "S20080012008031.L3m_MO_CHL_chlor_a_9km.nc"
l3file <- system.file("extdata/oceandata", f, package= "tidync")
(cube <- hyper_tbl_cube(tidync(l3file) %>%
activate(chlor_a), lon = lon > 107, lat = abs(lat) < 30))
ufile <- system.file("extdata", "unidata", "test_hgroups.nc",
package = "tidync", mustWork = TRUE)
## some versions of NetCDF don't support this file
## (4.1.3 tidync/issues/82)
group_nc <- try(tidync(ufile), silent = TRUE)
if (!inherits(group_nc, "try-error")) {
res <- hyper_tbl_cube(tidync(ufile))
print(res)
} else {
## the error was
writeLines(c(group_nc))
}