How to install PyGrib inside our CDAT path

Dear All,

Greetings.!.

Now we are going to see the procedure to install PyGrib [1] inside the CDAT [2] installed path in our system.

[1] http://code.google.com/p/pygrib/
[2] http://www2-pcmdi.llnl.gov/cdat

Let us assume we have installed CDAT in our system and its working path is /usr/local/cdat5.2/bin/ .

Make sure that the path working fine as like below….

$ /usr/local/cdat5.2//bin/python
Executing /usr/local/cdat5.2//bin/python
Python 2.5.2 (r252:60911, Feb 2 2011, 15:29:23)
[GCC 4.4.5] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
>>>

To install PyGrib in your normal python path, kindly follow the link

First Install the following dependencies for pygrib in our ubuntu.

$ sudo apt-get install libjasper-dev libjasper-runtime .

Note : Do Not install libjasper-java, jasper and openjpeg-tools.

If you installed these above 3 packages, then it should crash our ubuntu login and its X.

These are all stuff tested in ubuntu 10.10.

libjasper-dev and libjasper-runtime are working fine without making any problem.

Download grib_api-1.9.5.tar.gz from http://www.ecmwf.int/products/data/software/download/grib_api.html

Download pyproj-1.8.8.tar.gz from http://code.google.com/p/pyproj/downloads/list

Download pygrib-1.8.0.tar.gz from http://code.google.com/p/pygrib/downloads/list

Now we need to move the three downloaded packages to the cdat path as like below …

$ mv grib_api-1.9.5.tar.gz /usr/local/cdat5.2/bin/

$ mv pyproj-1.8.8.tar.gz /usr/local/cdat5.2/bin/

$ mv pygrib-1.8.0.tar.gz /usr/local/cdat5.2/bin/

Now change the current working directory into cdat .

$ cd /usr/local/cdat5.2/bin/

$ pwd
/usr/local/cdat5.2/bin/

$ su – root

installing grib-api

Following these instructions should be safe on an average linux machine:

  • mkdir grib_api_dir
  • tar zxvf grib_api-1.9.5.tar.gz
  • cd grib_api-1.9.5
  • export CFLAGS=”-O2 -fPIC”
  • ./configure –prefix= `pwd`/../grib_api_dir
  • make
  • make check
  • make install
  • cd ..
  • pwd
    /usr/local/cdat5.2/bin/

installing pyproj

This one is very simple, just like the normal python install :

  • tar zxvf pyproj-1.8.8.tar.gz
  • cd pyproj-1.8.8
  • /usr/local/cdat5.2/bin//python setup.py install
  • cd ..
  • pwd
    /usr/local/cdat5.2/bin/

installing pygrib

Installing pygrib inside cdat path.

  • export GRIBAPI_DIR=`pwd`/grib_api_dir
  • export JASPER_DIR=/usr
  • tar zxvf pygrib-1.8.0.tar.gz
  • cd pygrib-1.8.0
  • /usr/local/cdat5.2/bin//python setup.py install
  • /usr/local/cdat5.2/bin//python test.py
  • pwd
    /usr/local/cdat5.2/bin/pygrib

checking pygrib

open a new terminal as a normal user

  • $ /usr/local/cdat5.2//bin/pythonExecuting /usr/local/cdat5.2//bin/python
    Python 2.5.2 (r252:60911, Feb 2 2011, 15:29:23)
    [GCC 4.4.5] on linux2
    Type “help”, “copyright”, “credits” or “license” for more information.
    >>> import pygrib
    >>>

    Thats it. We have successfully installed pygrib in our cdat path and imported it.

    Enjoy !

    Arulalan.T

About arulalant

Currently working as "Project Scientist ā€“ C" in National Centre for Medium Range Weather Forecasting (NCMRWF), MoES, Noida, India
This entry was posted in CDAT, Python and tagged , , , . Bookmark the permalink.

9 Responses to How to install PyGrib inside our CDAT path

  1. nithincm says:

    i am using window os please help me same process for install pygrib

    Like

  2. nithincm says:

    i am using window7 64bit and python 27,i already installed numpy and pyproj using cmd:python -m pipe install numpy . i need pygrib installation process step by step with picture . please help me šŸ˜¦

    Like

  3. arulalant says:

    Friends ,
    The above procedure working perfectly in ubuntu 11.04 version too šŸ™‚
    Enjoy….

    Liked by 1 person

  4. DILEEP says:

    Thank you……………………………thank you very much…………….

    Like

Leave a comment