ndou
ndou

Reputation: 1178

How to get the memory layout of a HDF5 array with h5py?

In numpy one can check whether an array is C-ordered or F-ordered with my_array.flags. What is the equivalent for a HDF5 dataset read with h5py?

Upvotes: 0

Views: 197

Answers (2)

Tapio
Tapio

Reputation: 1642

Custom memory layouts are also possible if set by whoever wrote the dataset. This can be seen from the h5py.Dataset .chunks attribute, which will be None if it's the default C order and a n-tuple if not.

Upvotes: 0

tupui
tupui

Reputation: 6528

From the documentation:

An HDF5 dataset created with the default settings will be contiguous; in other words, laid out on disk in traditional C order.

Checkout this question for more details. Long story short, your arrays are automatically converted if needed and everything is stored in C order.

Upvotes: 1

Related Questions