hyper_tibble {tidync} | R Documentation |
Extract NetCDF data as an expanded table.
Description
Extract the raw array data as an expanded data frame. This can be the entire
variable/s or after dimension-slicing using hyper_filter()
expressions with
dimension values expanded appropriately for each element in the arrays (one
row per element).
Usage
hyper_tibble(x, ..., na.rm = TRUE, force = FALSE)
## S3 method for class 'character'
hyper_tibble(x, ..., na.rm = TRUE, force = FALSE)
## S3 method for class 'tidync'
hyper_tibble(x, ..., na.rm = TRUE, force = FALSE)
Arguments
x |
NetCDF file, connection object, or |
... |
arguments to 'hyper_filter“ |
na.rm |
if |
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 function hyper_tibble()
will act on an existing tidync object or a source
string.
By default all variables in the active grid are returned, use select_var
to
limit.
Value
a tbl_df
See Also
hyper_array()
and hyper_tbl_cube()
which are also delay-breaking
functions that cause data to be read
Examples
l3file <- "S20080012008031.L3m_MO_CHL_chlor_a_9km.nc"
f <- system.file("extdata", "oceandata", l3file, package= "tidync")
rnc <- tidync(f)
hyper_filter(rnc)
library(dplyr)
lapply(hyper_array(f, lat = lat > 0, lon = index > 3000), dim)
ht <- hyper_tibble(rnc) %>%
filter(!is.na(chlor_a))
ht
library(ggplot2)
ggplot(ht %>% filter(!is.na(chlor_a)),
aes(x = lon, y = lat, fill = chlor_a)) + geom_tile()