% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gridded.R
\name{ck_from_netcdf}
\alias{ck_from_netcdf}
\title{Read a netCDF File as a SpatRaster}
\usage{
ck_from_netcdf(path, var = NULL)
}
\arguments{
\item{path}{Character. Path to a netCDF file.}

\item{var}{Character or \code{NULL}. Variable to extract. If \code{NULL}, the
default behaviour of \code{\link[terra:rast]{terra::rast()}} applies.}
}
\value{
A SpatRaster (one layer per time step in the netCDF file).
}
\description{
Convenience wrapper that delegates to \code{\link[terra:rast]{terra::rast()}}. Reads the
file at \code{path} and returns a SpatRaster, optionally restricted to a
single variable. terra and ncdf4 must be installed (both are listed
in \verb{Suggests:}).
}
\examples{
\dontrun{
  r <- ck_from_netcdf("tas_day.nc", var = "tas")
  terra::nlyr(r)  # number of daily layers
}
}
