NCGroup {ncdfCF} | R Documentation |
NetCDF group
Description
This class represents a netCDF group, the object that holds elements like dimensions and variables of a netCDF file. This class also holds references to any CF objects based on the netCDF elements held by the group.
Direct access to groups is usually not necessary. The principal objects held by the group, CF data variables and axes, are accessible via other means. Only for access to the group attributes is a reference to a group required.
Super class
ncdfCF::NCObject
-> NCGroup
Public fields
resource
Access to the underlying netCDF resource. This can be
NULL
for instances created in memory.fullname
The fully qualified absolute path of the group.
parent
Parent group of this group, the owning
CFDataset
for the root group.subgroups
List of child
NCGroup
instances of this group.NCvars
List of netCDF variables that are located in this group.
NCdims
List of netCDF dimensions that are located in this group.
NCudts
List of netCDF user-defined types that are located in this group.
CFvars
List of CF data variables in this group. There must be a corresponding item in
NCvars
for each item in this list.CFaxes
List of axes of CF data variables in this group. There must be a corresponding item in
NCvars
for each item in this list. Note that the CF data variable(s) that an axis is associated with may be located in a different group. Also, objects that further describe the basic axis definition, such as its bounds, labels, ancillary data, may be located in a different group; all such elements can be accessed directly from the CFAxis instances that this list holds.CFaux
List of auxiliary coordinates located in this group. These could be CFLabel instances or an axis.
CFlonglat
List of CFAuxiliaryLongLat that hold longitude and latitude values for every grid point in the data variable that references them.
CFmeasures
List of cell measures variables in this group.
CFcrs
List of grid mappings located in this group.
Active bindings
friendlyClassName
(read-only) A nice description of the class.
handle
(read-only) Get the handle to the netCDF resource for the group
root
(read-only) Retrieve the root group.
data_set
(read-only) Retrieve the CFDataset that the group belongs to.
Methods
Public methods
Inherited methods
Method new()
Create a new instance of this class.
Usage
NCGroup$new(id, name, fullname, parent, resource)
Arguments
id
The identifier of the group.
name
The name of the group.
fullname
The fully qualified name of the group.
parent
The parent group of this group. the owning CFDataset for the root group.
resource
Reference to the CFResource instance that provides access to the netCDF resource. For in-memory groups this can be
NULL
.
Method print()
Summary of the group printed to the console.
Usage
NCGroup$print(stand_alone = TRUE, ...)
Arguments
stand_alone
Logical to indicate if the group should be printed as an object separate from other objects (
TRUE
, default), or print as part of an enclosing object (FALSE
)....
Passed on to other methods.
Method hierarchy()
Prints the hierarchy of the group and its subgroups to the console, with a summary of contained objects. Usually called from the root group to display the full group hierarchy.
Usage
NCGroup$hierarchy(idx = 1L, total = 1L)
Arguments
idx, total
Arguments to control indentation. Should both be 1 (the default) when called interactively. The values will be updated during recursion when there are groups below the current group.
Method find_by_name()
Find an object by its name. Given the name of an object,
possibly preceded by an absolute or relative group path, return the
object to the caller. Typically, this method is called
programmatically; similar interactive use is provided through the
[[.CFDataset
operator.
Usage
NCGroup$find_by_name(name, scope = "CF")
Arguments
name
The name of an object, with an optional absolute or relative group path from the calling group. The object must either an CF construct (data variable, axis, auxiliary axis, label, or grid mapping) or an NC group, dimension or variable.
scope
Either "CF" (default) for a CF construct, or "NC" for a netCDF group, dimension or variable.
Returns
The object with the provided name in the requested scope. If the
object is not found, returns NULL
.
Method find_dim_by_id()
Find an NC dimension object by its id. Given the id of a dimension, return the NCDimension object to the caller. The dimension has to be found in the current group or any of its parents.
Usage
NCGroup$find_dim_by_id(id)
Arguments
id
The id of the dimension.
Returns
The NCDimension object with an identifier equal to the id
argument. If the object is not found, returns NULL
.
Method has_name()
Has a given name been defined in this group already?
Usage
NCGroup$has_name(name, scope = "both")
Arguments
name
Character string. The name will be searched for, regardless of case.
scope
Either "CF" for a CF construct, "NC" for a netCDF variable, or "both" (default) to test both scopes.
Returns
TRUE
if name
is present in the group, FALSE
otherwise.
Method unused()
Find NC variables that are not referenced by CF objects. For debugging purposes only.
Usage
NCGroup$unused()
Returns
List of NCVariable.
Method addAuxiliaryLongLat()
Add an auxiliary long-lat variable to the group. This method
creates a CFAuxiliaryLongLat from the arguments and adds it to the
group CFlonglat
list, but only if the combination of lon
, lat
isn't
already present.
Usage
NCGroup$addAuxiliaryLongLat(lon, lat, bndsLong, bndsLat)
Arguments
lon, lat
Instances of NCVariable having a two-dimensional grid of longitude and latitude values, respectively.
bndsLong, bndsLat
Instances of CFBounds with the 2D bounds of the longitude and latitude grid values, respectively, or
NULL
when not set.
Returns
self
invisibly.
Method addCellMeasure()
Add a cell measure variable to the group.
Usage
NCGroup$addCellMeasure(cm)
Arguments
cm
Instance of CFCellMeasure.
Returns
self
invisibly.
Method fullnames()
This method lists the fully qualified name of this group, optionally including names in subgroups.
Usage
NCGroup$fullnames(recursive = TRUE)
Arguments
recursive
Should subgroups be scanned for names too (default is
TRUE
)?
Returns
A character vector with group names.
Method dimensions()
List all the dimensions that are visible from this group including those that are defined in parent groups (by names not defined by any of their child groups in direct lineage to the current group).
Usage
NCGroup$dimensions()
Returns
A vector of NCDimension objects.
Method variables()
This method lists the CF data variables located in this group, optionally including data variables in subgroups.
Usage
NCGroup$variables(recursive = TRUE)
Arguments
recursive
Should subgroups be scanned for CF data variables too (default is
TRUE
)?
Returns
A list of CFVariable.
Method axes()
This method lists the axes located in this group, optionally including axes in subgroups.
Usage
NCGroup$axes(recursive = TRUE)
Arguments
recursive
Should subgroups be scanned for axes too (default is
TRUE
)?
Returns
A list of CFAxis descendants.
Method grid_mappings()
This method lists the grid mappings located in this group, optionally including grid mappings in subgroups.
Usage
NCGroup$grid_mappings(recursive = TRUE)
Arguments
recursive
Should subgroups be scanned for grid mappings too (default is
TRUE
)?
Returns
A list of CFGridMapping instances.
Method clone()
The objects of this class are cloneable with this method.
Usage
NCGroup$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.