Skip to content

HDF5 stride has different semantics than netcdf stride semantics wrt unlimited. #1380

@DennisHeimbigner

Description

@DennisHeimbigner

In PR #1001
we converted the netcdf-4 code to use the HDF5 hyperslab
operators to speed up strided access (stride > 1). This replaces
an older element-at-a-time code implementing strided access.

It appears that the HDF5 stride semantics did not exactly match the older
stride semantics in (at least) the following case:

  1. A variable has an unlimited dimension
  2. The space allocated in the HDF5 dimension for this variable
    is smaller than the current (maximum) UNLIMITED value.
  3. A vars (stride > 1) read is performed that accessed values past
    the allocated space for the variable, but inside the space size implied
    by unlimited.
  4. For some reason, this causes the last legal value to be misread even though
    it has a defined value. Instead, the fillvalue is returned.

The attached set of files shows this. If you use h5dump on the .nc file,
it shows that the temperature variable has 50 defined values. However,
ncdump on that file shows the temperature variable has the unlimited size
of 55 values. So the netcdf program ncRepro_WeirdStrideIssue.c attempts to
read values past the 50 defined values and somehow the netcdf-c library screws up.
The other program is a pure HDF5 program that attempts to do the same thing,
but if the count is set to 19 (as in the netcdf program) the HDF5 program fails
with an index error.

The fix for this could be ugly.

files.zip

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions