Skip Navigation Links 
NOAA logo - Click to go to the NOAA home page National Weather Service   NWS logo - Click to go to the NWS home page
Climate Prediction Center

About Us
   Our Mission
   Who We Are

Contact Us
   CPC Information
   CPC Web Team

HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-csv

wgrib2: -csv (comma separated values)


The -csv option writes the grid values to a specified file as a comma separated values (text) which can be imported into a spread sheet. This function is similar to -spread with a different output.


For an analysis that is valid at a specific time, time0 and time1 will have the same value. For a temporal average or accumulation of analyses, time0 will be the start and time1 will be end of the average or accumulation.

For a forecast, time0 will be the start of the forecast (i.e, date of the initial conditions). For a forecast for a specific time, then time1 will be time that the forecast is valid. For a forecast of a temporal average or accumulation, time1 wll be the end of the average or accumulation.

In grib speak, time0 is the reference time and time1 is the verification time. Here are some examples,

1:0:d=2009062900:TMP:surface:anl:     (default inventory)

   This an analysis (anl) of the surface temperature.
   This analysis is valid for 2009062900.
   Time0 = 2009062900    Time1 = 2009062900
   field=TMP             level=surface

29:1155322:d=2009060500:UGRD:925 mb:180 hour fcst:ENS+19     (default inventory)
   This is a 180 hour forecast of the 925 hPa zonal wind.
   The forecast run uses initial conditions at 2009060500
   and verifies 180 hours laster at 2009061212.  
   Time0 = 2009060500    Time1 = 2009060500
   field=UGRD            level = 925 mb

43:1844451:d=2009060500:APCP:surface:174-180 hour acc fcst:ENS=+19     (default inventory)
   This is a forecast of accumulated precipitation from 174 to 180 hours.
   The forecast run uses initial conditions at 2009060500 and 
   accumulates the precip from 2009061206 to 2009061212.  The
   verification time is defined as the end of the accumulation period
   Time0 = 2009060500    Time1 = 2009060500
   field= APCP           level= surface

The -csv option only works on the grids for which wgrib2 can derive latitude and longitudes values. Otherwise no output is generated. The undefined value is 9.999e20.

Use the -undefine option to limit the output to certain regions.


-csv output_file_name


$ wgrib2 fcst.grb2 -csv junk 
1:0:d=2007032600:HGT:1000 mb:anl:
2:125535:d=2007032600:HGT:1000 mb:3 hour fcst:
$ cat junk 
"2007-03-26 00:00:00","2007-03-26 00:00:00","HGT","1000 mb",0,-90,164.1
"2007-03-26 00:00:00","2007-03-26 00:00:00","HGT","1000 mb",0.5,-90,164.1
"2007-03-26 00:00:00","2007-03-26 00:00:00","HGT","1000 mb",1,-90,164.1
"2007-03-26 00:00:00","2007-03-26 00:00:00","HGT","1000 mb",1.5,-90,164.1
"2007-03-26 00:00:00","2007-03-26 03:00:00","HGT","1000 mb",-1.5,90,-91.7
"2007-03-26 00:00:00","2007-03-26 03:00:00","HGT","1000 mb",-1,90,-91.7
"2007-03-26 00:00:00","2007-03-26 03:00:00","HGT","1000 mb",-0.5,90,-91.7

See also: -spread, -text, -bin, -ieee, -undefine

NOAA/ National Weather Service
National Centers for Environmental Prediction
Climate Prediction Center
5830 University Research Court
College Park, Maryland 20740
Climate Prediction Center Web Team
Page last modified: July 17, 2015
Disclaimer Privacy Policy