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

Creates a new variable.

  • 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, optional) – Dataype 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.


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,


var (h5netcdf.Variable) – Variable class instance