UNIDATA

A GKS Version of NCAR Graphics Ported to the IBM PC

Ben Domenico

University Corporation for Atmospheric Research (UNIDATA Project)

Daniel E. Vietor and Ernest M. Agee

Department of Earth & Atmospheric Science Purdue University

1. General Background

Many university scientists who use NCAR Graphics software on the NCAR supercomputers have also implemented the package on the mainframe and minicomputers at their home institutions. NCAR has distributed over 800 copies of the package over the last four years. Additional copies are often made from each distribution copy. Scientists apparently find that not only does the package provide a convenient means of displaying their data graphically, but many research groups modify the code to create a scientific graphics system tailored to their own special research needs. This is possible because NCAR Graphics is a fairly compact and comprehensible library of Fortran subroutines for which source code is distributed.

2. Typical Use of NCAR Graphics

One of the most typical uses of NCAR Graphics for atmospheric scientists is to produce a contour map of a field of data (such as temperature or pressure) overlaid on a geographical basemap. The data field may come from various sources; for example, it may be observational weather data or the output of an atmospheric model run on a supercomputer.

To produce such a picture, the researcher writes an applications program that uses the map generation (EZMAP) and contouring (CONRAN and CONREC) utilities within the NCAR Graphics library. This application calls EZMAP routines to generate the base map and CONRAN or CONREC routines to produce the contour lines representing the data. Titles and labels may be added by calling the appropriate routines for annotating the final plot. Until recently, the only form of output from the package was NCAR metacode, which is stored in a disk file. A separate program, called a metacode translator, reads the metacode file and generates specific instructions to produce the picture on a particular graphics device.

An important thing to note here is that, while the researcher has to write the applications program, he or she can produce a reasonably good contour plot and basemap on quite a variety of graphics devices without delving into the details of contouring algorithms of map projection transformations. Moreover, since metacode translators have been written for most of the common graphics devices, there is no need to learn the special instruction sets for driving specialized graphics devices. In addition to such direct uses of the graphics software, many research groups with data display requirements that go beyond the capability of NCAR graphics use portions of the existing package as a template for generating their own tailored graphics library.

3. Advantages and Limitations

The NCAR package provides a set of building blocks which enables many scientists to display their data quickly without getting distracted in the details of computer graphics systems. These building blocks, coupled with an avenue for constructing a new set of tools for special cases, appear to be a useful combination for many research groups. The package runs on most major minicomputers, mainframes, and supercomputers, so it is reasonably portable, and the metacode approach to graphics output provides independence from any specific graphics device.

On the other side of the coin, the old form of NCAR Graphics has many noticeable limitations--especially in the world of graphics workstations and personal computers. The old version served well in the batch supercomputing environment at NCAR, but does not take advantage of the capabilities of interactive computing systems: there is no provision for graphics input and the only form of output is metacode which has to be translated by a separate program. Furthermore, the old system has no consistent mechanism for dealing with color, for filling polygon shaped areas, of for displaying raster images. There is no mechanism for taking advantage of these facilities on modern interactive computer systems.

4. Removing Limitations by Adopting Standards

Many of the limitations of the NCAR Graphics package have been addressed by replacing the NSPP by systems based on the Graphical Kernel System (GKS) standard, which was recently adopted by both the International Standards Organization (IS0) and the American National Standards Institute (ANSI). Besides being formally recognized as a standard, GKS is becoming an industry standard, since many vendors of computer hardware and software are providing implementations of GKS. One can now purchase GKS for most computer systems and graphics devices.

The GKS standard includes a Fortran binding that specifies the names and arguments of the library of routines that comprise a standard system. Many of these routines duplicate the functionality of the old NSPP routines, but there are also many other routines for producing pictures with color, filled areas, raster images, etc. Some examples of GKS output primitives are POLYLINE for drawing lines between multiple sets of points; TEXT for writing characters in a plot; FILL AREA for filling polygons with color of patterns; and CELL ARRAY for plotting raster image data.

5. Graphics Input

GKS also has facilities for graphical input--a function that was not available in the batch-oriented NCAR environment. Some examples of input primitives are REQUEST STRING to let the user type in a character string (useful for interactive input to running programs); REQUEST LOCATOR to return the location of a pointer (useful for pointing to positions on the screen); and REQUEST CHOICE to select an item by pressing a function key (useful for building menus).

Thus a transition to GKS can retain the best features of the old package, namely portability and device-independence. At the same time, a GKS-based application has access graphics input facilities and extended output facilities. GKS also eliminates the need for the intermediate step of creating a metacode file. While there is a provision for storing pictures in a standard Computer Graphics Metafile (CGM), GKS can drive graphics devices directly. For example, one might construct a contour plot using the new version Of CONREC, then write the application go that the user can use graphics input to specify a portion of the picture to "zoom in" on.

