h5netcdf.legacyapi.Dataset

h5netcdf.legacyapi.Dataset#

class h5netcdf.legacyapi.Dataset(path, mode='r', invalid_netcdf=False, phony_dims=None, **kwargs)#
__init__(path, mode='r', invalid_netcdf=False, phony_dims=None, **kwargs)#

NetCDF4 file constructor.

Parameters:
  • path (path-like) – Location of the netCDF4 file to be accessed, or an h5py File object, or a Python file-like object (which should read/write bytes).

  • mode ("r", "r+", "a", "w") – A valid file access mode. Defaults to “r”.

  • invalid_netcdf (bool) – Allow writing netCDF4 with data types and attributes that would otherwise not generate netCDF4 files that can be read by other applications. See Invalid netCDF files for more details.

  • phony_dims ('sort', 'access') – See Datasets with missing dimension scales for more details.

  • track_order (bool) – Corresponds to the h5py.File track_order parameter. Unless specified, the library will choose a default that enhances compatibility with netCDF4-c. If h5py version 3.7.0 or greater is installed, this parameter will be set to True by default. track_order is required to be true to for netCDF4-c libraries to append to a file. If an older version of h5py is detected, this parameter will be set to False by default to work around a bug in h5py limiting the number of attributes for a given variable.

  • **kwargs – Additional keyword arguments to be passed to the h5py.File constructor.

Notes

In h5netcdf version 0.12.0 and earlier, order tracking was disabled in HDF5 file. As this is a requirement for the current netCDF4 standard, it has been enabled without deprecation as of version 0.13.0 (GH128).

Datasets created with h5netcdf version 0.12.0 that are opened with newer versions of h5netcdf will continue to disable order tracker.

If an h5py File object is passed in, closing the h5netcdf wrapper will not close the h5py File. In other cases, closing the h5netcdf File object does close the underlying file.

Methods

__init__(path[, mode, invalid_netcdf, ...])

NetCDF4 file constructor.

close()

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.

filename

groups

mode

name

parent

variables

vltypes

Return group defined vlen types.