[gdal-dev] filter out wanted messages in a grib2 file
Even Rouault
even.rouault at spatialys.com
Tue Mar 19 09:44:04 PDT 2019
On dimanche 10 mars 2019 21:19:30 CET Zhan Zhang - NOAA Affiliate wrote:
> I have a grib2 file which contains many messages, and those messages define
> different products on different surfaces (like z axis). For
> instance, some messages defines "soil temperature"(product name) on a
> surface called "depth below land surface" (surface name); and other
> messages define "geopotential height" (product name) on a "pressure
> surface" (surface name); etc. May I ask how I can filter out all those
> messages that defines "soil temperature"(product name) on a surface called
> "depth below land surface" (surface name)? Is there some grib2 tools
> provided in gdal APIs that I can use? Thanks!
Zhan,
Multiple GRIB messages in a single file are seen by GDAL as a multi-band
dataset.
So you need to iterate over the bands ( GDALGetRasterCount() +
GDALGetRasterBand() for the C API ) and fetch its metadata ( GDALGetMetadata()
) an description ( GDALGetDescription() ) to see if the band is of interest
for you.
The output of gdalinfo should help you understanding this
If using the Python API, you may also analyze the result of
gdal.Info('my.grb2', format = 'json')
which is a Python dictionary, to retrieve the band you are interested in.
Best regards,
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the gdal-dev
mailing list