h5netcdf.Group#

class h5netcdf.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.

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])

items()

keys()

resize_dimension(dim, size)

Resize a dimension to a certain size.

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.

property attrs#
property cmptypes#

Return group defined compound types.

create_cmptype(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.

create_enumtype(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.

create_group(name)#

Create NetCDF4 group.

Parameters:

name (str) – Name of new group.

create_variable(name, dimensions=(), dtype=None, data=None, fillvalue=None, chunks=None, chunking_heuristic=None, **kwargs)#

Creates a new variable.

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

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

  • dtype (numpy.dtype, str, UserType (Enum, VL, Compound), optional) – Datatype of the new variable. Defaults to None.

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

  • chunks (tuple, optional) – Tuple of integers specifying the chunksizes of each variable dimension.

  • chunking_heuristic (str, optional) – Specify auto-chunking approach. Can be either of h5py or h5netcdf. Defaults to h5netcdf. Discussion on h5netcdf chunking can be found in (GH52) and (PR127).

  • compression (str, optional) – Compression filter to apply, defaults to gzip

  • compression_opts (int) – Parameter for compression filter. For compression="gzip" Integer from 1 to 9 specifying the compression level. Defaults to 4.

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

  • shuffle (bool, optional) – If True, HDF5 shuffle filter will be applied. Defaults to True.

Note

Please refer to h5py documentation for further parameters via keyword arguments. Any parameterizations which do not adhere to netCDF4 standard will only work on files created with invalid_netcdf=True,

Returns:

var (h5netcdf.Variable) – Variable class instance

create_vltype(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.

property dimensions#
property dims#
property enumtypes#

Return group defined enum types.

flush()#
property groups#
property name#
property parent#
resize_dimension(dim, size)#

Resize a dimension to a certain size.

It will pad with the underlying HDF5 data sets’ fill values (usually zero) where necessary.

sync()#
property variables#
property vltypes#

Return group defined vlen types.