This is a major restructuring of the code logic to better separate between file-based netCDF objects and in-memory CF objects. Additionally, there are important additions to the user-facing API, in particular with regards to arithmetic, math and logical expressions on CF objects.
CFAxisVertical
can now calculate parametric coordinates
for two ocean formulations (other formulations will be added as sample
data becomes available to test new code on - open an issue if you have such
data and are looking for support). Optional use of the
units
package to deal with the various pressure units. This
package is recommended if you work with data on the atmosphere or the
ocean.CF$standard_names$find()
method. The table (currently
4.3MB) will be stored in the local cache of the ncdfCF package and
periodically updated with the latest version.CFArray
class has been merged with
CFVariable
. This makes for more concise code and easier
combination of multiple operations on a single netCDF resource. All
functionality remains.as_CF()
function you can create a
CFVariable
instance from an R object such as a vector,
matrix or array using logical, integer, double or character mode. Axes
are created from dimnames, using names when set (such as in
dimnames(arr) <- list(X = 40:43, Y = 50:54, Z = 60:65)
)
and possibly with latitude, longitude and time axes generated.CFVariable
instances.CFAxis
descendant classes now have a
copy()
method which creates a deep copy of the axis and a
copy_with_values()
method that makes a copy of the current
axis but with new values.axisB <- axisA$copy()
, the new
axisB
instance will have file access (assuming that
axisA
has it too). Same with
CFVariable$$subset()
and $profile()
.
CFVariable$summarise()
does not retain access because the
array values are modified. Math and Ops function results likewise do not
retain file access.CFAxis$coordinate_range
field to retrieve the range
of the coordinates of the axis.CFObject
, those in NCObject
are
read from file and immutable.CFVariable
has absorbed classes
CFArray
and CFVariableBase
.CFArray$new()
writes coordinates
attribute
for scalar axes.profile()
method for CFVariable
and
CFArray
. With this method profiles can be extracted from
the data, having a user-selectable dimensionality and location. Examples
are temporal profiles at a given location or a zonal (lat or long)
vertical profile of the atmosphere, but there are many other options.
Multiple profiles can be extracted in a single call and they can be
generated as a list of CFArray
instances or as a single
data.table
.append()
method for CFArray
. With this
method you can append a CFArray
instance to another
CFArray
instance, along a single, selectable axis with all
other axes being identical. This is especially useful to append time
series data spread over multiple files, as is often the case with CMIP
data. Given the large size of many such files, it is often necessary to
subset()
the data variable first before appending.subset()
method signature changed to have similar
signature as the new profile()
method.indexOf()
method on axes is using boundary values
consistently.CFVariable$subset(time = "2025-04-17")
.CFArray
instance to file automatically
orients the data into the canonical axis order of X - Y - Z - T -
others.CFAxis
has several methods added to work with multiple
sets of auxiliary coordinates associated with the axis.CFLabel
has print()
and
write()
methods.CFVariable::subset()
can subset over a discrete axis
with auxiliary coordinates.summarise()
can now summarise over eras. This yields a
climatological statistic which is now supported with the appropriate
“time” axis description.actual_range
attribute is set on data arrays, axes and
bounds.CFDataset$var_names
and
CFDataset$axis_names
fields.values
fields made private. Read-only access
provided throughCFAxis$values
and
CFAxis$coordinates
(preferred) for consistent access
patterns throughout the axis class hierarchy.print()
without enclosing data set.summarise()
when temporal result yields scalar
time axis.CFArray
when the original netCDF
file was packed as well.CFData
has been renamed CFArray
to more
accurately describe its contents.CFArray
objects can now be written to a netCDF
file.CFVariable$summarise()
and
CFArray$summarise()
summarise the temporal dimension of a
data object to a lower resolution using a user-supplied function, using
the specific calendar of the temporal dimension and returning a new
CFArray
object with the summarised data for every return
value of a call to the function, i.e. the function may have multiple
return values. The CFArray
version is much faster (because
all data has been read already), but the CFVariable
version
can also summarise data variables that are too big to fit into the
available memory entirely. In either case, code is optimized compared to
the R base version so an operation over the “time” dimension of a data
array is about twice as fast as using the base R
apply(X, MARGIN, tapply, INDEX, FUN, ...)
call.CFArray$data.table()
exports a data object to a
data.table
.CFVariable
and CFArray
classes now have
time()
method to retrieve the “time” axis or its
CFTime
instance, if present.CFAxis
has new coordinates
field with
which to retrieve the coordinates along the axis.CFResource
fixed to conform to new R6
version.peek_ncdf()
returns quick-view information on
a netCDF resource.makeMemoryGroup()
,
makeLongitudeAxis()
and makeLatitudeAxis()
added to create scaffolding for new CF objects.NCGroup::unused()
method identifies unused
NCVariable
s to aid in finding issues with netCDF
resources.print()
method for NCVariable
and
NCDimension
.CFObject$fullname
added, giving fully-qualified
CF object name.NCGroup
moved down to
CFObject
for CF objects.CFVariable$subset()
as an
instance of the CFData
class, with associated objects such
as axes and the attributes from the variable. Data can be read out in a
variety of forms, currently as a raw array, an oriented array or as a
terra::SpatRaster
or
terra::SpatRasterDataset
.objects_by_standard_name()
will list objects in the
netCDF resource that have a “standard_name” attribute.dimnames()
and
length()
.[
selection operator
for use with dimension indices. Use real-world coordinates with
subset()
.