6. Standardized Scientific Graphics Utilities

The graphics utilities are the heart of the NCAR graphics. They provide many of the graphics functions commonly needed by scientists and engineers. Some of the popular packages are: CONREC for contour plots of regularly-spaced data; CONRAN for contour plots of randomly-spaced data; EZMAP for geographical maps using various projections; AUTOGRAPH for X-Y plots; SRFACE for representing two-dimensional data field as a surface in three dimensions; VELVCT for displaying velocity vector fields; and THREED and ISOSRF for producing wire-frame representations of three-dimensional data.

The layering of the old system makes it possible to replace the NCAR System Plot Package (NSPP) with GKS, since GKS provides a standard subroutine library which includes most of the functions of the NSPP. In somewhat oversimplified terms, subroutine calls from the utility packages to the old NSPP routines were replaced with calls to GKS routines. This approach made it possible to produce a standardized version of the utilities with only minimal alterations of the interface to the utilities.

While the NSPP routines were being replaced by GKS, the code was also converted to Fortran 77, so that it would conform to international standards for language as well as for graphics. To ease the transition for existing applications which called the old NSPP directly and to supply NSPP functions missing in GKS (log-log plotting coordinates for example), a library called the System Plot Package Simulator (SPPS) was added to the utilities layer.

7. NCAR Graphics on the IBM PCs

With the new standards set for the rewrite of NCAR Graphics it has now become easier to port the source code to smaller computers that have Fortran 77 and GKS capabilities. With the development of the Professional Fortran package (ANSI standard Fortran 77) and Graphics Software System's level OB version of GKS, the effort is underway to port all of the NCAR Graphics over to the IBM PCs. Presently, only 90% of the package has been ported.

The graphics package contains several demonstration programs in order to show the capabilities of the various graphics subroutines.

NCAR Graphics on the IBM microcomputers uses GKS from which graphics metacode is produced and sent to the Virtual Device Interface (VDI). The VDI allows the computer to access general input/output devices independent of the applications program. The interface receives the generic metacode and directs it to one of the many I/O device drivers that have been loaded into the computer. The device drivers convert the metacode into specific commands for the particular I/O device. Therefore, the device driver takes the place of the metacode translator in the old package.

The new version of NCAR Graphics does not take care of all of the GKS initialization. Subroutines exist within the package to accomplish some of the initialization but these may not work for a specific computer and application. Therefore, editing of various parameters like I/O devices and GKS working space and relinking the program may be necessary. Also, additional GKS routines can be integrated into NCAR Graphics applications in order to accomplish tasks not incorporated into the NCAR package.

8. Applications of NCAR Graphics on the IBM PCs

Applications programs using the old version of NCAR Graphics have been around for years on mainframes. Until just recently, it was nearly impossible to consider running these applications on microcomputers. Now that NCAR Graphics are available on the IBM PCs, those mainframe applications can be ported to the PCs. One such package is the Purdue Regional Objective Analysis of the Mesoscale (PROAM) which takes randomly spaced surface data and fits it to a grid using a Barnes analysis scheme (see Barnes, 1964). From the gridded data, several derived fields are calculated including vorticity, various types of potential temperature and convergence fields. The display program called NICMAP uses the NCAR Graphics routine EZMAP and CONREC to contour a gridded field of data on a background map. This program has existed on the CDC 6500s for almost a decade and just recently has been ported over to the IBM PCs.

9. Future Activities

The current version of NCAR Graphics still lacks an interactive environment. The future goal for NCAR Graphics is to incorporate the interactive routine available within GKS in order to upgrade the package to the level Of GEMPAK/GEMPLT and McIDAS. This will allow the use of input devices like mouses, light-pens and keyboards to edit the output graphics displays. This may include color fill of contour intervals, overlaying contour fields on satellite imagery and selecting three-dimensional viewing angles. The higher level GKS routines will soon carry the capabilities of the NCAR Graphics far beyond its current batch environment into the future of interactive graphics.

10. Acknowledgments

The authors are grateful for the help and support of their colleagues Carla Breiner, research associate; Bret Pennington and Keith Lingwall, computer technicians. This research was supported in part by NSF Grants ATM-8506124 and ATM-8505477, and DOD-ONR Grant N00014-86-K-0179 awarded to Purdue University.

11. References

Barnes, S. L. , 1964: A technique for maximizing detail in numerical weather map analysis. J. Appl. Meteor., 3, 396-409.



This page was Webified by Jennifer Philion.
Questions or comments can be sent to <support@unidata.ucar.edu>.
This page was updated on .