Opened 13 years ago
Closed 9 years ago
#4121 closed defect (wontfix)
[PATCH] hdf5imagedataset doesn't get the metadata asociated to a subdataset
Reported by: | alexmantaut | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | GDAL_Raster | Version: | unspecified |
Severity: | normal | Keywords: | HDF5 |
Cc: | antonio |
Description (last modified by )
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:
(40 MB aprox) In this file use the MBI subdataset
More files:http://www.e-geos.it/products/demos.html (under COSMO-SKYMED demos)
Attachments (1)
Change History (11)
comment:1 by , 13 years ago
Description: | modified (diff) |
---|
comment:2 by , 13 years ago
Cc: | added |
---|
comment:3 by , 13 years ago
Update:
For what I discused with Antonio Valentino, hdf5imagedataset should open the metadata asociated to all groups and the metadata from the selected subdataset. To keep consistency with hdf5dataset all the forementioned metadata should be available through GetMetadata() and GetMetadataItem(), and this isn't working right now.
Thanks to Antonio for the input
comment:4 by , 13 years ago
Hi,
I created a patch to make hdf5imagedataset to add the metadata from the subdataset opened. I tested it and it works. I'm not sure if the way I fetched the metadata is the best way available, so feedback would be welcomed.
Regards
by , 13 years ago
Attachment: | hdf5dataset-metadata.patch added |
---|
Added pointer validation to the patch
comment:5 by , 13 years ago
Component: | default → GDAL_Raster |
---|---|
Keywords: | HDF5 added |
comment:6 by , 13 years ago
Summary: | hdf5imagedataset doesn't get the metadata asociated to a subdataset → [PATCH] hdf5imagedataset doesn't get the metadata asociated to a subdataset |
---|
comment:7 by , 13 years ago
Although Alex has good argumentations to support its request
http://lists.osgeo.org/pipermail/gdal-dev/2011-June/029077.html
I'm still not 100% convinced that it is a good idea to change the driver logic about metadata management in subdatasets. I would like to know the opinion of some other developer/user before committing the change.
comment:9 by , 9 years ago
Hi jratike80, I think that the current behaviour is correct:
- hdf5dataset loads metadata of the entire HDF5 file
- hdf5imagedataset only loads metadata of the specific sub-dataset opened
This issue can be closed with a "wontfix" for me.
comment:10 by , 9 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Replying to alexmantaut: