[gdal-dev] hdf5image metadata problems

Antonio Valentino antonio.valentino at tiscali.it
Thu Jun 16 11:16:09 EDT 2011


Hi Alex,

Il giorno Thu, 16 Jun 2011 11:51:48 -0300
Alex Mantaut <alexmantaut at suremptec.com.ar> ha scritto:

> Antonio,
>            Ok, I understand the asociation between the raster band
> and the metadata, but if you have to explicitally ask for the raster
> band in order to get the metadata there is an inconsistency between
> the interface to get metadata from hdf5dataset and
> hdf5imagedataset... In hdf5dataset GetMetadata() returns the metadata
> asociated to the all the subdatasets without need to explicitally ask
> for the raster band, but in hdf5imagedataset you have to explicitally
> ask for the raster band in order to get the metadata...
>            IMHO the interface should be the same in both cases, in
> that case hdf5imagedataset should retrieve the metadata asociated to
> the subdataset directly via GetMetadata()...


Umh, I don't know. I've always considered HDF5Dataset and
HDF5ImageDataset as quite different things: the index and the chapters.

But I have to admit that yours is a good point.


> 2011/6/16 Antonio Valentino <antonio.valentino at tiscali.it>
> 
> > Hi Alex,
> >
> > Il giorno Thu, 16 Jun 2011 10:05:42 -0300
> > Alex Mantaut <alexmantaut at suremptec.com.ar> ha scritto:
> >
> > > Hi Antonio,
> > >
> > > For what I discussed with Frank it seemed that the expected
> > > behavior was to get the only the data asociated to that
> > > subdataset (plus some aditional data from root and the other
> > > groups) I wasn't sure untill you confirmated...
> > >
> > > Well, right now when I open a specific subdataset it gets only the
> > > raster band asociated to that dataset, but when I try to open the
> > > metadata (with GetMetadata() or GetMetadataItem()) from that
> > > subdataset it opens the metadata from all the groups (as expected)
> > > but it doesn't get the metadata asociated to that subdataset...
> > > Did I do something incorrectly when opening the metadata from the
> > > subdataset?
> > >
> > >  The line suggested in the ticket:
> > >         ReadGlobalAttributes( TRUE );
> > >
> > > Was a way to get around the problem, but now that I'm sure that
> > > hdf5imagedataset doesn't need to read all the metadata, it's not a
> > > suitable solution to the defect...
> > >
> > > Right now I found another way to get the metadata from the
> > > subdataset, by getting the rasterband first, and then asking for
> > > the metadata asociated to that raster band ( it seems a overly
> > > convoluted to get the metadata asociated to that subdataset...)
> > > I'm guessing that the expected behavior is to get the information
> > > directly through GetMetadata() directly...
> > >
> > > regards
> > >
> >
> > Well, IMHO it is not convoluted. Associating "HDF5 dataset" metadata
> > tho the GDAL raster band just reflects the original HDF5 structure.
> >
> > Even if HDF5 and GDAL data model are quite different we can assume,
> > IMHO, the following correspondence:
> >
> > HDF5 file    --> GDAL dataset (HDF5Dataset class)
> > HDF5 Group   --> None (metadata are associated to GDAL dataset)
> > HDF5 Dataset --> GDAL Raster Band
> >
> > HDF5 file can contain several datasets (with arbitrary shape) so the
> > GDAL subdataset mechanism is used to tell to the HDF5ImageDataset
> > class which is the "HDF5 dataset" the have to be mapped onto the
> > GDAL raster band.
> >
> > I hope this is not too much confusing, with my poor english I'm not
> > able to explain it better :).
> >
> >
> > regards
> >
> > >
> > > 2011/6/15 Antonio Valentino <antonio.valentino at tiscali.it>
> > >
> > > > Hi Frank, hi Alex,
> > > >
> > > > Il 15/06/2011 22:34, Frank Warmerdam ha scritto:
> > > > > On 11-06-15 03:50 PM, Alex Mantaut wrote:
> > > > >> Hi Frank:
> > > > >>              Thanks for the swift reply.
> > > > >>               Right now it opens the metadata asociated to
> > > > >> the root, and also
> > > > >> the metadata asociated with all the other groups, but it
> > > > >> doesn't open
> > > > the
> > > > >> metadata asociated to the specified element (bug?)
> > > > >
> > > > > Alex,
> > > > >
> > > > > It sounds like a defect to me, yes.
> > > > >
> > > > > I would suggest filing a ticket that carefully documents the
> > > > > problem with a supporting example file.
> > > > >
> > > > > Best regards,
> > > >
> > > > The current behavior looks fine to me.
> > > >
> > > > If one opens a specific subdataset then only one "HDF5 dataset
> > > > object" can be accessed and it is mapped on GDAL raster bans n.
> > > > 1. All other "HDF5 dataset object" in the h5 file are ignored
> > > > by the HDF5ImageDataset so there is no reason IMHO to make
> > > > their metadata available in some manner.
> > > >
> > > > Metadata associated to all HDF5 groups (including the root one)
> > > > are available in any case and accessible via GDAL dataset
> > > > metadata.
> > > >
> > > > my two cents


-- 
Antonio Valentino


More information about the gdal-dev mailing list