h5netcdf.File#
- class h5netcdf.File(path, mode='r', format='NETCDF4', invalid_netcdf=False, phony_dims=None, backend=None, **kwargs)#
- __init__(path, mode='r', format='NETCDF4', invalid_netcdf=False, phony_dims=None, backend=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”.format (
"NETCDF4","NETCDF4_CLASSIC") – The format of the file to create. Only relevant when creating a new file (mode “w”). Defaults to “NETCDF4”.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.backend (
'h5py','h5pyd','pyfive'orNone) – The default backend is h5py (backend=None, or backend=’h5py’), but for reading data, the pure python pyfive backend is available.unsupported_hdf5_features (
str) – How h5netcdf handles pyfive’s unsupported hdf5_features ‘skip’: skip, no warning ‘warn’: skip, with warning ‘error’ raise an exceptiontrack_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. Ignored for the ‘pyfive’ backend.**kwargs – Additional keyword arguments to be passed to the backend file constructor, which is
h5py.Filefor the ‘h5py’ backend (the default), orpyfive.Filefor the ‘pyfive’ backend.
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, format, ...])NetCDF4 file constructor.
close()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
attrsThe HDF5 backend.
cmptypesReturn group defined compound types.
dimensionsdimsenumtypesReturn group defined enum types.
groupsnamevariablesvltypesReturn group defined vlen types.
- property backend: str#
The HDF5 backend.
Returns either “h5py” (the backend is h5py, built on the HDF5 C library), “h5pyd” (python library for HDF REST API) or “pyfive” (the backend is pyfive, which is pure Python).
- close()#
- property data_model#
- property filename#
- flush()#
- property mode#
- property parent#
- sync()#