CFVariable instance from an R objectWith this function you can convert an R object into a CFVariable. This can
be an array, matrix or vector of type logical, integer, numeric or
character.
as_CF(name, values)An instance of class CFVariable.
The name of the CFVariable to create.
The data of this object. This can be an array, matrix or vector
of type logical, integer, numeric or character.
Dimnames on the R object will be converted to instances of a CFAxis
descendant class, depending on their values. If the dimnames along a
dimension of the R object can be converted to numeric, then it will be an
instance of CFAxisNumeric. If the dimnames are character, a first attempt
is made to create a CFAxisTime (i.e. the dimnames have to represent
timestamps), failing that a CFAxisCharacter will be created. If no dimnames
are set, an instance of CFAxisDiscrete is generated.
The axes of the CFVariable are oriented as in the R object. Note that this
is different from standard practice in the netCDF community and the
portability of saved datasets is thus limited. You can improve this situation
by setting the orientation of the axes and by adding attributes.
After creation of the CFVariable, it is recommended to set other
properties, such as attributes or a coordinate reference system.