[gdal-dev] get gdalinfo output with a python script

Eloi Ribeiro eloi.ribeiro at gmail.com
Tue Jun 8 13:51:50 EDT 2010


Hi,

I don't manage to get all the info from a GRIB file with a python script as
it's possible with gdalinfo output.

gdalinfo output example from a GRIB band:

*Band 1 Block=720x1 Type=Float64, ColorInterp=Undefined*
*  Description = 2[m] HTGL="Specified height level above ground"*
*  Metadata:*
*    GRIB_UNIT=[K]*
*    GRIB_COMMENT=Minimum Temperature [K]*
*    GRIB_ELEMENT=TMIN*
*    GRIB_SHORT_NAME=2-HTGL*
*    GRIB_REF_TIME=   283996800 sec UTC*
*    GRIB_VALID_TIME=   284000400 sec UTC*
*    GRIB_FORECAST_SECONDS=0 sec*

Till now I manage to get all Metadata tags but not all the info from the tow
first lines.
I am using the following code:

*from osgeo import gdal*
*
*
*dataset = gdal.Open(filename, gdal.GA_ReadOnly)*
*if dataset is None:*
*    print 'Nao foi possivel abrir a imagem!'*
*for nBandas in range(1, dataset.RasterCount + 1):*
*    banda = dataset.GetRasterBand(nBandas)*
*    BlockSize = banda.GetBlockSize()*
*    DataType  = gdal.GetDataTypeName(banda.DataType)*
*    Metadata = banda.GetMetadata()*
*    for chave, valor in Metadata.iteritems():*
*        print chave, '=', valor.strip()*

I would appreciate some help.
Thanks in advance.

-- 
Eloi Ribeiro
GIS Analyst
39,45º -4,40º
http://eloiribeiro.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20100608/2c504c6c/attachment.html


More information about the gdal-dev mailing list