Grads Install

2016-11-21  本文已影响263人  Aieru

Now we are going to see how to install wgrib2 and g2ctl in our linux machine, for the Grib version 2 data.

step 1:

First of we need to install GRADS

https://sourceforge.net/projects/opengrads/files/grads2/

From the above link we can get the source.

In ubuntu we need to install some dependencies,

$ sudo apt-get install libgrib2c-dev libgrib2c0d (to install wgrib2 correctly)

$ sudo apt-get install grads (for gribmap)

Note : grads version must be equal or higher than the 2.0.a8 (to work correctly for grib2).

If you are using ubuntu 10.04, then grads may be lower than the above version.

So download the source of grads version 2.0.a8 or higher.

$ sudo apt-get install libxmu-dev libxmu-headers x11-common x11-xserver-utils

Extract that downloaded grads source and change directory into that extracted folder.

$ ./configure

$ make && make install

Now it should be installed in that folder called ‘src’.

You can use this grads, gribmap (inside the src folder of the extracted folder of grads2.0.a8) to use the grib2 version.

$ sudo cp -r src /usr/local/grads2.0.a8

Edit your home .bashrc file, add the following lines.

alias grads=’/usr/local/grads2.0.a8/grads’

alias gribmap=/usr/local/grads2.0.a8/gribmap’

step 2:

From the below site we can download the g2ctl.pl perl source code
http://www.cpc.ncep.noaa.gov/products/wesley/g2ctl.html

Look in the bottom of the page.

Try to open all the above links in firefox not in chrome.

Download that g2ctl.pl source code from here ftp://ftp.cpc.ncep.noaa.gov/wd51we/g2ctl/g2ctl save as g2ctl.pl . If that perl source code has viewed by web page itself means, copy that perl code into one text file, and save that as g2ctl.pl file in your home folder itself.

step 3:

Go to the below link to download the wgrib2 tar file
http://www.cpc.ncep.noaa.gov/products/wesley/wgrib2/

From here you can download the wgrib2.tgz source file in the above link.

Go to this section in the above link “Source Code and Compling Hints” .

Download the “wgrib2.tgz” by http way.

After downloaded the wgrib2.tgz file, extract it either by GUI “Extract here” or

$ tar -zxvf wgrib.gz
It should create directory called “grib2″.

Now move this folder into /usr/bin by

$ sudo mv grib2 /usr/bin/

Now go to that directory by

$ cd /usr/bin/grib2

$ sudo make

It takes few minutes to install wgrib2 inside that folder itself.

Note : now our wgrib2 executable path is ” /usr/bin/grib2/wgrib2/wgrib2 “.

step 4:

Now open the g2ctl.pl file,

Look for the line:
wgrib2=’wgrib2′; and change it to point to your wgrib2 path. In our case,wgrib2=’/usr/bin/grib2/wgrib2/wgrib2′;
Don’t forget to make the program as executable (chmod 755 g2ctl.pl) and put it on your PATH. i.e sudo chmod 755 g2ctl.pl and sudo cp g2ctl.pl /usr/bin/
Thats it … !

Now you can access the g2ctl.pl from the bash shell (terminal) itself.

Try the following usage of g2ctl with your analysis and forecasting binary grib files.

Usage

For analyses:

g2ctl.pl -0 grib2_file >grib2_file.ctl [ here we passed zero option] gribmap -0 -i grib2_file.ctl [ here we passed zero option]
$ grads
Landscape mode? (no for portrait):
ga-> open grib2_file.ctl

For forecasts:

g2ctl.pl grib2_file >grib2_file.ctl gribmap -i grib2_file.ctl
$ grads
Landscape mode? (no for portrait):
ga-> open grib2_file.ctl

The main differences between the syntax of grib2ctl.pl and g2ctl.pl are,

For grib version 2 files, we are using g2.ctl.pl script to create ctl files. The usage option -0 (zero) are passed for both g2ctl.pl and gribmap commands for analysis files and not for forecast files in the grib version 2.
For grib version 1 files, we are using grib2ctl.pl script to create ctl files. The usage option -0 (zero) is passed in gribmap command for analysis files and option -verf is passed in grib2ctl.pl command for forecast files. To know more about grib2ctl.pl script, how to install that and how to use that, click here .
To understand, what is grib and ctl file formate

grib is the one of binary file formate to store the analysis and forecast data in some kind of structured manner.
ctl means control file in ascii formate. we can read it. Both these formates are usually used in atmospheric and meteorological departments.

The generated ctl files can be read and visualized by GRADS , CDAT and other meteorological softwares.

Both Grads and CDAT are open source software.

More over many other foss applications are available for the same kind of stuff.

上一篇下一篇

猜你喜欢

热点阅读