Overview of the PyNGL examplesThe PyNGL examples give you an overview of the graphic capabilities of the package and provide a tutorial introduction. Other useful example-related links are provided - a summary is presented in a list below. NumPy installed in your Python implementation, and you must also have the appropriate version of PyNGL and PyNIO installed.
Many examples use the Nio module from PyNIO to read in a netCDF file (or files). The Nio module comes bundled with PyNGL. netCDF is a self-documenting and network-transparent data format - see the netCDF User Guide for details.
- If you wish to display the example output to an X11 window,
you must have your DISPLAY environment variable set
correctly. Also, when directing the output to an X11 window, you'll
need to click on
the window with your left mouse button to advance to the next
frame, or to close the current frame.
- By default the examples generate PostScript output (and some
generate auxiliary files), so be sure you
are in a directory where you have write permission.
Here is an example of how to use pynglex:
pynglex ngl01pThis command will copy over the necessary source files to run the example named "ngl01p" (actually only ngl01p.py in this case), invoke Python to run the example, and generate the output graphic in the PostScript file ngl01p.ps. A complete list of the example names is given on the alphabetical page or by running "pynglex -l". The pynglex script takes several command line options, see the pynglex documentation for details.
If you wish, you can download these examples from the web using the links that are provided for each example.
- Read data
- Data are either generated from within the PyNGL script or read from
either an ASCII file or a netCDF file.
- Process data
- Some of the examples show how to process data by converting units,
masking values, interpolating to a regular grid, and so forth.
- Visualize data
- Almost every example generates one or more visualizations, including
XY plots, contour plots, vector plots, map plots, and streamline plots.
- Write data
- Some of the examples show how to write data to a file.
- Provides all graphic images produced from PyNGL examples as well as links to all source codes used to create the examples.
- An alphabetical listing of all PyNGL examples together with brief descriptions and links to the sources.
- A step-by-step guide to PyNGL that introduces new concepts through a series of example Python scripts. Each of the eleven examples contains line-by-line descriptions.
- by category
- Lists the examples by category (such as "contouring", "vectors", and so forth) and provides links to the examples in those categories.
- by function
- For any given PyNGL function, this page lists all the examples where that function is called.
- by resource
- For any given PyNGL resource that is used in an example, this page lists all the example where the resource is used.
- by effect
- This page provides links to examples that illustrate specific effects, such as changing lines thicknesses, explicitly specifying contour levels, and so forth.