Opened 13 years ago
Last modified 9 years ago
#4121 closed defect
hdf5imagedataset doesn't get the metadata asociated to a subdataset — at Initial Version
Reported by: | alexmantaut | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | GDAL_Raster | Version: | unspecified |
Severity: | normal | Keywords: | HDF5 |
Cc: | antonio |
Description
When GDAL opens an HDF5 file by calling GDALOpen() specifying the dataset it doesn´t load the metadata asociated to that dataset.
If you open the file with the filename alone it shows all the metadata OK.
The diference between these 2 cases comes from the fact that when GDAL opens an HDF5 file from its filename it calls hdf5imagedataset but when you specify the subdataset it uses hdf5imagedataset.
I'm not 100% sure what the expected behavior is when opening a subdataset's metadata. But from what I discused with Frank Warmerdam I'm guessing that GetMetadata("") should return the metadata asociated to the subdataset and the root group.
Rigth now the solution I found is to change this line:
/branches/1.8/gdal/frmts/hdf5/hdf5imagedataset.cpp@22341#L441
to:
poDS->ReadGlobalAttributes( TRUE );
So hdf5imagedataset reads all the metadata... I'm not sure if this is desirable... Maybe it would be better to load the metadata asociated to the specific subdataset...
Steps
- Open the subdataset
poDataset = (GDALDataset *) GDALOpen("HDF5:filename_path://subdataset",GA_ReadOnly );
- Get All the metadata
char allMetadata = poDataset->GetMetadata("");
- Print all the metadata
- Verify that there is no metadata asociated to the particular subdataset opened.
Example file:
ftp://cosmodemo:cosmodemo@ftp.e-geos.it/ScanSAR Huge - Camden Bay/CSKS1_DGM_B_HR_00_HH_RA_SF_20080211191721_20080211191753.h5
(40 MB aprox) In this file use the MBI subdataset
More files:http://www.e-geos.it/products/demos.html (under COSMO-SKYMED demos)