pninexus.h5cpp.file

AccessFlags

The access flags used to open the file

Scope

The scope of a file

File

create

open

is_hdf5_file

class pninexus.h5cpp.file.AccessFlags

The access flags used to open the file

Enumeration type determining the constraits applied to a file when creating or opening it.

TRUNCATE = truncate a file during creation if a file of same name already exists
EXCLUSIVE = raise exception during creation if a file of same name already exists
READWRITE = open a file in read-write mode
READONLY = open a file in read-only mode
class pninexus.h5cpp.file.Scope

The scope of a file

Enumeration type determining the scope to use when flushing a file

LOCAL = local scope
GLOBAL = global scope
class pninexus.h5cpp.file.File

Class representing an HDF5 file.

intent

read-only property returning the intent used when opening the file. This would typically be read-write or read-only.

Returns

file access flags

Return type

AccessFlags

is_valid

Read-only property returning True if the file is a valid HDF5 object, False otherwise.

Return type

boolean

path

Read-only property returning the path to the file.

Return type

str

size

Read only property returning the size of the file in bytes.

Return type

integer

flush(scope=Scope.GLOBAL)

Flushes all buffers to the OS.

Parameters

scope (Scope) – the scope of the flush operation

close()

Close the file. After calling this function is_valid should be False.

root()

Return an instance of the root group of the file.

Returns

root group

Return type

pni.io.h5cpp.node.Group

pninexus.h5cpp.file.create(path, flags=AccessFlags.EXCLUSIVE)

Create a new HDf5 file.

Parameters
  • path (str) – the path to the new file

  • flags (AccessFlags) – access flags to use for the file creation

Returns

new file object

Return type

File

Raises

RuntimeError – in case of a failure

pninexus.h5cpp.file.open(path, flags=AccessFlags.READONLY)

Open an existing HDF5 file. By default the file will be opened in read-only mode.

Parameters
  • path (str) – path to the file to open

  • flags (AccessFlags) – the flags to use for opening the file

Returns

new file object

Return type

File

Raises

RuntimeError – in case of a failure

pninexus.h5cpp.file.is_hdf5_file(path)
Parameters

path (str) – the path to the file to check

Returns

True if the file is an HDF5 file, Flase otherwise

Return type

boolean