This class holds the data that is extracted from a CFVariable,
using the subset() class method. The instance of this class will
additionally have the axes and other relevant information such as its
attributes (as well as those of the axes) and the coordinate reference system.
The class has a number of utility functions to extract the data in specific formats:
raw(): The data without any further processing. The axes are
as they are stored in the netCDF resource; there is thus no guarantee as to
how the data is organized in the array. Dimnames will be set.
array(): An array of the data which is organized as a standard R array
with the axes of the data permuted to Y-X-others and Y-values in decreasing
order. Dimnames will be set.
terra(): The data is returned as a terra::SpatRaster (3D) or
terra::SpatRasterDataset (4D) object, with all relevant structural
metadata set. Package terra must be installed for this to work.
In general, the metadata from the netCDF resource will be lost when exporting to a different format insofar as those metadata are not recognized by the different format.
ncdfCF::CFObject -> CFData
groupThe NCGroup that this variable is defined in.
valueThe data of this object. The structure of the data depends
on the method that produced it. Typical structures are an array or a
data.table.
axesList of instances of classes descending from CFAxis that are the axes of the data object.
crsCharacter string of the WKT2 of the CRS of the data object.
Inherited methods
new()Create an instance of this class.
CFData$new(name, group, value, axes, crs, attributes)nameThe name of the object.
groupThe group that this data should live in. This is usually an in-memory group, but it could be a regular group if the data is prepared for writing into a new netCDF file.
valueThe data of this object. The structure of the data depends on the method that produced it.
axesA list of CFAxis descendant instances that describe the
axes of the argument value.
crsThe WKT string of the CRS of this data object.
attributesA data.frame with the attributes associated with the
data in argument value.
An instance of this class.
raw()Retrieve the data in the object exactly as it was produced
by the operation on CFVariable.
CFData$raw()The data in the object. This is usually an array with the
contents along axes varying.
array()Retrieve the data in the object in the form of an R array, with axis ordering Y-X-others and Y values going from the top down.
CFData$array()An array of data in R ordering.
terra()Convert the data to a terra::SpatRaster (3D) or a
terra::SpatRasterDataset (4D) object. The data
will be oriented to North-up. The 3rd dimension in the data will become
layers in the resulting SpatRaster, any 4th dimension the data sets.
CFData$terra()A terra::SpatRaster or terra::SpatRasterDataset instance.
clone()The objects of this class are cloneable with this method.
CFData$clone(deep = FALSE)deepWhether to make a deep clone.