Quick Grib2 Viewing with GrADS

gradscreen2

Posted 3/3/2016:

GrADS is a tool for analyzing, among other things, weather data.  Its claim to fame is that it is a “higher level” (i.e. easier to use) tool.  For the mariner, it can be a quite handy tool to have.

While GrADS can view many kinds of data, we’ll limit ourselves to the use of  the grib2 data files available on various NCEP and NOAA and NWS related sites.  The graphic (above) is GrADS in action, showing sea level atmospheric pressure data for the entire planet in one gulp.  The particular file used to create the graphic was a 13MB grib2 data file.  It had many more attributes (beyond pressure) that contributed to its size.  For mariners, who may be receiving such data via low bandwidth channels, we will show how to obtain smaller, more narrowly defined files.  We could select a subset containing a specific geographical area to reduce the size as well.

But, first, let’s get to the “quick” part of our article.  Installing GrADS to use NOAA data is a little bit of an experience, and hopefully this page will lessen the need for head scratching (allowing more time for sailing).

The graphic shows GrADS running on one of my Odroid C1 ARM powered homemade computers.  It’s a little like a tablet, which is exactly what a mariner might very well have onboard his yacht.  In fact, the details surrounding the setup of my litte homemade device should work just as well on any Linux powered tablet.

Either the source for GrADS can be obtained, and the program compiled (it is GPL/2 licensed) – or a package can be found in a package repo for the particular Linux system.  The source, at one time, resided at:

ftp://cola.gmu.edu/grads/2.0/grads-2.0.1-src.tar.gz

It is available from several other sources, now that it has the GPL 2 license.  Installing from either package or source is fairly straightforward.  That, it turns out, is the easy part.

One needs to get a perl script that resides at:

http://ftp.cpc.ncep.noaa.gov/wd51we/g2ctl/g2ctl

This script creates a GrADS control file (.ctl) from the grib2 data file:

g2ctl gfs.t12z.pgrb2.0p25.anl.grib2 > gfs.t12z.pgrb2.0p25.anl.ctl

The wgrib2 program is required by the perl script.  It probably needs to be compiled on the mariner’s computer, as I’ve not found many packages for it, even though it is public domain (like a lot of NOAA stuff):

ftp://ftp.cpc.ncep.noaa.gov/wd51we/wgrib2/wgrib2.tgz

This may seem like a lot of trouble, but it’s less the second time around (let me tell you!)  The next step is to create an index file with which GrADS may map the data:

gribmap -v -i gfs.t12z.pgrb2.0p25.anl.ctl > gfs.t12z.pgrb2.0p25.anl.idx

Note that the gribmap utility comes with GrADS, but it must be from GrADS version 2.0 or greater.  Otherwise, it won’t be able to use grib2 (only grib1, which has been obsoleted).

Finally, we are ready to go!  I open a terminal window, type grads, and see a grads interpreter window.  In it, I type:

 open gfs.t12z.pgrb2.0p25.anl.ctl

It should display some general info about the file, and say it’s loaded. Then, I type:

q file

GrADS should display a list of variables that can be manipulated and/or displayed.  Then I continue, by typing:

set gxout contour

d prmslmsl

GrADS should display the graphic shown at the top of this page.  Prmslmsl is “mean sea level pressure” – and was picked from the variables shown by the “q file” command.  Of course, the data file I used contained data associated with those variables, and that only happened because I picked the correct file from NOAA.  The URL I used to extract the data file follows:

http://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_0p25.pl?file=gfs.t12z.pgrb2.0p25.anl&lev_550_mb=on&lev_900_mb=on&lev_max_wind=on&lev_mean_sea_level=on&lev_surface=on&var_GUST=on&var_PRES=on&var_PRMSL=on&var_RH=on&var_TMP=on&var_UGRD=on&var_VGRD=on&var_VVEL=on&leftlon=0&rightlon=360&toplat=90&;bottomlat=-90&dir=%2Fgfs.2016030212

If that’s too much nonsense, one can just go to:

http://nomads.ncep.noaa.gov

Then, one can select a GFS data set, select the grib2 filter, and pick one’s poison according to the fill-in form. Actually, it’s much easier to do it that way! The other way is for automated systems.

All of these free programs come with the admonition that they are “use at your own risk” programs. There may be bugs/problems in any of them, so one would be advised not to use them for primary weather forecasts. Still, it’s a lot of fun to try and “do this stuff ourselves” – isn’t it? Another note to take into account concerns the coordinates, which internally are handled as rectilinear (as opposed to curvilinear, polar-stereograhic, etc). Places may not really be where they appear to be on the map, depending on latitude and longitude. This gets a little out of my subject area, but a good description can be found at:

http://cola.gmu.edu/grads/gadoc/pdef.html

For a horseshoes/hand grenades level of accuracy, it should be OK regardless of the projections.

Read More …
GrADS is a project that’s been kept at cola.gmu.edu and the Institute of Global Environment and Society (IGES). The Center for Ocean-Land-Atmosphere Studies (COLA) is the center within IGES where GrADS is developed and maintained. GrADS is GPLv2 licensed by its authors. The institution has nothing at all to do with this webpage or its author.

Screenshot license:


The screenshot at the top of the article is of a program that has been released under a free software license (GrADS, located at http://cola.gmu.edu and also at IGES). As a derivative work of that program, this screenshot falls under the same license. Details about the GrADS license are shown at the bottom of this page. Note that this webpage and its author have no connection whatsoever to the GrADS software, or its authors.

The Grid Analysis and Display System (GrADS) Version 2.0 carries a GNU General Public License (GPL version 2) as published by the Free Software Foundation. The link to the full text of the license:

http://cola.gmu.edu/grads/gadoc/COPYRIGHT

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.