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:
- Anaconda - this
requires a bit of disk space but gives you a comprehensive suite of
scientific Python packages.
- miniconda - this allows you full control over which Python packages are installed and hence doesn't take up as much disk space.
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 "overlay1.py" or "multi_plot.py". 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 account from the Earth System Grid (ESG) website
- Read these notes for Mac OSX systems
- Download the source code and/or appropriate binaries for your system
- Remove old versions
- Install software
- Test software
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".
You can browse the different versions of PyNIO and PyNGL by going to http://www.earthsystemgrid.org and clicking on:
"PyNGL: Python Interface to the NCL Graphics Libraries"or
"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:
- You can click on the filename
in the left side of the table directly to download it to your current system.
- 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.
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 PyNGL or
PyNIO from binary ("built") distribution
- Install PyNIO from source code
- Install PyNGL from source
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_nameFor example:
pynglex ngl01pNote 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 -lThe 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:
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>.