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.

createDimension(name, size)

Creates a new dimension with given name and size.

createGroup(name)

Create NetCDF4 group.

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

Creates a new variable.

create_group(name)

Create NetCDF4 group.

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

Creates a new variable.

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

dimensions

dims

groups

name

parent

variables

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.

createGroup(name)#

Create NetCDF4 group.

Parameters

name (str) – Name of new group.

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) – Dataype 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