
NCL > Application examples > Basic examples
Running NCL and HLU examples with the ng4ex command
The ng4ex command copies, compiles, and runs NCL and HLU (C/Fortran) examples in your local directory. These examples demonstrate how to use NCL and the High Level Utilities (HLUs) to create two-dimensional visualizations.Depending on the example, the output may be sent to an NCGM (NCAR Graphics Metafile) file, a PostScript file, an EPS file, an EPSI file, a PDF file, and/or displayed to an X11 window on your screen. You must be running an X server and have your DISPLAY environment set correctly in order for the X11 window examples to execute properly.
If the requested example creates an NCGM, PS, or PDF file, it will have the same name as the example, suffixed with ".ncgm", ".ps", or ".pdf".
Some ng4ex options
- -list
Lists all the available examples without generating them.
- -W output_type
Change the default output for this example to the given output_type. Valid options:
- -W ncgm
- -W pdf
- -W ps
- -W eps
- -W epsi
- -W x11
- -n
Copy only the code and data to your directory, without compiling or running the example.
- -clean
Remove everything but the resultant output file.
- -ncl
Generate (or list, if used with "-list" option) only the NCL examples.
- -C
Generate (or list, if used with "-list" option) only the C examples.
- -Fortran
Generate (or list, if used with "-list" option) only the Fortran examples.
- -cdf
Generate (or list, if used with "-list" option) the examples that open netCDF files.
Examples
- ng4ex gsun01n
- Copy, compile, and run the gsun01n
NCL example. The output for this example only goes to an X11 window.
- ng4ex xy01c
- Copy, compile, and run the xy01c C
example. The default output (X11 window) will be used in this case.
- ng4ex xy01c -W ps
- Copy, compile, and run the xy01c C
example, but this time send the output to a PostScript file (xy01c.ps).
- ng4ex cn08f -n
- Copy the cn08f Fortran code and
any necessary data files to the current working directory, and don't
compile or run the example.
- ng4ex nm03n vc06f -clean -W pdf
- Copy and run the nm03n and
vc06f examples,
leaving behind only the "nm03n.pdf" and "vc03f.pdf" files.
- ng4ex -list -ncl
- Lists all of the available NCL examples.