Convenience wrapper that delegates to terra::rast(). Reads the
file at path and returns a SpatRaster, optionally restricted to a
single variable. terra and ncdf4 must be installed (both are listed
in Suggests:).
Arguments
- path
Character. Path to a netCDF file.
- var
Character or
NULL. Variable to extract. IfNULL, the default behaviour ofterra::rast()applies.
Examples
if (FALSE) { # \dontrun{
r <- ck_from_netcdf("tas_day.nc", var = "tas")
terra::nlyr(r) # number of daily layers
} # }