Module H5P
HDF5 property list interface.
Functional API
-
h5py.h5p.create(PropClassID cls) → PropID
Create a new property list as an instance of a class; classes are:
Base classes
-
class h5py.h5p.PropID
Bases: h5py.h5.ObjectID
Base class for all property lists and classes
-
equal(PropID plist) → BOOL
- Compare this property list (or class) to another for equality.
-
class h5py.h5p.PropClassID
Bases: h5py.h5p.PropID
An HDF5 property list class.
- Hashable: Yes, by identifier
- Equality: Logical H5P comparison
-
class h5py.h5p.PropInstanceID
Bases: h5py.h5p.PropID
Base class for property list instance objects. Provides methods which
are common across all HDF5 property list classes.
- Hashable: No
- Equality: Logical H5P comparison
-
copy() → PropList newid
- Create a new copy of an existing property list object.
-
get_class() → PropClassID
- Determine the class of a property list object.
-
class h5py.h5p.PropCreateID
Bases: h5py.h5p.PropInstanceID
Generic object creation property list.
Has no methods unless HDF5 1.8.X is available.
-
class h5py.h5p.PropCopyID
Bases: h5py.h5p.PropInstanceID
Generic object copy property list
Has no methods unless HDF5 1.8.X is available
-
get_copy_object() → UINT flags
- Get copy process flags. Legal flags are h5o.COPY*.
-
set_copy_object(UINT flags)
Set flags for object copying process. Legal flags are
from the h5o.COPY* family:
- h5o.COPY_SHALLOW_HIERARCHY_FLAG
- Copy only immediate members of a group.
- h5o.COPY_EXPAND_SOFT_LINK_FLAG
- Expand soft links into new objects.
- h5o.COPY_EXPAND_EXT_LINK_FLAG
- Expand external link into new objects.
- h5o.COPY_EXPAND_REFERENCE_FLAG
- Copy objects that are pointed to by references.
- h5o.COPY_WITHOUT_ATTR_FLAG
- Copy object without copying attributes.
File creation
-
class h5py.h5p.PropFCID
Bases: h5py.h5p.PropCreateID
File creation property list.
-
get_sizes() → TUPLE sizes
Determine addressing offsets and lengths for objects in an
HDF5 file, in bytes. Return value is a 2-tuple with values:
- UINT Address offsets
- UINT Lengths
-
get_userblock() → LONG size
- Determine the user block size, in bytes.
-
get_version() → TUPLE version_info
Determine version information of various file attributes.
Elements are:
- UINT Super block version number
- UINT Freelist version number
- UINT Symbol table version number
- UINT Shared object header version number
-
set_sizes(UINT addr, UINT size)
- Set the addressing offsets and lengths for objects
in an HDF5 file, in bytes.
-
set_userblock(INT/LONG size)
- Set the file user block size, in bytes.
Must be a power of 2, and at least 512.
File access
-
class h5py.h5p.PropFAID
Bases: h5py.h5p.PropInstanceID
File access property list
-
get_cache() → TUPLE cache info
Get the metadata and raw data chunk cache settings. See the HDF5
docs for element definitions. Return is a 4-tuple with entries:
- INT mdc: Number of metadata objects
- INT rdcc: Number of raw data chunks
- UINT rdcc_nbytes: Size of raw data cache
- DOUBLE rdcc_w0: Preemption policy for data cache.
-
get_driver() → INT driver code
Return an integer identifier for the driver used by this list.
Although HDF5 implements these as full-fledged objects, they are
treated as integers by Python. Built-in drivers identifiers are
listed in module h5fd; they are:
-
get_fapl_core() → TUPLE core_settings
Determine settings for the h5fd.CORE (memory-resident) file driver.
Tuple elements are:
- UINT “increment”: Chunk size for new memory requests
- BOOL “backing_store”: If True, write the memory contents to
disk when the file is closed.
-
get_fapl_family() → TUPLE info
Determine family driver settings. Tuple values are:
- UINT memb_size
- PropFAID memb_fapl or None
-
get_fclose_degree() → INT close_degree - h5fd. Get the file-close degree, which determines library behavior when a file is closed when objects are still open. Legal values:
-
-
get_sieve_buf_size() → UINT size
- Get the current maximum size of the data sieve buffer (in bytes).
-
set_cache(INT mdc, INT rdcc, UINT rdcc_nbytes, DOUBLE rdcc_w0)
- Set the metadata (mdc) and raw data chunk (rdcc) cache properties.
See the HDF5 docs for a full explanation.
-
set_fapl_core(UINT increment=64k, BOOL backing_store=True)
Use the h5fd.CORE (memory-resident) file driver.
- increment
- Chunk size for new memory requests (default 1 meg)
- backing_store
- If True (default), memory contents are associated with an
on-disk file, which is updated when the file is closed.
Set to False for a purely in-memory file.
-
set_fapl_family(UINT memb_size=2**31-1, PropFAID memb_fapl=None)
Set up the family driver.
- memb_size
- Member file size
- memb_fapl
- File access property list for each member access
-
set_fapl_log(STRING logfile, UINT flags, UINT buf_size)
- Enable the use of the logging driver. See the HDF5 documentation
for details. Flag constants are stored in module h5fd.
-
set_fapl_sec2()
- Select the “section-2” driver (h5fd.SEC2).
-
set_fapl_stdio()
- Select the “stdio” driver (h5fd.STDIO)
-
set_fclose_degree(INT close_degree)
Set the file-close degree, which determines library behavior when
a file is closed when objects are still open. Legal values:
-
set_sieve_buf_size(UINT size)
- Set the maximum size of the data sieve buffer (in bytes). This
buffer can improve I/O performance for hyperslab I/O, by combining
reads and writes into blocks of the given size. The default is 64k.
Dataset creation
-
class h5py.h5p.PropDCID
Bases: h5py.h5p.PropCreateID
Dataset creation property list.
-
all_filters_avail() → BOOL
- Determine if all the filters in the pipelist are available to
the library.
-
fill_value_defined() → INT fill_status
Determine the status of the dataset fill value. Return values are:
- h5d.FILL_VALUE_UNDEFINED
- h5d.FILL_VALUE_DEFAULT
- h5d.FILL_VALUE_USER_DEFINED
-
get_alloc_time() → INT alloc_time
- Get the storage space allocation time. One of h5d.ALLOC_TIME*.
-
get_chunk() → TUPLE chunk_dimensions
- Obtain the dataset chunk size, as a tuple.
-
get_fill_time() → INT
Determine when fill values are written to the dataset. Legal
values (defined in module h5d) are:
- h5d.FILL_TIME_ALLOC
- h5d.FILL_TIME_NEVER
- h5d.FILL_TIME_IFSET
-
get_fill_value(NDARRAY value)
- Read the dataset fill value into a NumPy array. It will be
converted to match the array dtype. If the array has nonzero
rank, only the first element will contain the value.
-
get_filter(UINT filter_idx) → TUPLE filter_info
Get information about a filter, identified by its index. Tuple
elements are:
- INT filter code (h5z.FILTER*)
- UINT flags (h5z.FLAG*)
- TUPLE of UINT values; filter aux data (16 values max)
- STRING name of filter (256 chars max)
-
get_filter_by_id(INT filter_code) → TUPLE filter_info or None
Get information about a filter, identified by its code (one
of h5z.FILTER*). If the filter doesn’t exist, returns None.
Tuple elements are:
- UINT flags (h5z.FLAG*)
- TUPLE of UINT values; filter aux data (16 values max)
- STRING name of filter (256 chars max)
-
get_layout() → INT layout_code
Determine the storage strategy of a dataset; legal values are:
- h5d.COMPACT
- h5d.CONTIGUOUS
- h5d.CHUNKED
-
get_nfilters() → INT
- Determine the number of filters in the pipeline.
-
remove_filter(INT filter_class)
- Remove a filter from the pipeline. The class code is one of
h5z.FILTER*.
-
set_alloc_time(INT alloc_time)
- Set the storage space allocation time. One of h5d.ALLOC_TIME*.
-
set_chunk(TUPLE chunksize)
- Set the dataset chunk size. It’s up to you to provide
values which are compatible with your dataset.
-
set_deflate(UINT level=5)
- Enable deflate (gzip) compression, at the given level.
Valid levels are 0-9, default is 5.
-
set_fill_time(INT fill_time)
Define when fill values are written to the dataset. Legal
values (defined in module h5d) are:
- h5d.FILL_TIME_ALLOC
- h5d.FILL_TIME_NEVER
- h5d.FILL_TIME_IFSET
-
set_fill_value(NDARRAY value)
- Set the dataset fill value. The object provided should be an
0-dimensional NumPy array; otherwise, the value will be read from
the first element.
-
set_filter(INT filter_code, UINT flags=0, TUPLE values=None)
Set a filter in the pipeline. Params are:
- filter_code
One of the following:
- flags
- Bit flags (h5z.FLAG*) setting filter properties
- values
- TUPLE of UINTs giving auxiliary data for the filter
-
set_fletcher32()
- Enable Fletcher32 error correction on this list.
-
set_layout(INT layout_code)
Set dataset storage strategy; legal values are:
- h5d.COMPACT
- h5d.CONTIGUOUS
- h5d.CHUNKED
-
set_shuffle()
- Enable to use of the shuffle filter. Use this immediately before
the deflate filter to increase the compression ratio.
-
set_szip(UINT options, UINT pixels_per_block)
- Enable SZIP compression. See the HDF5 docs for argument meanings,
and general restrictions on use of the SZIP format.
Link creation (1.8 only)
-
class h5py.h5p.PropLCID
Bases: h5py.h5p.PropCreateID
Link creation property list
-
get_create_intermediate_group() → BOOL
- Determine if missing intermediate groups are automatically created.
-
set_create_intermediate_group(BOOL create)
- Set whether missing intermediate groups are automatically created.
Link access (1.8 only)
-
class h5py.h5p.PropLAID
Bases: h5py.h5p.PropInstanceID
Link access property list
-
get_elink_fapl() → PropFAID fapl
- Get the file access property list used when opening external files.
-
get_elink_prefix() → STRING prefix
- Get the external link prefix
-
get_nlinks() → UINT
- Get the maximum traversal depth for soft links
-
set_elink_fapl(PropFAID fapl)
- Set the file access property list used when opening external files.
-
set_elink_prefix(STRING prefix)
- Set the external link prefix.
-
set_nlinks(UINT nlinks)
- Set the maximum traversal depth for soft links
Group creation (1.8 only)
-
class h5py.h5p.PropGCID
Bases: h5py.h5p.PropCreateID
Group creation property list
Module constants
Predefined classes (all versions)
-
h5py.h5p.DEFAULT
-
h5py.h5p.FILE_CREATE
-
h5py.h5p.FILE_ACCESS
-
h5py.h5p.DATASET_CREATE
-
h5py.h5p.DATASET_XFER
Predefined classes (HDF5 1.8.X only)
-
h5py.h5p.OBJECT_COPY
-
h5py.h5p.LINK_CREATE
-
h5py.h5p.LINK_ACCESS
-
h5py.h5p.GROUP_CREATE