cfdm.Data.nc_hdf5_chunksizes

Data.nc_hdf5_chunksizes(todict=False)[source]

Get the HDF5 chunking strategy for the data.

New in version (cfdm): 1.7.2

Parameters
todict: bool, optional

If True then the HDF5 chunk sizes are returned in a dict keyed by their axis positions. If False (the default) then the HDF5 chunking strategy is returned in the same form that it was set (i.e. as None, int, str, or tuple).

New in version (cfdm): 1.11.2.0

Returns
None or str or int or dict or tuple of int

The current chunking strategy when writing to a netCDF4 file. One of:

  • None: No HDF5 chunking strategy has been defined. The chunking strategy will be determined at write time by cfdm.write.

  • 'contiguous': The data will be written to the file contiguously, i.e. no chunking.

  • int or str: The size in bytes of the HDF5 chunks. A string represents a quantity of byte units. “Square-like” chunk shapes are preferred, maximising the amount of chunks that are completely filled with data values (see the cfdm.write hdf5_chunks parameter for details). For instance a chunksize of 1024 bytes may be specified with any of 1024, '1024', '1024 B', '1 KiB', '0.0009765625 MiB', etc. Recognised byte units are (case insensitive): B, KiB, MiB, GiB, TiB, PiB, KB, MB, GB, TB, and PB.

  • tuple of int: The maximum number of array elements in a chunk along each data axis. This chunking strategy may get automatically modified by methods that change the data shape (such as insert_dimension).

  • dict: If todict is True, the maximum number of array elements in a chunk along each axis. This chunking strategy may get automatically modified by methods that change the data shape (such as insert_dimension).

Examples

>>>
>>> d.shape
(1, 96, 73)
>>> d.nc_set_hdf5_chunksizes([1, 35, 73])
>>> d.nc_hdf5_chunksizes()
(1, 35, 73)
>>> d.nc_hdf5_chunksizes(todict=True)
{0: 1, 1: 35, 2: 73}
>>> d.nc_clear_hdf5_chunksizes()
(1, 35, 73)
>>> d.nc_hdf5_chunksizes()
None
>>> d.nc_set_hdf5_chunksizes('contiguous')
>>> d.nc_hdf5_chunksizes()
'contiguous'
>>> d.nc_set_hdf5_chunksizes('1 KiB')
>>> d.nc_hdf5_chunksizes()
1024
>>> d.nc_set_hdf5_chunksizes(None)
>>> d.nc_hdf5_chunksizes()
None