pninexus.h5cpp.datatype

Class

class pninexus.h5cpp.datatype.Class

Enumeration determining the class to which a type belongs.

NONE = type belongs to no class (not a type at all)
INTEGER = type is an integer type
FLOAT = floating point type
TIME = time type
STRING = string type
BITFIELD = bitfield type
OPAQUE = an opaque type
COMPOUND = a compound type
REFERENCE = a reference to a dataset region
ENUM = an enumeration type
VARLENGTH = a variable length datat type
ARRAY = an array datatype

Order

class pninexus.h5cpp.datatype.Order

Enumeration type determining the byte order used for types

LE = little endian
BE = big endian
class pninexus.h5cpp.datatype.Sign

Enumeration determining the sign convention

TWOS_COMPLEMENT = signed type using twos complement
UNSIGNED = unsigned type
class pninexus.h5cpp.datatype.Norm

Enumeration determining the normalization

IMPLIED = ????
MSBSET = ????
NONE = no normalization used
class pninexus.h5cpp.datatype.Pad

Enumeration determining the general padding used for datatypes.

ZERO = 0 padding is used
ONE = 1 padding
BACKGROUND = ????
class pninexus.h5cpp.datatype.StringPad

Enumeration determining the padding used for strings

NULLTERM = strings are terminated with a \0
NULLPAD = strings are padded with \0
SPACEPAD = strings are padded with whitespaces
class pninexus.h5cpp.datatype.Direction
ASCEND = ascending order
DESCEND = descending order
class pninexus.h5cpp.datatype.CharacterEncoding

Enumeration determining the character encoding used for strings

ASCII using standard ASCII encoding
UTF8 using Unicode encoding (UTF8)

Classes

class pninexus.h5cpp.datatype.Datatype

This is the base class for all other type classes.

type

Read-only property providing the type of the datatype.

Returns

datatype type

Return type

Class

super

Read-only attribute returning the super-type. The meaning of what is returned highly depends on the class the datatype belongs to. Consult the HDF5 users guide for more information about this.

Return type

Datatype

size

Read-only property returning the total size of te type in bytes.

Returns

byte size of a type

Return type

integer

is_valid

Returns True if the datatype is a valid HDF5 object, False otherwise.

Return type

boolean

native_type(dir)

Return the native type of this particular type.

Parameters

dir (Direction) – the search direction

Returns

native type

Return type

Datatype

has_class()
pninexus.h5cpp.datatype.is_bool(enum)

Returns True if the enum datatype is a EBool type, False otherwise.

Parameters

enum (Enum) – enum datatype

Return type

boolean

class pninexus.h5cpp.datatype.Enum

Type used for enumratation values.

class pninexus.h5cpp.datatype.Float

Type used for floating point numbers.

class pninexus.h5cpp.datatype.Integer

Type used for integer numbers.

class pninexus.h5cpp.datatype.String

String type. Usually, an instance of String is constructed using one of the two static factory functions of the class.

For variable length strings use

type = String.variable()

and for fixed size string types

type = String.fixed(size=10) #string type with 10 characters
is_variable_length

Returns True if the datatype is a variable length string type, false otherwise.

Return type

boolean

encoding

Read-write property to set or get the character encoding used for the string type.

type = String.variable()
type.encoding = CharacterEncoding.UTF8
padding

Read-write propety to set or get the padding used for a string type.

type = String.fixed(size=20)
type.padding = StringPad.NULLTERM
size

Read-write property to get and set the size of a string type.

class pninexus.h5cpp.datatype.Factory

Construct HDF5 datatypes from numpy types

create(dtype)

Create HDF5 type from numpy type

Parameters

dtype (numpy.dtype) – numpy datat type

Returns

HDF5 datatype

Return type

Datatype

pninexus.h5cpp.datatype.to_numpy(hdf5_datatype)

Convert an HDF5 datatype to a numpy type

Takes an HDF5 datatype and converts it to the string representation of its numpy counterpart.

Parameters

hdf5_datatype (Datatype) – the HDF5 datatype to convert

Returns

numpy type

Return type

str

Predefined types

We provide some predefined type instances for common types.

pninexus.h5cpp.datatype.kUInt8 = HDF5 datatype for 8Bit unsigned integer
pninexus.h5cpp.datatype.kInt8 = HDF5 datatype for signed 8Bit integers
pninexus.h5cpp.datatype.kUInt16 = HDF5 datatype for unsigned 16Bit integers
pninexus.h5cpp.datatype.kInt16 = HDF5 datatype for signed 16Bit integers
pninexus.h5cpp.datatype.kUInt32 = HDF5 datatype for unsigned 32Bit integers
pninexus.h5cpp.datatype.kInt32 = HDF5 datatype for signed 32Bit integers
pninexus.h5cpp.datatype.kUInt64 = HDF5 datatype for unsigned 64Bit integers
pninexus.h5cpp.datatype.kInt64 = HDF5 datatype for singed 64Bit integers
pninexus.h5cpp.datatype.kFloat32 = HDf5 datatype for 32Bit floating point numbers
pninexus.h5cpp.datatype.kFloat64 = HDF5 datatype for 64Bit floating point numbers
pninexus.h5cpp.datatype.kFloat128 = HDF5 datatype for 128Bit floating point numbers
pninexus.h5cpp.datatype.kVariableString = HDF5 datatype for variable length strings