Learn R Programming

ncdfCF (version 0.4.0)

NCGroup: 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.

Arguments

Super class

ncdfCF::NCObject -> NCGroup

Public fields

resource

Access to the underlying netCDF resource.

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.

CFlabels

List of labels located in this group.

CFaux

List of auxiliary variables. These could be CFAxisScalar or CFAuxiliaryLongLat that hold longitude and latitude values for every grid point in the data variable that references them.

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

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. NULL for the root group.

resource

Reference to the CFResource instance that provides access to the netCDF resource.


Method print()

Summary of the group printed to the console.

Usage

NCGroup$print(...)

Arguments

...

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 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 CFaux 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 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.