Opened 13 years ago
Closed 13 years ago
#4196 closed defect (fixed)
HDF5 Identify does not handle files with user data at the beginning
Reported by: | rprinceley | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 1.9.0 |
Component: | GDAL_Raster | Version: | svn-trunk |
Severity: | normal | Keywords: | |
Cc: | gaopeng, antonio |
Description
In an HDF5 file, the superblock need not start at beginning, we are required to search for it at specific offsets. HDF5Dataset::Identify should probably use H5Fis_hdf5 function to identify an HDF rather than look for the signature in poOpenInfo->pabyHeader.
We have some NOAA data that does not work with GDAL because the superblock starts at 1024 (prefixed with XML).
Change History (5)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
Cc: | added |
---|
comment:3 by , 13 years ago
I have checked in the change made to support NOAA in 1.8-esri (r22971). These HDFs start with an XML block "<HDF_UserBlock>", the Identify function looks for this and calls H5Fis_hdf5. We are using H5Fis_hdf5 to search for the superblock in this case to avoid assumptions about the XML block size.
if( poOpenInfo->pabyHeader ) { if( memcmp(poOpenInfo->pabyHeader,achSignature,8) == 0 ) return TRUE; if( memcmp(poOpenInfo->pabyHeader,"<HDF_UserBlock>",15) == 0) { if( H5Fis_hdf5(poOpenInfo->pszFilename) ) return TRUE; } }
Will try to attach a sample to this ticket (checking if we have permission to distribute samples).
comment:4 by , 13 years ago
Milestone: | → 1.9.0 |
---|
comment:5 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
The issue is that Identify() is supposed to run fast and not open any file, what H5Fis_hdf5() would do. H5Fis_hdf5() calls H5F_locate_signature() which has this interesting info :
Do you have a link to those NOAA data ? Perhaps we could call H5Fis_hdf5() only if the extension is .h5 if those files do use it ?