Sean Kelly*
NOAA Forecast Systems Laboratory, Boulder, Colorado
Thirteenth International Conference on Interactive Information and Processing Systems (IIPS) for Meteorology, Oceanography, and Hydrology, 2 - 7 February 1997, Long Beach, CA.
Table of Contents
The WFO-Advanced is the latest prototype Advanced Weather Interactive Processing System (AWIPS) workstation developed at the Forecast Systems Laboratory (FSL). The WFO-Advanced features a two-dimensional display (D2D) of meteorological data provided by national and local services (MacDonald and Wakefield, 1996).
To complement the D2D design, FSL developers created an efficient programmatic interface to simplify the integration of local applications into the system. In describing the functions of the D2D application interface, this paper covers how new and existing programs can become D2D applications, what requests they can send to the interface, and what notifications they receive from the interface. It also surveys the kinds of applications currently deployed along with the D2D software, and concludes with a comparison of the application interface with the D2D extension framework, an alternative way for forecasters and developers to provide customized functions to D2D.
In the simplest sense, the D2D application interface provides a way to run programs external to the D2D software. For example, either a Web browser or a word processor could be an application that the interface runs. Any program that runs with the HP/UX variant of the Unix operating system can be considered an application, which can bring up its own user interface using any style.
To protect forecasters as they perform operational meteorology with D2D, the interface runs applications as processes separate from the core D2D processes; thus, if one of the applications crashes, it does not affect D2D. However, an application could still run amok and consume disk, CPU, or network resources that must be shared with the D2D software. To date, we have built no safeguards against this possibility.
In addition to being started by the D2D system, applications can also interact with D2D. The application interface provides a facility for programs to send requests to D2D and it also provides a mechanism for notifications to be sent back to running applications. These features enable an application to perform sophisticated processing, such as receiving a notification about what display scale the forecaster is currently using, generating a contour plot of isotherms on that scale, and then loading the plot into D2D's main display area.
Applications communicate with D2D using their standard input and output channels provided by the Unix operating system. Normally, the standard input for a program is the keyboard, and the standard output is the screen. The application interface sets up these channels so that the standard output actually sends information to the interface, and the standard input receives information from the interface. Because reading from the standard input and writing to the standard output is trivial, the interface makes it easy to develop nearly any kind of application---or to adapt existing programs to the interface.
Forecasters using the D2D software launch applications by selecting them from the D2D menus. Site administrators can add and remove applications from the menus by editing configuration files---without needing to recompile D2D software.
One of the D2D configuration files describes all the characteristics of the available applications, including
- An on-screen label appearing on the D2D menu, that the forecaster selects to launch a particular application.
- A filename containing the application's executable code.
- Arguments passed to the application on its command line.
- A choice whether to prestart the application: D2D will start these applications when it starts; otherwise, applications are started when the forecaster selects them.
- A choice whether to automatically restart the application if it terminates.
- A choice whether to allow multiple copies of the application to be running at one time, per D2D display.
The D2D application interface enforces the characteristics specified in the configuration file, which is read each time the D2D software starts. Site administrators can use their favorite text editors to make changes to the configuration file.
Applications send requests to D2D by writing text on their standard output. The application interface ignores any output produced by an application that it cannot recognize.
An application may load depictable data onto the D2D display by issuing a load request. Each kind of hydrometeorological product that can be drawn and animated on the D2D screen is called a depictable, which is indexed by a depict key. A table provided with D2D lists all depict keys, which are positive integers. For example, the depict key 101 is an infrared satellite image; depict key 2148499544 is the 310 K relative humidity plot from the Rapid Update Cycle (RUC) model.
Writing the text @@-Load followed by a space-separated list of depict keys to the application's standard output will load each of the depictables represented by those depict keys. Certain depict keys are treated specially. If an application loads one of these special depict keys, then the application itself provides the depictable data in an external file in the netCDF format (Rew et al., 1996). The D2D software will read and render the data in the file on the display.
Applications that need to know what depictables a forecaster is viewing can use the export request to get a copy of the data used to draw those depictables. By writing @@-Export followed by an integer representing the type of the data to export, the application interface will create files in the Unix /tmp directory representing any loaded data. The interface then sends a list of the files it created back to the application on its standard input (see section 5). If the list is empty, then the forecaster was not viewing any data of the type the application requested.
Applications can use exported data in any way they wish. For example, consider a hypothetical image processing application that improves contrast in low-light satellite images. When the forecaster starts the application, it can use the export command to request any displayed satellite image and can then read the file that the application interface created and apply its image processing algorithm. At this point, the application could display the new image in its own window, or write the data in the netCDF format and use the @@-Load request (described above) to display the new image in the main D2D window. The Figure below shows a timing interaction diagram that depicts the transactions between the image processing application and the D2D software.

