Downloading and installing PyNGL and PyNIO

To download and install PyNGL and PyNIO on your system, you need to:

If you have problems with these instructions, or don't see your favorite system listed on the ESG, send email to Mary Haley.

The current version of PyNGL and PyNIO is 1.2.0. See the "What's new" section to learn more about this version. Please note that PyNIO is currently bundled with PyNGL, but in the future we may decide to release it as a separate package if this becomes a popular request.

We have both NumPy and Numeric versions of PyNGL and PyNIO available. See the "NumPy and Numeric versions of PyNGL and PyNIO" section below. Eventually, however, we may drop support for Numeric.

For discussions on all things related to PyNGL and PyNIO, you can join the pyngl-talk email list.

PyNGL/PyNIO are available as pre-compiled binaries for various systems and can be downloaded from the Earth System Grid (ESG). The download and usage requires agreement of the PyNGL license.

If you already have an account on the ESG, then you can go there now to get the binaries; a separate registration is not required.

Please note that PyNGL and PyNIO are currently released in binary format only. This partially because it is built on top of code that is under an old ymake system, and it will take some time to get it working under Python's distutils. Also, not all of our code is open source; we are working on this and hope to have open source ready in the next release.

Here are potentially some of the binaries available on the ESG website:

Request an ESG account

On your first visit to the Earth System Grid, a short registration is required. To register, go to:

http://www.earthsystemgrid.org/
and look on the left side of the page under "ESG News" about requesting an account. When filling out the account request form, please indicate you are a PyNGL or PyNIO user somewhere in the "Statement of work" field. The registration will have to be manually approved by an ESG administrator (this should happen within a couple of hours during the regular work week) before you can download the software.

Please note that you will receive an automated email message with a web link that you need to visit before the registration can be approved. Once the registration is approved, you will receive a second "welcome" email message. If you don't receive this second message within a reasonable amount of time, send email to esg-support@ucar.edu.

Download appropriate binaries for your system

Once you are registered on the ESG site, do the following to download PyNGL/PyNIO:

  1. Go to http://www.earthsystemgrid.org/ and login with your username and password (if you haven't already).

  2. Scroll down to the middle of the page to the pull down menu next to "Shortcuts menu" and select "Latest PyNGL release".

  3. This should take you to a page that that has a list of PyNGL binaries. To download the binaries you want, right-click on the words "NCAR DISK" on the same line as the binary you are interested in. This should download the file.

    If you are not sure what binary you need, you can type "uname -a" on your system to give you more information. Also, "gcc --version" will tell you what version of gcc you have.

Install and test PyNGL and PyNIO

Once you have the file, you need to gunzip and and untar the file, and run the "setup.py" script:

    gunzip PyNGL-1.2.0.Darwin-8.10.1-i386-2.4.tar.gz
    tar -xf PyNGL-1.2.0.Darwin-8.10.1-i386-2.4.tar
    cd PyNGL-1.2.0
    python setup.py install

Note: if you are installing the Numeric version, then replace "PyNGL" in the example above with "PyNGL_numeric".

PyNGL and PyNIO depend on many data files (like font and map databases and GRIB2 code tables) in order to execute properly. They will try to find these files in a directory like $PYTHONPREFIX/lib/pythonx.y/site-packages/PyNGL/ncarg or $PYTHONPREFIX/lib64/pythonx.y/site-packages/PyNGL/ncarg. If your installation is not set up this way, then you may need to set the PYNGL_NCARG environment variable to point to the correct path (up to and including the "ncarg" directory).

When the PyNGL/PyNIO installation is complete, you can run any one of the examples in the example suite by typing:

   pynglex example_name
where example_name is the example you want to run. For example:
   pynglex nio01
(This is a PyNIO example.)

If you have installed the Numeric version of PyNGL and PyNIO, then you can generate a Numeric version of any of the examples by including the "--numeric" option:

   pynglex --numeric topo1
For a list of all the example names, type:
   pynglex -l
The default for most of these examples is to send the output to a PostScript file using the example name, with a ".ps" appended. To change the output to an X11 window or a PDF file, use the "-w" option:
   pynglex -w x11 ngl01p
   pynglex -w pdf ngl01p

Note that if the output file contains multiple frames and you are sending the output to an X11 window, you need to click on the window with your left mouse button to advance the next frame. Or, you can position your mouse over the window and hit <RETURN>.

NumPy and Numeric versions of PyNGL and PyNIO

PyNGL and PyNIO are available with either NumPy version 1.0.x or Numeric version 24.2 support. The NumPy/Numeric versions are distributed as separate packages. You can download and install both packages as they should not conflict with each other. Support for Numeric will eventually be dropped, so it is recommended that you move to NumPy.

If you download the NumPy version, you can import PyNGL and PyNIO with:

import Ngl, Nio
If you download the Numeric version, you must import PyNGL and PyNIO with:
import PyNGL_numeric.Ngl as Ngl
import PyNGL_numeric.Nio as Nio
and then you will be able to use all the "Ngl." and "Nio." calls in the usual way.

If you have the numeric version installed, you can generate any of the pynglex examples by including the "--numeric" option:

   pynglex --numeric ngl01p