[gdal-dev] get gdalinfo output with a python script
Even Rouault
even.rouault at mines-paris.org
Tue Jun 8 15:41:26 EDT 2010
http://trac.osgeo.org/gdal/browser/trunk/gdal/swig/python/samples/gdalinfo.py
Would need just a few minor changes to work against GDAL 1.7 python bindings
Le Tuesday 08 June 2010 19:51:50 Eloi Ribeiro, vous avez écrit :
> 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.
More information about the gdal-dev
mailing list