Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.x]: Problem opening NC4/HDF5 file due to data object header magic #823

Open
1 task done
rschmunk opened this issue Sep 14, 2021 · 3 comments
Open
1 task done
Labels
bug Something isn't working iosp: hdf5 hdf5 file format

Comments

@rschmunk
Copy link
Contributor

Versions impacted by the bug

v5.x, v6.x, v7.x

What went wrong?

A user developing a data product for ESA was unable to open an NC4/HDF5 data in Panoply (currently based on netcdf-Java 5.4.2) due to an "DataObject doesnt start with OHDR" exception thrown by the H5objects class. The same problem occurs using toolsUI 5.4.2 and the most recent IDV download. (FWIW, the file does open in HDFview, but meh.)

I added some diagnostics to H5objects, and found that the object header that it doesn't like is not "OHDR" but instead the 4-char string "ëHDF". A search of the file using a hex editor indicates that the only place that the latter string occurs is at the very start of the file, and is of course the HDF magic string. So it seems that somehow when NJ tries to read the data object, an offset of 0 is being applied?

So although I was originally prone to suggest, "Your file is messed up", I am instead asking if instead the file is merely quirky and it is somehow triggering a bug in netCDF-Java. Unfortunately, this is deep enough voodoo that I am posting to the Github repo for help rather than spend a couple weeks trying to parse the file vis a vis HDF format.

A copy of the problematic file is temporarily here on Dropbox. The dataset variable apparently involved with the exception is ricfer_channel_name �-- omission of that variable from the dataset results in apps being able to open it.

Thx.

Relevant stack trace

No response

Relevant log messages

No response

If you have an example file that you can share, please attach it to this issue.

If so, may we include it in our test datasets to help ensure the bug does not return once fixed?
Note: the test datasets are publicly accessible without restriction.

Yes

Code of Conduct

  • I agree to follow the UCAR/Unidata Code of Conduct
@rschmunk rschmunk added the bug Something isn't working label Sep 14, 2021
@lesserwhirls
Copy link
Collaborator

Hmmm...this is indeed an interesting case. The root issue is netCDF-Java is struggling with the DIMENSION_LIST attribute of the ricfer_channel_name dataset (full path /Annotation data/Instrumental information/ricfer_channel_name). The DIMENSION_LIST holds a reference, and we are reading the heap address of the reference as 0, which isn't correct. Interestingly enough, if I copy the dataset using nccopy (nccopy -k nc4 FLX_GPP__BRK_L1A____20190914T103613_20190914T103615_20210910T112811__18260.HRE1.hdf rewrite.hdf), things work. It makes me wonder if there was a bug in netCDF-C or HDF5 (netcdflibversion=4.6.0|hdf5libversion=1.10.0) that was addressed by rewriting the file (netcdf=4.7.3,hdf5=1.10.4), and perhaps the netCDF-C library has a workaround in place that allows things to work? @JohnLCaron - have you seen behavior like this before?

@JohnLCaron
Copy link
Collaborator

JohnLCaron commented Sep 15, 2021 via email

@JohnLCaron
Copy link
Collaborator

JohnLCaron commented Sep 15, 2021 via email

@JohnLCaron JohnLCaron added the iosp: hdf5 hdf5 file format label Sep 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working iosp: hdf5 hdf5 file format
Projects
None yet
Development

No branches or pull requests

3 participants