Downloading and installing PyNGL and/or PyNIO

Newer versions of PyNIO and PyNGL

July 25, 2016

We have newer versions of PyNGL and PyNIO available under conda.

To use conda, we first recommend that people install Python from one of these two environments:

If you are still not sure which one to download, see this discussion on the two environments.

In either case, be sure to download the environment that includes Python Version 2.x, and not 3.x (we hope to have 3.x versions in the near future).

To install PyNIO and PyNGL under conda, we recommend creating a conda environment:

  conda create --name pyn_test python=2
  source activate pyn_test

You can now install the packages using conda:

  conda install --channel ncar --channel khallock pynio pyngl

To test both packages, first try importing them from within python and look at their version attributes:

>>> import Nio
>>> import Ngl
>>> print Nio.__version__
>>> print Ngl.__version__

You can also run one of the PyNGL graphical examples that uses PyNIO to read a file and PyNGL to plot it. See the PyNGL gallery and look at examples "" or "". Once you save one of these examples, you can run it on the UNIX command line with:


Older versions of PyNIO and PyNGL

To download and install older versions of PyNGL or PyNIO on your system, you need to:

Request an ESG account

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

and look on the right side of the page under "Quick Links" for "Create Account".

Download the source code and/or appropriate PyNGL and/or PyNIO binaries for your system

You can browse the different versions of PyNIO and PyNGL by going to and clicking on:

"PyNGL: Python Interface to the NCL Graphics Libraries"
"PyNIO: Python Interface for Multi-format Geoscientific Data I/O"
in the bottom center of the page. You don't need to login to browse the website.

When you find the version you're interested in, clicking on "Download files for this collection" will prompt you for your ESG login and password. You will need to agree to a source code or binary license before you can download any files.

There are two ways to download a file:

  1. You can click on the filename in the left side of the table directly to download it to your current system.

  2. If you need to download a binary for a remote system, you can use "wget" to download one or more files. To use "wget", check one or more boxes to the left of the filename(s) you want to download. Click on "Download all selected files" and you will be given a chance to download a wget script for those files.

  • Depending on what you downloaded, read one or both of the following sections on installing binaries or building from source code.

    Remove old versions

    Since PyNGL and PyNIO used to be packaged together, it might be a good idea to remove any old combined versions before installing the individual PyNGL or PyNIO packages.

    You can do this by removing the "PyNGL" directory from the appropriate "site-packages" directory under your python distribution. This location may vary from system to system, but is generally found in $PYTHONPREFIX/lib/pythonx.y/site-packages, where x.y is the version of python, like 2.6 or 2.7.

    Install software

    Test software

    You can quickly test PyNIO and PyNGL by running python and importing their respective modules:

    import Nio
    import Ngl

    For more extensive PyNIO tests, see the test PyNIO section.

    For more extensive PyNGL tests, you can run any one of the examples in the gallery by typing:

       pynglex example_name
    For example:
       pynglex ngl01p
    Note that some of these examples depend on PyNIO, and will not run unless you install PyNIO, or use another package to read in the data files.

    For a list of all the examples, 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, PDF, or PNG file, use the "-w" option:
       pynglex -w x11 hdf1
       pynglex -w pdf tickmark2
       pynglex -w png xy2

    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>.