Group

class metpy.io.cdm.Group(**kwargs)[source]

Holds dimensions and variables.

Every CDM dataset has at least a root group.

Methods Summary

__init__(**kwargs)

createDimension(name, size)

Create a new Dimension in this Group.

createGroup(name)

Create a new Group as a descendant of this one.

createVariable(name, datatype[, dimensions, …])

Create a new Variable in this Group.

ncattrs()

Get a list of the names of the netCDF attributes.

Methods Documentation

__init__(**kwargs)
createDimension(name, size)[source]

Create a new Dimension in this Group.

Parameters
  • name (str) – The name of the new Dimension.

  • size (int) – The size of the Dimension

Returns

Dimension – The newly created Dimension

createGroup(name)[source]

Create a new Group as a descendant of this one.

Parameters

name (str) – The name of the new Group.

Returns

Group – The newly created Group

createVariable(name, datatype, dimensions=(), fill_value=None, wrap_array=None)[source]

Create a new Variable in this Group.

Parameters
  • name (str) – The name of the new Variable.

  • datatype (str or numpy.dtype) – A valid Numpy dtype that describes the layout of the data within the Variable.

  • dimensions (tuple[str], optional) – The dimensions of this Variable. Defaults to empty, which implies a scalar variable.

  • fill_value (number, optional) – A scalar value that is used to fill the created storage. Defaults to None, which performs no filling, leaving the storage uninitialized.

  • wrap_array (numpy.ndarray, optional) – Instead of creating an array, the Variable instance will assume ownership of the passed in array as its data storage. This is a performance optimization to avoid copying large data blocks. Defaults to None, which means a new array will be created.

Returns

Variable – The newly created Variable

ncattrs()

Get a list of the names of the netCDF attributes.

Returns

List[str]