Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

My goal is to extract wind information from data provided to me in the GRIB2 format as it has been done in the attached image.

I was curious if anybody had any experience with this format. I'm not sure if I am going in the right direction or what format I should be exporting it to. My end goal is to display this information through openlayers. So far, I have used gdal_translate to extract specific information ex. Temperature from band 25 (see command below).

gdal_translate -of Gtiff -b 25 weather.grib2 band25.tiff

I also have access to FME Desktop professional edition.

share|improve this question
So does your gdal_translate command work? What does the output data look like in a GIS such as Quantum? –  MerseyViking Jan 31 '12 at 17:01
MerseyViking, it does work and exports my file as a Geotiff. My problem is understanding the values. According to ogrinfo, band 25 should be temperature in Kelvin. However, when I look at the exported GeoTiff, I see negative values, which should be impossible. Here is my gdalinfo stats result and corresponding Geotiff dl.dropbox.com/u/2375551/20120130_0600f30.grib2.aux.xml dl.dropbox.com/u/2375551/band25.tiff –  user5584 Jan 31 '12 at 18:20
Negative Kelvin is very odd. There is either an error with the data, or a bug in GDAL. Is the GRIB file online? Is is possible to recompute the statistics with, e.g., code.google.com/p/pygrib? –  Mike T Jan 31 '12 at 19:35
Thanks for the help Mike. If you want to see the grib2 file, I have uploaded it here: dl.dropbox.com/u/2375551/20120130_0600f30.grib2 –  user5584 Jan 31 '12 at 20:03
add comment

1 Answer

up vote 2 down vote accepted

I was able to figure out my issue

I used the WGRIB2 utility in order to convert my GRIB2 data to a CSV and subsequently into my POSTGIS database. I used the following command to take the VGRD, UGRD, and TMP at 100mb:

wgrib2 -match ":(VGRD|UGRD|TMP): 100mb" weather.grib2 -lon lon1 lat1 -csv csvfile

I then loaded my CSV to my POSTGIS database and overlayed it on top of my baselayer.

Here is my final result for my temperature layer at 100mb http://i.imgur.com/KEnz0.jpg

share|improve this answer
Diego! Can you give some more details on this issue? How do you load your csv to postgis and generate point geometry? I'm doing this: wgrib2 -match "(:TMP:surface:anl:|:TMP:2 m above ground:anl:)" gfs.t00z.sfluxgrbf00.grib2 -csv fcast.csv COPY tmp (begindate, enddate, name, name2, value, lat, lon) FROM '/Users/nl/Work/ncep/fcast.csv' WITH DELIMITER ',' CSV; SELECT addGeometryColumn ('public', 'tmp', 'the_geom', 4326, 'POINT', 2); UPDATE tmp SET lon = lon-360 WHERE lon > 180; UPDATE tmp SET the_geom=ST_SetSRID(ST_MakePoint(lat,lon), 4326); And I get a strange result: dl.dropbox.com/u... –  Nick Apr 9 '12 at 9:27
Hi Nick, I used ogr2ogr -f "PostgreSQL" PG:"host= user=postgres dbname=databasename" yourcsv.csv –  user5584 Apr 10 '12 at 18:29
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.