# HDFView 3.1.0 error displaying dataset with np.float16 data

**URL:** <https://forum.hdfgroup.org/t/hdfview-3-1-0-error-displaying-dataset-with-np-float16-data/7974>\
**Category:** HDFView / Java HDF Object Package\
**Created:** [January 11, 2021, 9:42pm UTC](https://forum.hdfgroup.org/t/hdfview-3-1-0-error-displaying-dataset-with-np-float16-data/7974 "2021-01-11T21:42:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ken.walker](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/k/b38774/32.png) [@ken.walker](https://forum.hdfgroup.org/u/ken.walker)\
**Post date:** [January 11, 2021, 9:42pm UTC](https://forum.hdfgroup.org/t/hdfview-3-1-0-error-displaying-dataset-with-np-float16-data/7974/1 "2021-01-11T21:42:31Z")

</div>

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'][:])
```

---

<div class="post-metadata">

**Author:** ![edward.doyle](https://forum.hdfgroup.org/user_avatar/forum.hdfgroup.org/edward.doyle/32/1760_2.png) [@edward.doyle](https://forum.hdfgroup.org/u/edward.doyle)\
**Post date:** [October 21, 2021, 1:56am UTC](https://forum.hdfgroup.org/t/hdfview-3-1-0-error-displaying-dataset-with-np-float16-data/7974/2 "2021-10-21T01:56:35Z")

</div>

I can reproduce this issue in v3.1.3. h5dump, h5ls, and python’s h5py read the data back OK.

---

<div class="post-metadata">

**Author:** ![byrn](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/b/85f322/32.png) [@byrn](https://forum.hdfgroup.org/u/byrn)\
**Post date:** [February 11, 2022, 5:04pm UTC](https://forum.hdfgroup.org/t/hdfview-3-1-0-error-displaying-dataset-with-np-float16-data/7974/3 "2022-02-11T17:04:56Z")

</div>

Unfortunately, half-precision (16-bit) and quad-precision(128-bit) float types are not currently supported by hdf5/hdfview. I think the reason h5dump works is because it interrogates the properties of the datatype and hdf5 finds a container for it. Last I checked, th Java language does not support those types either.  
Can we add something to HDFView to work around this limitation, probably because we did add a way to display 128-bit floats, I think.

Allen
