Apollo3zehn / PureHDF

A pure .NET library that makes reading and writing of HDF5 files (groups, datasets, attributes, ...) very easy.
MIT License
47 stars 16 forks source link

Over size in DataLayoutMessage4.Create #84

Closed marklam closed 2 months ago

marklam commented 2 months ago

At https://github.com/Apollo3zehn/PureHDF/blob/88848270d7439e1b737b68abdebed9988b9497d6/src/PureHDF/VOL/Native/FileFormat/Level2/ObjectHeaderMessages/DataLayout/DataLayoutMessage4.Writing.cs#L66

I'm getting an excessively large seek offset, and I'm not suspicious that the calculation is incorrect. I've got data dimensions Name Value Type
dataDimensions {ulong[3]} ulong[]
[0] 3275 ulong
[1] 953 ulong
[2] 41 ulong
chunkDimensions {uint[3]} uint[]
[0] 1 uint
[1] 91 uint
[2] 1 uint

So it works out that dataBlockSize is the number of entries in the dataDimensions (3275x953x41 = 127964075) And chunkCount is (3275/1) x (953/91) x (41 / 1) = 1477025 (rounding up 953/91 to 11) And the typesize is 16 (for a variable length list in this case)

Name Value Type
typeSize 16 uint
dataBlockSize 127964075 ulong
chunkCount 1477025 ulong

But the the size calculation multiplies the entire dataset size (typeSize * dataBlockSize) by the number of chunks (chunkCount)

Should this be typeSize chunkBlockSize chunkCount (where chunkBlockSize would be the product of the chunk dimensions) ? (Or am I supplying the parameters wrong?)

Apollo3zehn commented 2 months ago

You are right, I am not sure what I did there. Should be fixed in v1.0.0-beta.16 (will be released in a few minutes)

marklam commented 2 months ago

:-) Happens to us all! Thanks for the quick turnaround!