HDFGroup / HDFGroup/hdf5

Read hyperslab does not give expected results

Open
#472 3 comments 0 reactions 1 assignee Claimed by @jhendersonHDF View on GitHub
Component - C Library
Dominant language
C
Stars
988
Forks
355
Avg merge
4d 2h
Merged PRs (30d)
12

Description

I created some test data (just a range of numbers starting from 0 to the size of the dataset) and wrote them to file as three-dimensional array with shape [25, 25, 4] and chunk shape [7, 20, 3] (I am working with C# and the P/Invoke package).

Then I read these data back into memory using the following two hyperslab selections:

```cs
// source selection
var datasetStarts = new ulong[] { 2, 2, 0 };
var datasetStrides = new ulong[] { 5, 8, 2 };
var datasetCounts = new ulong[] { 5, 3, 2 };
var datasetBlocks = new ulong[] { 3, 5, 2 };

// target selection
var memoryStarts = new ulong[] { 2, 1 };
var memoryStrides = new ulong[] { 35, 17 };
var memoryCounts = new ulong[] { 2, 1 };
var memoryBlocks = new ulong[] { 30, 15 };
```

I have visualized the process in Matlab using C-style order. Here is the source array combined with the dataset selection, i.e. "0" values are not selected:
![grafik](https://user-images.githubusercontent.com/20972129/111317514-861f9380-8664-11eb-9c36-f87964b976c2.png)

And here is my memory selection with the **expected** result:
![grafik](https://user-images.githubusercontent.com/20972129/111318497-68066300-8665-11eb-9d48-58f42fa1707b.png)

And last but not least my **actual** result (red color indicates unexpected data values):

![grafik](https://user-images.githubusercontent.com/20972129/111318954-cf241780-8665-11eb-9072-7c04021024e8.png)

The errors appear only when the dataset is chunked. I have created a minimal repo (in C#) and have the project and the resuling .h5 file attached. I do not suspect the P/Invoke package since it really just P/Invokes into the HDF5 library.

Could you please have a look into this?

[hyperslab.zip](https://github.com/HDFGroup/hdf5/files/6149485/hyperslab.zip)

Edit: forgot to mention that I am using HDF5 version 1.10.6.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.