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 alexmantaut)

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

  1. Open the subdataset

poDataset = (GDALDataset *) GDALOpen("HDF5:filename_path://subdataset",GA_ReadOnly );

  1. Get All the metadata

char allMetadata = poDataset->GetMetadata("");

  1. Print all the metadata
  2. Verify that there is no metadata asociated to the particular subdataset opened.

Example file:

ftp://cosmodemo:cosmodemo@ftp.e-geos.it/ScanSAR%20Huge%20-%20Camden%20Bay/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)

Attachments (1)

hdf5dataset-metadata.patch (811 bytes ) - added by alexmantaut 13 years ago.
Added pointer validation to the patch

Download all attachments as: .zip

Change History (11)

in reply to:  description comment:1 by alexmantaut, 13 years ago

Description: modified (diff)

Replying to alexmantaut:

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

  1. Open the subdataset

poDataset = (GDALDataset *) GDALOpen("HDF5:filename_path://subdataset",GA_ReadOnly );

  1. Get All the metadata

char allMetadata = poDataset->GetMetadata("");

  1. Print all the metadata
  2. 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)

comment:2 by antonio, 13 years ago

Cc: antonio added

comment:3 by alexmantaut, 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 alexmantaut, 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 alexmantaut, 13 years ago

Attachment: hdf5dataset-metadata.patch added

Added pointer validation to the patch

comment:5 by warmerdam, 13 years ago

Component: defaultGDAL_Raster
Keywords: HDF5 added

comment:6 by Even Rouault, 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 antonio, 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:8 by Jukka Rahkonen, 9 years ago

No comment yet within three years. Still waiting?

comment:9 by antonio, 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 Jukka Rahkonen, 9 years ago

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.