# Writing 1D float array to hsds dataset depends on array length?

**URL:** <https://forum.hdfgroup.org/t/writing-1d-float-array-to-hsds-dataset-depends-on-array-length/11034>\
**Category:** HSDS\
**Created:** [April 14, 2023, 7:50pm UTC](https://forum.hdfgroup.org/t/writing-1d-float-array-to-hsds-dataset-depends-on-array-length/11034 "2023-04-14T19:50:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pshi](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/p/eb9ed0/32.png) [@pshi](https://forum.hdfgroup.org/u/pshi)\
**Post date:** [April 14, 2023, 7:50pm UTC](https://forum.hdfgroup.org/t/writing-1d-float-array-to-hsds-dataset-depends-on-array-length/11034/1 "2023-04-14T19:50:59Z")

</div>

Hi,

When I tried to write 1D float array to one dataset, “test” here, I found a very strange behavior. The python code using h5pyd package is listed below, with “f” as the hdf5 file object.

dset=f.create\_dataset(“test”,data=np.linspace(0,100,N\_ARRAY), dtype=np.float32)

1. When N\_ARRAY \<=255, the readback dset is correct as a linear array.

2. When N\_ARRAY\>256, the readback dset is just random and it’s different if I rewrite it. One example is attached below.

3. Even strangely, when N\_ARRAY is sufficiently large, like \> 8000, the correct readback can be obtained excepted the very first four numbers, which are just random.

Does anyone know what can cause this issue?

Thanks,  
Peiyun

One example at N\_ARRAY=256,  
[0.00e+00 1.40e-43 0.00e+00 0.00e+00 0.00e+00 0.00e+00 2.80e-45 0.00e+00  
0.00e+00 1.26e-43 0.00e+00 0.00e+00 0.00e+00 0.00e+00 2.80e-45 0.00e+00  
0.00e+00 1.40e-43 1.40e-45 0.00e+00 0.00e+00 0.00e+00 2.10e-44 0.00e+00  
0.00e+00 1.40e-43 2.80e-45 0.00e+00 0.00e+00 0.00e+00 2.10e-44 0.00e+00  
0.00e+00 1.51e-43 1.40e-45 0.00e+00 0.00e+00 0.00e+00 2.10e-44 0.00e+00  
0.00e+00 1.26e-43 1.40e-45 0.00e+00 0.00e+00 0.00e+00 2.10e-44 0.00e+00  
0.00e+00 1.40e-43 1.40e-45 0.00e+00 0.00e+00 0.00e+00 2.38e-44 0.00e+00  
0.00e+00 1.40e-43 2.80e-45 0.00e+00 0.00e+00 0.00e+00 2.38e-44 0.00e+00  
0.00e+00 1.51e-43 2.80e-45 0.00e+00 0.00e+00 0.00e+00 2.38e-44 0.00e+00  
0.00e+00 1.26e-43 2.80e-45 0.00e+00 0.00e+00 0.00e+00 2.38e-44 0.00e+00  
0.00e+00 1.40e-43 1.40e-45 0.00e+00 0.00e+00 0.00e+00 2.52e-44 0.00e+00  
0.00e+00 1.40e-43 2.80e-45 0.00e+00 0.00e+00 0.00e+00 2.52e-44 0.00e+00  
0.00e+00 1.51e-43 4.20e-45 0.00e+00 0.00e+00 0.00e+00 2.52e-44 0.00e+00  
0.00e+00 1.26e-43 4.20e-45 0.00e+00 0.00e+00 0.00e+00 2.52e-44 0.00e+00  
0.00e+00 1.40e-43 1.40e-45 0.00e+00 0.00e+00 0.00e+00 2.66e-44 0.00e+00  
0.00e+00 1.40e-43 4.20e-45 0.00e+00 0.00e+00 0.00e+00 2.66e-44 0.00e+00  
0.00e+00 1.51e-43 5.61e-45 0.00e+00 0.00e+00 0.00e+00 2.66e-44 0.00e+00  
0.00e+00 1.53e-43 7.01e-45 0.00e+00 0.00e+00 0.00e+00 2.66e-44 0.00e+00  
0.00e+00 1.26e-43 7.01e-45 0.00e+00 0.00e+00 0.00e+00 2.66e-44 0.00e+00  
0.00e+00 1.40e-45 0.00e+00 0.00e+00 0.00e+00 0.00e+00 2.66e-44 0.00e+00  
0.00e+00 1.40e-43 1.40e-45 0.00e+00 0.00e+00 0.00e+00 2.80e-44 0.00e+00  
0.00e+00 1.40e-43 2.80e-45 0.00e+00 0.00e+00 0.00e+00 2.80e-44 0.00e+00  
0.00e+00 1.51e-43 8.41e-45 0.00e+00 0.00e+00 0.00e+00 2.80e-44 0.00e+00  
0.00e+00 1.26e-43 9.81e-45 0.00e+00 0.00e+00 0.00e+00 2.80e-44 0.00e+00  
0.00e+00 1.40e-43 5.61e-45 0.00e+00 0.00e+00 0.00e+00 3.36e-44 0.00e+00  
0.00e+00 1.26e-43 1.12e-44 0.00e+00 0.00e+00 0.00e+00 3.36e-44 0.00e+00  
0.00e+00 1.40e-43 7.01e-45 0.00e+00 0.00e+00 0.00e+00 3.50e-44 0.00e+00  
0.00e+00 1.26e-43 1.12e-44 0.00e+00 0.00e+00 0.00e+00 3.50e-44 0.00e+00  
0.00e+00 1.40e-43 8.41e-45 0.00e+00 0.00e+00 0.00e+00 3.64e-44 0.00e+00  
0.00e+00 1.26e-43 1.26e-44 0.00e+00 0.00e+00 0.00e+00 3.64e-44 0.00e+00  
0.00e+00 1.40e-43 9.81e-45 0.00e+00 0.00e+00 0.00e+00 3.78e-44 0.00e+00  
0.00e+00 1.26e-43 1.40e-44 0.00e+00 0.00e+00 0.00e+00 3.78e-44 0.00e+00]

---

<div class="post-metadata">

**Author:** ![jreadey](https://forum.hdfgroup.org/user_avatar/forum.hdfgroup.org/jreadey/32/870_2.png) [@jreadey](https://forum.hdfgroup.org/u/jreadey)\
**Post date:** [April 21, 2023, 7:11pm UTC](https://forum.hdfgroup.org/t/writing-1d-float-array-to-hsds-dataset-depends-on-array-length/11034/2 "2023-04-21T19:11:34Z")

</div>

Hi,  
I should mention for future reference there’s a forum specifically for HSDS, but the hdf5 forum is fine as well.

I tried to re-create the error in HDFLab, but it looks ok to me. See: [https://gist.github.com/jreadey/c7628b6fa4636958e6e59741626f94e0](https://gist.github.com/jreadey/c7628b6fa4636958e6e59741626f94e0).

Am I missing something? Which version of h5pyd & HSDS are you using? (you can get this with `hsinfo`)

---

<div class="post-metadata">

**Author:** ![pshi](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/p/eb9ed0/32.png) [@pshi](https://forum.hdfgroup.org/u/pshi)\
**Post date:** [May 1, 2023, 1:18am UTC](https://forum.hdfgroup.org/t/writing-1d-float-array-to-hsds-dataset-depends-on-array-length/11034/3 "2023-05-01T01:18:39Z")

</div>

Hi,

Thanks for your response! The hsds version is 0.7.1.

The only difference I noticed is that I am doing this write in remotely with endpoint. I am still have no idea what causes this. But I figured out one work around - by using table, I can store numerical arrays of length several thousands correctly.

---

<div class="post-metadata">

**Author:** ![jreadey](https://forum.hdfgroup.org/user_avatar/forum.hdfgroup.org/jreadey/32/870_2.png) [@jreadey](https://forum.hdfgroup.org/u/jreadey)\
**Post date:** [May 3, 2023, 11:42am UTC](https://forum.hdfgroup.org/t/writing-1d-float-array-to-hsds-dataset-depends-on-array-length/11034/4 "2023-05-03T11:42:42Z")

</div>

Glad to see you found a work-around.  
The latest HSDS version is 0.7.3. When you get a chance, give that a try and let us know if you are still having the issue or not.
