read_ncvar: Read single variable from NetCDF file

Description Usage Arguments

Description

Read single variable from NetCDF file

Usage

1
read_ncvar(nc, varid, get_attributes = TRUE, ...)

Arguments

nc

An object of class ncdf4 (as returned by either function nc_open or function nc_create), indicating what file to read from.

varid

What variable to read the data from. Can be a string with the name of the variable or an object of class ncvar4 If left unspecified, the function will determine if there is only one variable in the file and, if so, read from that. If left unspecified and there are multiple variables in the file, an error is generated. This argument can also, optionally, specify the name of a dimension (usually the unlimited dimension) in order to read values from a coordinate variable. Note this is not usual practice, because the ncdim object already contains all the dimension's values in the field named "vals". However, it can sometimes be faster to turn off this automatic reading of the unlimited dimension's values by using nc_open(filename, readunlim=FALSE), then read the dimension values in later with this function.

get_attributes

Add attributes from NetCDF variable to returned value


ashiklom/riri documentation built on May 5, 2019, 4:47 p.m.