Other requests include @@-Clear, which clears the main D2D window, @@-UserID, which selects a user ID, and @@-Print, which prints the contents of the main D2D window to a file or a printer. These requests, while available to any application, are really intended just for those applications that are part of the D2D software release.
As stated earlier, not only can applications send requests on their standard output, but they can also receive notifications on their standard input. By reading their input, applications can be apprised of user actions and the state of D2D's main display. Currently, there are three notifications that applications may receive:
- Scale changes. When the forecaster changes the display scale in D2D, all running applications are notified by receiving the text set_scale, followed by an integer representing the new scale, on their standard input.
- Requests for visibility. The application configuration file (see section 3) specifies that only one copy of certain applications may be running on a D2D system at a time. If the forecaster selects such an application from the D2D menu while one is running, a new copy of that application is not started. Instead, the text visible is received on the application's standard input. This is called a request for visibility. Applications are expected to de-iconify, or raise their windows (if applicable) upon receiving this notification.
- Exported data files. When an application requests that the currently displayed data be exported with the export command (see section 4.2), it will receive an export notification. The notification is the text exported, followed by a space-separated list of filenames containing the exported data.
The inspiration for the D2D application interface was the Unix shells. The various shells for Unix perform the same task: they read names of programs to execute from the keyboard and execute them synchronously or asynchronously with a variety of options for handling their standard input and output (Kernighan and Pike, 1984).
Like the shells, the D2D application interface also executes programs, which we call applications. Instead of typing the names of applications to run, users select them from the D2D menus. The applications always run asynchronously (to enable the core D2D software to continue running) and their standard input and output are always connected to the application interface, using Unix pipes. A pipe is a communications facility provided by Unix that enables one-way flow of data between two processes (Stevens, 1990).
D2D software constantly monitors all of the pipes connected to each of the running applications. Whenever an application writes text to its standard output, the D2D application interface reads that text and attempts to recognize any of the standard requests using a parser built with Lex (Aho et al., 1988). Since Lex automates parser construction, adding new requests to the application interface is simple. The application interface also queues notification text pending for an application and sends the text along the pipe connected to the application's standard input. The application then reads its standard input to receive the notification.
FSL has implemented a number of applications that are part of the D2D software release. Indeed, many of these applications appear as integrated features of D2D---which is our intent. Part of the reason why several of D2D's features were implemented as applications instead of as integrated software is because smaller, stand-alone applications are easier to develop and test. The D2D application interface makes such development possible. These applications can serve as examples to developers at local NWS offices tasked with writing new applications or integrating existing programs as applications.
Several simple applications provide nothing more than dialog boxes for D2D. These applications are written using Tcl/Tk, an embeddable scripting language with a graphic user interface (Ousterhout, 1994). For example, the print options dialog box is just a stand-alone Tcl/Tk program that runs under the application interface. When started, it displays a dialog box giving the user a variety of choices for color printing, paper sizes, scaling, and so forth. After the user dismisses the dialog, the application sends @@-Print along with the selected print choices to the application interface, which requests the D2D software to make a printout.
At first glance, the Volume Browser---a utility that lets the forecaster select volumetric data to load into D2D---appears as an integrated component of D2D. (It achieves this mostly because it uses the same color and font scheme that D2D uses.) It is, in fact, an application running under the D2D application interface. The Volume Browser is an example of an application that handles the visibility notification, described earlier.
Only one copy of the Volume Browser may run per D2D display. If the forecaster selects the Volume Browser application from the D2D menus, the single Volume Browser that is already running is sent the visibility notification. Upon receiving this notification, the Volume Browser de-iconifies itself (if it was iconified) and raises its window.
The most complex application is the Product Maker, which FSL developed for D2D. It enables the forecaster to create new products by applying mathematical operations to existing products from the available forecast models. The Product Maker creates a netCDF file for the newly created product and sends @@-Load with a special depict key as an argument. The application interface recognizes this special depict key and loads the data from the netCDF file. To date, the Product Maker is the only example of an application that creates depictable data for display in D2D.
Finally, another example worth reviewing is the Interactive Skew-T application. Here, we took the existing FSL-developed Interactive Skew-T Program (ISP) and made it an application. The ISP lets the user display and interact with skew-T and hodograph plots, and experiment with wind values and temperatures. D2D itself can display skew-Ts, but has no interactivity, a limitation we overcame by making ISP a D2D application.
One of our goals was to treat ISP as off-the-shelf software and modify its source code as little as possible. We partially achieved this by developing a wrapper---a small program that acts as an adaptor between the D2D application interface and ISP. The wrapper is a Tcl/Tk script that first sends the @@-Export command to export any skew-T data, and then waits for the exported notification. When it receives the notification, it displays a dialog box to ask the user to select one of the exported files (if there was more than one). Finally, it executes ISP with the selected file as an argument. ISP brings up its own windows separate from D2D to display the skew-T diagram, hodograph, and various parameters. Worthy of emulation, this wrapper technique enabled us to make a stand-alone program act as a D2D application. Other stand-alone or off-the-shelf programs can become D2D applications using the same technique.
The D2D extension framework, described in this volume (Kelly, 1997), gives local developers another way to add office-specific functionality to D2D. It differs from the D2D application interface in a number of ways, summarized in the Table (below).
Although the goal of both the application interface and the extension framework is to provide forecasters with locally-customized functionality, the two methods achieve the goal in different ways. As can be seen from the Table, the extension framework forces extensions to be tightly coupled to D2D: they must be written in a certain language and may run only with D2D. They can, however, be interactive on the D2D main display---that is, extensions can take action when forecasters edit objects on D2D's main display area.
TABLE: Application Interface and Extension Framework Feature Comparison
| Feature | Application Interface | Extension Framework |
|---|
| Language | Any | C++ only |
| Stand-alone operation | Yes | No
|
| How used | Text commands passed on standard input/output | Inheritance from base class, overriding virtual methods |
| Graphics | Static; load a netCDF file into D2D | Dynamic; create and change points, lines, polygons, etc. |
| Interactive graphics on D2D | No | Yes |
| Images | Yes | No |
| User interface | Any | Only through extension library |
Applications, on the other hand, may create only static graphics for the D2D display, but unlike extensions, they may also create images. Forecasters cannot interact with the data directly on the D2D display area. However, applications can bring up any number of their own separate, floating windows, containing any kind of user interface elements, thereby enabling complex interaction. Also, applications can run "stand-alone," which simplifies application development simpler because a complete and running D2D installation is not required.
FSL's success in developing programs that run under the application interface should answer local forecast offices' needs for specialized functionality. Since the D2D application interface uses a simple text command model, application development is straightforward. Wrapper scripts should prove especially useful in grafting off-the-shelf programs onto the interface. We expect the limited set of commands and notifications that the interface now supports to grow as we continue to identify more requirements.
Some improvements can be made in the interface. For example, the arguments to several of the commands and notifications are integers whose meanings have to be looked up in tables (provided with D2D). We plan to replace the integer arguments with keywords that clearly show their meanings.
Other interesting work involves the possibility of expanding the set of commands to include features for programmability---that is, make D2D support scripts. The Tcl language (Ousterhout, 1994) is perfectly suited to this task: it is an embeddable scripting language that offers flow control, conditional expressions, loops, and procedures. By implementing the D2D application interface with Tcl, we foresee a myriad of possibilities: macro recording and playback, automated weather briefings, direct conversion and presentation of local datasets, automatic response to severe weather, and much more.
Thanks to Joseph Wakefield for reviewing a draft of this paper, and to Nita Fullerton for invaluable editing services.
Aho, A.V., R. Sethi, and J.D. Ullman, 1988: Compilers: Principles, Techniques, and Tools, Addison-Wesley, 105-113.
Kelly, S., 1997: An Object-Oriented Framework for Local Extensions to the WFO-Advanced Forecaster Display Workstation, D2D. Preprints, Thirteenth International Conference on Interactive Information and Processing Systems for Meteorology, Oceanography and Hydrology, Long Beach, Amer. Meteor. Soc., 324-327.
Kernighan, B.W. and R. Pike, 1984: The Unix Programming Environment. Prentice-Hall, 26-35.
MacDonald, A.E., and J.S. Wakefield, 1996: WFO-Advanced: An AWIPS-like Prototype Forecaster Workstation. Preprints, Twelfth International Conference on Interactive Information and Processing Systems for Meteorology, Oceanography and Hydrology, Atlanta, Amer. Meteor. Soc., 190-193.
Ousterhout, J.K., 1994: Tcl and the Tk Toolkit. Addison-Wesley.
Rew, R.K., G.P. Davis, S. Emmerson, and H. Davies, 1996: NetCDF User's Guide, An Interface for Data Access, Version 2.4. Unidata Program Center, Boulder.
Stevens, W.R., 1990: Unix Network Programming. Prentice-Hall, 102-109.
Footnotes
- *
- Joint collaboration with the Cooperative Institute for Research in the Atmosphere, Colorado State University, Fort Collins, Colorado 80523.
Corresponding author address: Sean Kelly, NOAA/ERL/FSL/SDD R/E/FS4, 325 Broadway, Boulder, CO 80303 [no longer at FSL].
This document is maintained by Joe
Wakefield.
Last updated 3 Oct 97