[gdal-dev] How to get some special metadata of HDF5 Cosmo-Skymed file

Alex Mantaut alexmantaut at suremptec.com.ar
Mon Jul 11 09:55:36 EDT 2011


Hi RSyaoxin,

Antonio is right, there was an issue on geting the root metadata from
hdf5 files and is has been fixed in trunk, you will need to recompile
gdal in order to get that information.


After you rebuilt the library, an example on getting the metadata:

#include "gdal_priv.h"
#include <iostream>
#include <cstdlib>
#include <string>
#include <stdexcept>

using namespace std;

int main(int argc, char **argv)
{
GDALDataset  *poDataset;

  GDALAllRegister();

  //Open the subdataset
  //The filename should be formated like this
  //HDF5:filepath://subdataset
  poDataset = (GDALDataset *) GDALOpen(
"HDF5:CSKS1_DGM_B_HR_00_HH_RA_SF_20080211191721_20080211191753.h5://S01/SBI",
GA_ReadOnly );

  if( poDataset == NULL )
  {
      cout <<"error opening dataset"<<endl;
  }
  else
  {
           //To get the metadata the item name should be formated like this:
           //Every space and group separator should be replaced with
an underscore (_)
           //I.e. You need item Beam ID from group S01:
           const char *pszBeamId = poDataset->GetMetadataItem("S01_Beam_ID");
           cout <<  pszBeamId <<endl;
           //I.e. You need item Rescaling factor the root:
           const char *pszRescalingFactor =
poDataset->GetMetadataItem("Rescaling_Factor");
           cout <<  pszRescalingFactor <<endl;
  }
}

Best regards



2011/7/10 Antonio Valentino <antonio.valentino at tiscali.it>:
> Hi RSyaoxin,
>
> Il 10/07/2011 16:08, RSyaoxin ha scritto:
>> Hi,all.
>>       I want to calibrate the Cosmo-Skymed radar data, and I need some
>> parameters, such as "Calibration Constant","Rescaling Factor","Reference
>> Incidence Angle" and so on.However,I'm a beginner,I don't know how to get
>> HDF5 metadata,Somebody can give me a tutorial in c or c++?
>>       Furthermore,I used HDFView to see the file's metadata and found that
>> these information is stored in the metadata corresponding to the "root" of
>> the file, I try to use gdalinfo to get the file's metadata  and can't find
>> it.That's why?
>>
>>       Subdatasets:
>>
>> SUBDATASET_1_NAME=HDF5:"D:\CSKS3_GEC_B_WR_01_VV_RD_SF_20100720100133_20100720100148.h5"://MBI
>>   SUBDATASET_1_DESC=[9028x12156] //MBI (16-bit unsigned integer)
>>
>> SUBDATASET_2_NAME=HDF5:"D:\CSKS3_GEC_B_WR_01_VV_RD_SF_20100720100133_20100720100148.h5"://QLK
>>   SUBDATASET_2_DESC=[902x1215] //QLK (8-bit unsigned character)
>>
>> I hope to get some help.Thank you!
>> Kind regards.
>
> The HDF5 driver has been recently updated to improve metadata management:
>
> http://trac.osgeo.org/gdal/changeset/22517
> http://trac.osgeo.org/gdal/ticket/2412
>
> The problem you are experimenting should be fixed in trunk but you need
> to re-build GDAL from sources to get it.
>
> regards
>
> --
> Antonio Valentino
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>



-- 
--
     Alex Mantaut
SUR Emprendimientos Tecnológicos

Perú 345  Piso 5to Oficina "B" (C1067AAG)
Ciudad de Buenos Aires, Argentina
Tel. +54 (11) 4342-2976/84
alexmantaut at suremptec.com.ar
www.suremptec.com


More information about the gdal-dev mailing list