Closed JasonDevStudio closed 1 year ago
Your dataset is of rank = 1:
So you cannot use a hyperslab selection of rank = 3. For random access you would need to use a PointSelection
but that is not implemented yet.
As a workaround you can use a DelegateSelection
like this:
IEnumerable<Step> walker(ulong[] limits)
{
yield return new Step() { Coordinates = new ulong[] { 20 }, ElementCount = 1 };
yield return new Step() { Coordinates = new ulong[] { 33 }, ElementCount = 1 };
yield return new Step() { Coordinates = new ulong[] { 0 }, ElementCount = 1 };
}
var datasetSelection = new DelegateSelection(totalElementCount: 3, walker);
I hope this helps.
Thanks for your help, my problem has been solved, looking forward to your PointSelection implementation
I have just renamed the project from HDF5.NET to PureHDF for my preparations of a soon to come beta release. Please note that the Nuget package name has also changed and can be found here now: https://www.nuget.org/packages/PureHDF.
There is now a PointSelection: https://github.com/Apollo3zehn/PureHDF#41-overview
Please scroll down to the examples section to see how it should be used.
System.RankException HResult=0x80131517 Message=The length of the limits parameter must match this hyperslab's rank. Source=HDF5.NET StackTrace: 在 HDF5.NET.HyperslabSelection.d18.MoveNext()
在 HDF5.NET.SelectionUtils.d 0.MoveNext()
在 HDF5.NET.SelectionUtils.d3`1.MoveNext()
在 HDF5.NET.H5Dataset.d 50`2.MoveNext()
在 HDF5.NET.H5Dataset.d23.MoveNext()
在 HDF5.ConsoleTest.Program.d 14.MoveNext() 在 C:\Users\jiede\source\repos\SQLiteLib\src\SQLiteLib\Tests\HDF5.ConsoleTest\Program.cs 中: 第 412 行
此异常最初是在此调用堆栈中引发的: [外部代码] HDF5.ConsoleTest.Program.QueryData() (位于 Program.cs 中)
` using var h5file = H5File.OpenRead(file); var h5group = h5file.Group(tableName); var h5dataset = h5group.Dataset($"PARA_{j}_OBJECT"); var datasetSelection = new HyperslabSelection( rank: 3, starts: new ulong[] { 20, 33, 0 }, strides: new ulong[] { 1, 1, 1 }, counts: new ulong[] { 1, 1, 1 }, blocks: new ulong[] { 1, 1, 1 } );
I want to read the data of multiple Start positions at one time through HyperslabSelection, one at a time, how can I do it?
Hdf5_file_7Z.zip