H5Node class#

class H5Node(h5py_item=None)[source]#

Bases: object

Adapter over an h5py object to provide missing informations from h5py nodes, like internal node path and filename (which are not provided by h5py for soft and external links).

It also provides an abstraction to reach node type for mimicked h5py objects.

property h5py_object#

Returns the internal h5py node.

Return type:

h5py.File or h5py.Group or h5py.Dataset

property h5type#

Returns the node type, as an H5Type.

Return type:

H5Node

property ntype#

Returns the node type, as an h5py class.

Return type:

h5py.File, h5py.Group or h5py.Dataset

property basename#

Returns the basename of this h5py node. It is the last identifier of the path.

Return type:

str

property is_broken#

Returns true if the node is a broken link.

Return type:

bool

property local_name#

Returns the path from the master file root to this node.

For links, this path is not equal to the h5py one.

Return type:

str

property local_file#

Returns the master file in which is this node.

For path containing external links, this file is not equal to the h5py one.

Return type:

h5py.File

Raises:

RuntimeException – If no file are found

property local_filename#

Returns the filename from the master file of this node.

For path containing external links, this path is not equal to the filename provided by h5py.

Return type:

str

Raises:

RuntimeException – If no file are found

property local_basename#

Returns the basename from the master file root to this node.

For path containing links, this basename can be different than the basename provided by h5py.

Return type:

str

property physical_file#

Returns the physical file in which is this node.

New in version 0.6.

Return type:

h5py.File

Raises:

RuntimeError – If no file are found

property physical_name#

Returns the path from the location this h5py node is physically stored.

For broken links, this filename can be different from the filename provided by h5py.

Return type:

str

property physical_filename#

Returns the filename from the location this h5py node is physically stored.

For broken links, this filename can be different from the filename provided by h5py.

Return type:

str

property physical_basename#

Returns the basename from the location this h5py node is physically stored.

For broken links, this basename can be different from the basename provided by h5py.

Return type:

str

property data_url#

Returns a silx.io.url.DataUrl object identify this node in the file system.

Return type:

DataUrl

property url#

Returns an URL object identifying this node in the file system.

This URL can be used in different ways.

# Parsing the URL
import silx.io.url
dataurl = silx.io.url.DataUrl(item.url)
# dataurl provides access to URL fields

# Open a numpy array
import silx.io
dataset = silx.io.get_data(item.url)

# Open an hdf5 object (URL targetting a file or a group)
import silx.io
with silx.io.open(item.url) as h5:
    ...your stuff...
Return type:

str