
Home | What is NCARG | Getting started | Examples | Documentation | Download | Support | What's new | FAQ | Search
This "FAQ" provides answers to frequently asked questions about the NCAR Graphics package. It is organized by topics:
Consulting support
Documentation
Supported systems
Data processing
Post-processing
The latest version is 5.0.0, which was released in November 2007.
NCL is built on top of NCAR Graphics. It was originally only available in binary format, while NCAR Graphics was available in source code and binary format. When we decided to release the source code for NCL, we decided at this time to combine the two packages and release them as one, since we have lots of users that use both.
NCAR Graphics is primarily a graphics package, with some limited data analysis through the Ngmath package. It is strictly library based, which means you need to write a Fortran or C program in order to use it.
NCL is a graphics, data analysis, and file input/output package. It is a language, so you need to write NCL scripts to use it.
If you are new to both NCAR Graphics and NCL, then we recommend that you learn NCL, as it gives you more capabilities and the graphics are easier to use.
If you have existing NCAR Graphics programs, or need some of the graphics features of NCAR Graphics that are not available in NCL (like weather maps), then we recommend you use NCAR Graphics.
Type:
ncargversion
Go to appendix B in the "NCAR Graphics Fundamentals" or see the man page for ncarg_env.
You can send email to ncarg-talk@ucar.edu. You need to subscribe before you can post:
http://mailman.ucar.edu/mailman/listinfo/ncarg-talkBe sure to include your NCAR Graphics version number (you can get this by typing ncargversion), the type of machine you are running on and its operating system (to get this info, type uname -a), the exact error messages, if any, and a detailed description of the problem.
There is no newsgroup, but there is an email support group for NCAR Graphics users to share ideas. To subscribe to this group or see the archived messages (from 1994 to the present), go to:
http://www.ncarg.ucar.edu/ncarg-talk/
The ncarg-talk forum gives NCAR Graphics users a chance to share information and ideas among themselves and to bring up NCAR Graphics issues that are of concern. NCAR personnel will not necessarily read or respond to this email group's correspondence on a regular basis. The intended use is solely for the NCAR Graphics user community.
Along the same lines, there are email lists for NCL users:
http://www.ncl.ucar.edu/Support/email_lists.shtml
You can access the documentation on the web via the URL:
http://www.ncarg.ucar.edu/documentation.html
First of all, you need to make sure that your HTTP server supports running cgi scripts from within the document-root directory, and have the server configured to accept *.map files as cgi scripts. It is possible to disable this option using the server configuration files, so make sure this isn't the case. For more information, see the section "Installing NCAR Graphics documentation" in the "NCAR Graphics UNIX Installer's Guide, NCAR Graphics Version 4.1.1."
http://www.ncarg.ucar.edu/download.html
NCAR Graphics will run under Windows if you have Cygwin/XFree86 installed, and under MacOSX with XonX or some other X server running. We do not have a version of NCAR Graphics for VMS systems.
If the unsupported system is one that we have in-house and have received a lot of requests for, then we may have already done the port. See the question on supported systems for more information.
If you have ported NCAR Graphics software to an unsupported system, and would like to share your port notes and/or binaries, please send email to Mary Haley.
First you need to get your data in gridded format. You can do this using one of your own interpolation routines, or you can use one of the gridding routines in the Ngmath package.
Once you have gridded data, you can create your contour plot using Conpack.
You use one of the gridding routines in the Dsgrid section of the Ngmath package. See the URL:
http://www.ncarg.ucar.edu/ngmath/dsgrid/dshome.htmlTo see some examples using Dsgrid, type:
ncargex nnex03 c_nnex03
Yes, you can use the application ncargex. Appendix D of the NCAR Graphics Fundamentals contains a pictorial guide to most of the examples that you can then access with ncargex.
Type:
ncargex -xxxx -listwhere xxxx is the name of a particular utility. For example:
ncargex -conpack -listIf you type ncargex without any arguments, you will get a full list of arguments, including the various groupings of utilities that are available.
You can use one of two scripts provided in $NCARG_ROOT/bin. The commands ncargcc and ncargf77 are for compiling C and Fortran programs. Make sure the environment variable NCARG_ROOT is set and that $NCARG_ROOT/bin is on your search path before you try to execute these commands.
For example, if your program is called program.f then you would compile it with the following command:
ncargf77 -o program program.fOn some systems that also have a Fortran 90 compiler, the script ncargf90 may be available. It works in the same manner as ncargf77.
It's possible you are not linking in all the necessary libraries. Make sure you are linking in the ncarg_c library which is required for both C and Fortran programs. See the question for commands you can use to help you compile your program.
You can change the name of either one by setting the Ngmisc parameter "ME". See the section "Overriding Default File Names" in the GKS document for information on how to do it for a PostScript file. The same call applies for changing the metafile name.
To generate two examples that change the metafile name and the PostScript file name, type:
ncargex pgkex26 pgkex27You can also use the NCARG_GKS_OUTPUT environment variable. For example, you would type the following before running your program:
setenv NCARG_GKS_OUTPUT plot.ncgm
NCARG_ROOT environment variable not set.What should I do?
The NCARG_ROOT environment variable must always be set when you access NCAR Graphics software in any way. If the directories containing the NCAR Graphics libraries and binaries reside under one root directory, then set the environment variable NCARG_ROOT to this directory. Otherwise, find out from your system administrator to what you need to set the environment variable NCARG_ROOT.
Type:
tgks0afor a b/w NCGM and:
ncargworldfor a color NCGM. Both commands will create a metafile called gmeta.
Type the command:
ncgmstat -c gmetawhere gmeta is the name of your metafile.
We used to recommend using a script called "ncgm2gif" for converting NCGMs to GIF files. However, "ncgm2gif" has become a bit outdated, and there are better methods for converting to other raster formats.
Our recommendation is to start with a PostScript (PS) or Encapsulated PostScript (EPS) file, and then use "convert" from the ImageMagick suite of tools to convert the PS file to another format like GIF, PNG, or even MPEG.
You can get the ImageMagick suite from:
http://www.imagemagick.org/Click on the "download" link on the left side and you will be presented with lots of options for download locations.
Mac users can download it using "fink install imagemagick". You must have fink installed first - http://fink.sourceforge.net/.
Once you have the tools built and installed, you can convert your PS files to other formats using:
convert -trim file.ps file.png
We like to use the "-trim" option to remove unwanted white space
around the image. This cuts it pretty close, so if you put it in a
PowerPoint presentation, it is better to use a pure white background
so the cropped image doesn't look funny.
Documentation on "convert" can be found at:
http://www.imagemagick.org/script/convert.phpThere are lots of options available with convert, that, according to their web page, allow you to "resize an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample, and much more."
Our recommendation is to start with a PostScript (PS) file, and then use "convert" from the ImageMagick suite of tools to convert the PS file to an MPEG file.
Please follow the instructions above on how to get the ImageMagick tools installed on your system.
You will also need to download the program "mpeg2encode". The source code for this can be downloaded from:
http://www.mpeg.org/MSSG/From here you want to download the source code for "mpeg2vidcodec". The "mpeg2encode" code is pretty straightforward to build (in the directory mpeg2/src/mpeg2enc).
Once you have mpeg2encode installed, you can convert your PS file to MPEG with:
convert file.ps file.mpg
There are at least three ways you can do this:
There are several ways to do this. FrameMaker can import raster imagery which can be generated as described above. For higher output quality, it is better to use CGM as an intermediate file format. An NCGM can easily be converted to vanilla CGM with the following command:
ncgm2cgm < plot.ncgm > plot.cgmThe advantage of importing CGM files to FrameMaker is that the vector elements of the image will be editable. The disadvantage is that you will need sufficient hardware to work with large CGM files with reasonable response times.
First you need to get your graphic as an encapsulated PostScript file. You can do this using the direct PostScript driver or using ctrans to first convert your NCGM to PostScript and then using some kind of filter (like ps2epsi which is a utility based on GhostScript) to convert that to an encapsulated PostScript file.
Then, in your TeX or LaTeX file, you need to have the following lines:
. . .If you want to resize the figure, you can do so with one or both of the TeX commands:
\input epsf
. . .
\epsfbox{gmeta.epsi}
. . .
\epsfxsize=dimen \epsfbox{gmeta.epsi}This will cause the plot to have a width of dimen in the indicated direction, and the other direction will be scaled automatically to preserve aspect ratio.
\epsfysize=dimen \epsfbox{gmeta.epsi}
Important: The figure will not show up in the dvi file; it will only show up when you print or view the PostScript file.
First of all, you cannot use the UNIX command cat. You need to use the NCAR Graphics command med instead. For example, if your metafiles are called foo1.ncgm, foo2.ncgm, and foo3.ncgm, type:
med -e 'r foo1.ncgm' -e 'r foo2.ncgm' -e 'r foo3.ncgm' -e 'w all.ncgm'to concatenate them into the metafile all.ncgm.
Put the following line in your X resource file, and change the values to suit your preference:
Xgks*geometry: 800x800+0+0The "800x800" indicates you want the window to be a square that is 800 pixels in both directions. The "+0+0" indicates the X and Y position of the upper left corner of your X11 window.
Try the following and change the numeric values to suit your needs:
idt*geometry: 300x300+0+0
idt*TopLevelShell*geometry: +0+536
This is possibly due to an X11 backing store problem. If you run the command:
xdpyinfo | grep backingand the output is similar to:
options: backing-store NO, save-unders NOthen you will need to enable backing store in your X server configuration.
There are different ways to do this, depending on what kind of system you're on. On a Linux system, try inserting the line:
Option "backingstore"in the Device section of your X server configuration file (normally /etc/X11/XF86Config or /etc/X11/XF86Config-4). Alternatively, you can run your X server with the option "+bs" to obtain the same result without editing your configuration file. Restart your X server, then run the xdpyinfo command again to verify that backing store is now enabled.
On a PC running Hummingbird, run Exceed's "xconfig" program. In the xconfig menu, double-click on "Performance". Make sure "Save Unders" is checked, set "Maximum Backing Store" to "Always", set "Default Backing Store" to "When Mapped", and set "Minimum Backing Store" to "When Mapped".
Use the following command:
med -e '1,$d' -e 'r corrupt.ncgm' -e 'w corrupt.ncgm' valid.ncgmwhere corrupt.ncgm is the metafile missing the `End of Metafile' element and valid.ncgm is any existing valid metafile (a metafile which contains an `End of Metafile' element).
Be forewarned that the repaired metafile will inherit the global graphical attributes of the valid.ncgm metafile. Hence, the new metafile may differ greatly from the original. However, empirical evidence suggests that this trick works adequately in most instances.
First, modify the file $NCARG_ROOT/lib/ncarg/ncarv_spool and add the line:
pscolor : -d ps.color -d simulatebg : | lpr -Pxxxxwhere xxxx is the name of your PostScript printer. Then, if your metafile is called gmeta and you want to print frames 1, 2, 3, 4, and 8, you would type the following:
ictrans -e 'spooler pscolor' -e '1,4P' -e '8P' -e 'quit' gmetaFor more information you can see the man pages for ictrans and/or ncarv_spool.
You need to set up an ncarv_spool file that indicates what your various output devices are. For example, if you have two PostScript printers, where one is a color printer called "lpc" and the other one is a black-and-white printer called "lpbw", then your ncarv_spool file might look something like this:
pscolor : -d ps.color -d simulatebg : | lpr -PlpcPut this file in the directory $NCARG_ROOT/lib/ncarg. Then, when you run idt and click on the "Print" button, you should see two items: "pscolor" and "psbw." You can select the one where you want to send your graphical output.
psbw : -d ps.mono : | lpr -Plpbw
Output devices can also be files. For example, if you want to convert your frame to a sun raster file, then you might have another entry in your ncarv_spool file that looks like this:
sunraster : -d sun : > gmeta.sunIf you select this item from the idt "Print" menu, then a file called "gmeta.sun" will get created.
In addition to having a global ncarv_spool file in $NCARG_ROOT/lib/ncarg, users can create their own personal .ncarv_spool file and put it in their home directory (the file must have a `.' in front of it). This file will then get merged with the one in $NCARG_ROOT/lib/ncarg whenever idt or ictrans is invoked.
With the direct PostScript driver, you can do this from within your NCAR Graphics program by setting the Ngmisc parameters "LX", "UX", "LY", and "UY" after you open GKS.
For more information, see:
http://www.ncarg.ucar.edu/gks/ps.html#UsingFullPage