The return format is specified by out
. It can be a data table in which each
column is a variable and each row, an observation; an array with named
dimensions; or a vector. Since it's possible to return multiple arrays or
vectors (one for each variable), for consistency the return type is always a
list. Either of these two options are much faster than the
first since the most time consuming part is the melting of the array
returned by ncdf4::ncvar_get. out = "vector"
is particularly useful for
adding new variables to an existing data frame with the same dimensions.
Finally, it can also be vars
, in which case it returns a list with the name
of the available variables and the dimensions of the spatiotemporal grid.
When not all variables specified in vars
have the same number of dimensions,
the shorter variables will be recycled. E.g. if reading a 3D pressure field
and a 2D surface temperature field, the latter will be turned into a 3D field
with the same values in each missing dimension.