HDFView 3.1.0 error displaying dataset with np.float16 data


#1

I know np.float16 is not commonly used…has anyone ever tested HDFView with a dataset (np.array) of np.float16? I created 3 datasets each shape=(10,10), 1 each of np.float64, np.float32, and np.float16. When I open with HDFView, the 64 and 32 bit datasets can be viewed. I get an error message when I try to open the 16 bit set. Error is: “An error occurred while loading data for the table: data value is null”. I can open with h5py and print the data for all 3 datasets. Any ideas?

Code below if you are interested. Note: the code shows 2 ways to cast the original array to float32 and float16. I get the same result no matter how I do this.

import numpy as np
import h5py

with h5py.File('test_floats.h5', 'w') as f:
    data = np.random.random((10,10))
    print (data)
# create 3 data sets
    dset64 = f.create_dataset('dset64', data=data)
    #data = np.random.random((10,10)).astype(np.float32)
    dset32 = f.create_dataset('dset32', data=data.astype(np.float32))
    #data = np.random.random((10,10)).astype(np.float16)
    dset16 = f.create_dataset('dset16', data=data.astype(np.float16))

# check data
with h5py.File('test_floats.h5', 'r') as f:
    print(f['dset64'].dtype)
    print(f['dset64'][:])
    print(f['dset32'].dtype)
    print(f['dset32'][:])
    print(f['dset16'].dtype)
    print(f['dset16'][:])