h5netcdf.legacyapi.Group#

class h5netcdf.legacyapi.Group(parent, name)#
__init__(parent, name)#

Create netCDF4 group.

Groups are containers by which the netCDF4 (HDF5) files are organized. Each group is like a Dataset itself.

Methods

__init__(parent, name)

Create netCDF4 group.

createCompoundType(datatype, datatype_name)

Create CompoundType.

createDimension(name, size)

Creates a new dimension with given name and size.

createEnumType(datatype, datatype_name, ...)

Create EnumType.

createGroup(name)

Create NetCDF4 group.

createVLType(datatype, datatype_name)

Create VLType.

createVariable(varname, datatype[, ...])

Creates a new variable.

create_cmptype(datatype, datatype_name)

Create CompoundType.

create_enumtype(datatype, datatype_name, ...)

Create EnumType.

create_group(name)

Create NetCDF4 group.

create_variable(name[, dimensions, dtype, ...])

Creates a new variable.

create_vltype(datatype, datatype_name)

Create VLType.

flush()

get(k[,d])

getncattr(name)

Retrieve a netCDF4 attribute.

items()

keys()

ncattrs()

Return netCDF4 attribute names.

resize_dimension(dim, size)

Resize a dimension to a certain size.

setncattr(name, value)

Set a netCDF4 attribute.

sync()

values()

Attributes

attrs

cmptypes

Return group defined compound types.

dimensions

dims

enumtypes

Return group defined enum types.

groups

name

parent

variables

vltypes

Return group defined vlen types.

createCompoundType(datatype, datatype_name)#

Create CompoundType.

datatype: np.dtype

A numpy dtype object describing the structured type.

datatype_name: string

A Python string containing a description of the compound data type.

createDimension(name, size)#

Creates a new dimension with given name and size.

Parameters:
  • name (str) – Dimension name

  • size (int, None) – size must be a positive integer or None (unlimited). Specifying size=0 results in an unlimited dimension too.

Returns:

dim (h5netcdf.legacyapi.Dimension) – Dimension class instance.

createEnumType(datatype, datatype_name, enum_dict)#

Create EnumType.

datatype: np.dtype

A numpy integer dtype object describing the base type for the Enum.

datatype_name: string

A Python string containing a description of the Enum data type.

enum_dict: dict

A Python dictionary containing the Enum field/value pairs.

createGroup(name)#

Create NetCDF4 group.

Parameters:

name (str) – Name of new group.

createVLType(datatype, datatype_name)#

Create VLType.

datatype: np.dtype

A numpy dtype object describing the base type.

datatype_name: string

A Python string containing a description of the VL data type.

createVariable(varname, datatype, dimensions=(), zlib=False, complevel=4, shuffle=True, fletcher32=False, chunksizes=None, fill_value=None, endian='native')#

Creates a new variable.

Parameters:
  • varname (str) – Name of the new variable. If given as a path, intermediate groups will be created, if not existent.

  • datatype (numpy.dtype, str, UserType (Enum, VL, Compound)) – Datatype of the new variable.

  • dimensions (tuple) – Tuple containing dimension name strings. Defaults to empty tuple, effectively creating a scalar variable.

  • zlib (bool, optional) – If True, variable data will be gzip compressed.

  • complevel (int, optional) – Integer between 1 and 9 defining compression level. Defaults to 4. Ignored if zlib=False.

  • shuffle (bool, optional) – If True, HDF5 shuffle filter will be applied. Defaults to True. Ignored if zlib=False.

  • fletcher32 (bool, optional) – If True, HDF5 Fletcher32 checksum algorithm is applied. Defaults to False.

  • chunksizes (tuple, optional) – Tuple of integers specifying the chunksizes of each variable dimension. Discussion on h5netcdf chunksizes can be found in (GH52) and (PR127).

  • fill_value (scalar, optional) – Specify _FillValue for uninitialized parts of the variable. Defaults to None.

  • endian (str, optional) – Control on-disk storage format. Can be any of little, big or native (default).

Returns:

var (h5netcdf.legacyapi.Variable) – Variable class instance