SCD News > SCD story/photo of the week: October 29, 2004
Python interface to NCL Graphics Library now available
After months of testing, documentation, and user feedback, software engineers Fred Clare and Mary Haley of SCD's Visualization and Enabling Technologies Section (VETS) have announced the release of PyNGL, a Python interface to the NCL Graphics Library.
NCL, which stands for NCAR Command Language, is a programming language developed by SCD and designed specifically for the access, analysis, and visualization of data in the geosciences. Python, a mainstream programming language often compared with Perl, TCL (Tool Command Language), and Java, has a large base of scientific users.
PyNGL (pronounced "pingle") has generated an enthusiastic response among atmospheric researchers who use Python for programming but want the superior visualization capabilities of NCL.
"A number of people in the Python community had expressed regret that there were no high-quality 2D graphics available in that language," says Fred. "Meanwhile, NCL has some of the best 2D scientific graphics in the world, and we wanted to make it available to a wider audience. So we saw this as a great opportunity."
PyNGL allows Python users to access NCL graphics from a Python script without having to learn NCL. "By creating this module," says Mary, "we're opening ourselves to a whole new level of opportunities we didn't have opportunities to collaborate with universities and other research centers."
Mary expects PyNGL to bring new visibility to NCL, with the potential for hundreds of new users. Indeed, a professor of geophysical sciences at the University of Chicago is already planning to use PyNGL to teach a Python-based computational course in January 2005.
Release and documentation
In January, Fred and Mary began working with a test group to shake down the alpha version of PyNGL. In September they introduced the beta release at the Scientific Python (SciPy) user conference at the California Institute of Technology in Pasadena, where one attendee called it "the best thing I took away from SciPy 2004." (The PyNGL presentation and other conference talks are available at http://www.scipy.org/wikis/scipy04/ConferenceSchedule.)
PyNGL is extensively documented online, with more than 200 pages of introductory material, examples, supplemental information, appendices, an FAQ, and a glossary, as well as instructions for downloading. Like NCL, PyNGL is available at no charge to users. An email group is available for all PyNGL-related topics.
Next step: Pythonizing NCL's I/O and functions
In addition to its superior 2D visualization capabilities, one thing that makes NCL extremely valuable to atmospheric researchers is its extensive file input and output capabilities. "NCL's powerful I/O functionality allows users to read in multiple file formats, including netCDF, GRIB, HDF4, ASCII files, and binary files," says Mary. "All the data formats that contain metadata are converted to a uniform interface similar to netCDF, which is quite convenient. Likewise, you can write NCL output to the various formats, except for GRIB."
Yet another NCL strength is its data-processing functionality. "NCL has over 400 functions and more than 800 example codes, most of which are specifically tailored to the atmospheric sciences," Fred says. "I think no other package has anything even close to what we have in that area."
VETS software engineer Dave Brown is currently Pythonizing the I/O functionality, and plans are underway to Pythonize the data-processing functionality as well.
Exposing NCL's functionality to a wider community
NCL is simple to install and it's free users can download it off the Web. It's easily ported to new architectures and is supported on most UNIX platforms, including all the supercomputers at NCAR. Week-long workshops for users are offered about every three months some at NCAR, and some at universities and research centers around the country.
NCL is still growing; in an important new development, it recently acquired a capability that allows users to contour directly on arbitrary triangular meshes (see the Chesapeake Bay visualization). Because the use of nonstandard grids is a hot area in research today, this new capability is appealing to a whole new class of users.
Monthly downloads of NCL have gone up by a factor of four since 2001, and in the last 18 months there's been a 70 percent growth in the NCL email discussion list.
"NCL is a powerful tool," Mary says. "Scores of users have told us how valuable NCL is to their scientific research."
The new PyNGL interface will allow an even wider user community to access NCL and put its many capabilities to use. Additionally, says VETS manager Don Middleton, "PyNGL is the first step in a larger strategy one that will allow us to tap the open source movement, integrate 3D visualization capabilities, and leverage other software development efforts in the community."
For more information
For more information, see the "Getting started using PyNGL" web page at:
Photo: Lynda Lester, NCAR/SCD
NCAR is managed by UCAR and sponsored by the National Science Foundation