Learn R Programming

ncdfCF (version 0.2.1)

CFDataset: CF data set

Description

This class represents a CF data set, the object that encapsulates a netCDF resource. You should never have to instantiate this class directly; instead, call open_ncdf() which will return an instance that has all properties read from the netCDF resource. Class methods can then be called, or the base R functions called with this instance.

Arguments

Public fields

name

The name of the netCDF resource. This is extracted from the URI (file name or URL).

keep_open

Logical flag to indicate if the netCDF resource has to remain open after reading the metadata. This should be enabled typically only for programmatic access or when a remote resource has an expensive access protocol (i.e. 2FA). The resource has to be explicitly closed with close() after use. Note that when a data set is opened with keep_open = TRUE the resource may still be closed by the operating system or the remote server.

root

Root of the group hierarchy through which all elements of the netCDF resource are accessed. It is strongly discouraged to manipulate the objects in the group hierarchy directly. Use the provided access methods instead.

Active bindings

friendlyClassName

(read-only) A nice description of the class.

resource

The connection details of the netCDF resource.

conventions

Returns the conventions that this netCDF resource conforms to.

Methods


Method new()

Create an instance of this class.

Usage

CFDataset$new(name, resource, keep_open, format)

Arguments

name

The name that describes this instance.

resource

An instance of CFResource that links to the netCDF resource.

keep_open

Logical. Should the netCDF resource be kept open for further access?

format

Character string with the format of the netCDF resource as reported by the call opening the resource.


Method print()

Summary of the data set

Prints a summary of the data set to the console.

Usage

CFDataset$print()


Method hierarchy()

Print the group hierarchy to the console Get objects by standard_name

Usage

CFDataset$hierarchy()


Method objects_by_standard_name()

Several conventions define standard vocabularies for physical properties. The standard names from those vocabularies are usually stored as the "standard_name" attribute with variables or axes. This method retrieves all variables or axes that list the specified "standard_name" in its attributes.

Usage

CFDataset$objects_by_standard_name(standard_name)

Arguments

standard_name

Optional, a character string to search for a specific "standard_name" value in variables and axes.

Returns

If argument standard_name is provided, a character vector of variable or axis names. If argument standard_name is missing or an empty string, a named list with all "standard_name" attribute values in the the netCDF resource; each list item is named for the variable or axis. Does the netCDF resource have subgroups

Newer versions of the netcdf library, specifically netcdf4, can organize dimensions and variables in groups. This method will report if the data set is indeed organized with subgroups.


Method has_subgroups()

Usage

CFDataset$has_subgroups()

Returns

Logical to indicate that the netCDF resource uses subgroups. Find an object by its name

Given the name of a CF data variable or axis, possibly preceded by an absolute group path, return the object to the caller.


Method find_by_name()

Usage

CFDataset$find_by_name(name, scope = "CF")

Arguments

name

The name of a CF data variable or axis, with an optional absolute group path.

scope

The scope to look for the name. Either "CF" (default) to search for CF variables or axes, or "NC" to look for groups or NC variables.

Returns

The object with the provided name. If the object is not found, returns NULL. List all the CF data variables in this netCDF resource

This method lists the CF data variables located in this netCDF resource, including those in subgroups.


Method variables()

Usage

CFDataset$variables()

Returns

A list of CFVariables. List all the axes of CF data variables in this netCDF resource

This method lists the axes located in this netCDF resource, including axes in subgroups.


Method axes()

Usage

CFDataset$axes()

Returns

A list of CFAxis descendants. List all the attributes of a group

This method returns a data.frame containing all the attributes of the indicated group.


Method attributes()

Usage

CFDataset$attributes(group)

Arguments

group

The name of the group whose attributes to return. If the argument is missing, the global attributes will be returned.

Returns

A data.frame of attributes.


Method clone()

The objects of this class are cloneable with this method.

Usage

CFDataset$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Details

The CF data set instance provides access to all the objects in the netCDF resource, organized in groups.