WXP
User's Guide
maps <<
output
>> colors

Graphical Output

Many of the WXP programs produce graphical output.  The bulk of the graphics is vector oriented but some imagery is used.  Vector graphics can be easily created for a variety of output types. Imagery is more complicated and may not be available for some output types.

Graphics output devices are grouped into several categories:

Display (D) -- display window created by program
For windows systems, the output is a window of size 640x512 that will display somewhere on the display surface based on the window manager.  The graphics will then be plotted to an underlying pixmap that will be displayed once the plot is complete. While this is happening, the cursor will appear as a watch or hourglass. . This cursor will always note processing of some nature.  Once the plotting is completed, the cursor will become a plus.  At this time, the plot becomes interactive with zoom, resize, and query capabilities.  Window resizing will redraw the plot to the new window size. The plot will remain in the window until the <Enter> key is hit. Once the Enter key is hit, the window will close and control returned to the text portion of the program.
Window (W) -- window, previously created by another program such as wxploop.
The graphics will be drawn directly to this window without any intervention by the program that created it.  Specific ID numbers are needed such as window and pixmap ID, window size, and colormap ID need to be passed to the program when in this mode.  These can be obtained directly from the window creation program.  When the graphics program is finished, it exits but the creation program remains running with the graphic remaining in the window.  This mode can now be used to overlay plots. Secondly, the creation program can create multiple frames, which enables looping.
Postscript (P) -- postscript output for printers
The output device generates postscript output suitable for printing. Essentially, this mode generates a simple postscript file that either can be written to a file or spooled to a print queue. Output can be either to grayscale printers or to a color postscript device.
Output Text/Symbols Color Fills
grayscale all black converts colors to gray shade base on intensity (white -> white, black -> black) unless psrev is specified.
color actual color except black and white which are inverted actual colors

Also, this device can be set up so that output can be appended and printed later with the pscat program.  This allows for overlay plots much like the window mode.

HPGL (H)  -- plotter output (HPGL)
This output device creates HPGL codes that can be routed to plotters that support HPGL and recent HP Laserprinters that support PCL version 5. The output can be written to a file or spooled directly to a print queue. There is no color support. Also, this device can be set up so that output can be appended and printed later with the hpglcat program.  This allows for overlay plots much like the window mode.
 
Metafile (M) -- metafile output (WXP Metafile)
The output is an ASCII metafile format that is loosely based on the GKS metafile standard for graphics primitives. In the future, this output my support CGM or GKSM or WMF.

Device Resource

The output type is specified either at the device prompt or through setting the device resource. If the device is not specified through the resource, the program prompts for it. For general purposes, the output device can be specified using a single character. For example, the display is "d".  Additional information may be required for specific output types. For example, the window device needs the window ID.  The syntax for each device type is listed below:

Display syntax:

   d[,Xserver:display]

For the display output, the only additional parameter is the server name that is not often needed. If not specified, the value of the DISPLAY environment variable is used.

Window syntax:

   w,[Xserver:display],+window_id:pixmap_id[:widthxheight][:colormap_id]

As with the display device, the server ID may be specified, otherwise the value of the DISPLAY environment variable is used. The window and pixmap IDs follow. The pixmap ID is the location the graphics are going to draw. The window ID is passed to the program so that it can gain control of the window for redraws. The window size must be listed if it is different from default size of 640x512. An additional parameter for the colormap (not used in windows) can be specified if the window creation program is using a local colormap. The parameters are specified with a colon ":" in between each parameter. There is a second method for specifying window parameters:

   w,[Xserver:display],filename

This reads the window information "+window_id:pixmap_id[:widthxheight][:colormap_id]" from the specified file.  This can simplify use of wxploop since there needs to be a way to communicate the window information to other programs.   This is essential for Windows programs since the Win32 prevents output to standard output.  The filename is created with the "wxploop -ba -wn=filename" command.

Postscript syntax:

   p[,file][,parameters...]

The output file is wxp.ps unless otherwise specified. The output file can be one of the following:

File Description
file A specific output file
+file Appends to a file. Header and trailing showpage are omitted. This allows for multiple programs to overlay graphics. Once the full file has been generated, the pscat program can be used to put the header and trailer on the file and spool to the printer.
|program Pipes the output to a specific program. This is often used to spool the output to a print queue by using "|lp".

The parameters are (multiple parameters are separated by commas):

Parameter Description
port Portrait output
land Landscape output (default)
eps Encapsulated postscript
noeps Standard postscript output
color Setup for color output (colors automatically inverted)
gray Setup for grayscale output (default)
scale=factor Scale the output
lwidth=factor Base line width (def=1.0)
sz=widthxheight Set paper size in inches.
letter Letter paper size (8.5x11")
legal Legal paper size (8.5x14")
11x17 11x17" paper size
a4 A4 paper size (8.3x11.7")
a3 A3 paper size (11.7x16.5")
ansid ANSI D paper (22x34")

The output file and parameters can be set with the use of the wxpps_print environment variable. PSPRINT can be used for backward compatibility.

   setenv wxpps_print postscript_file
   setenv wxpps_print '|program'
   setenv wxpps_print +filename

The above parameters can be specified with the wxpps_param environment variable:

   setenv wxpps_param letter,color

HPGL syntax:

   h[,file][,parameters...]

The output file is wxp.hpgl unless otherwise specified. The output file can be one of the following:

File Description
file A specific output file
+file Output to a file in append mode. Header and trailer are omitted. This allows for multiple programs to overlay graphics. Once the full file has been generated, the hpglcat program can be used to put the header and trailer on the file and spool to the printer.
|program Pipes the output to a specific program. This is often used to spool the output to a print queue by using "|lp".

The parameters are (multiple parameters are separated by commas):

Parameter Description
port Portrait output
land Landscape output (default)
pcl Includes PCL command to switch to HPGL (default)
lj Laserjet setup (rotates paper)
rot=angle Rotation angle
scale=factor Scale the output
lwidth=factor Base line width (def=0.2)
sz=widthxheight Set paper size in inches.
letter Letter paper size (8.5x11")
legal Legal paper size (8.5x14")
11x17 11x17" paper size
a4 A4 paper size (8.3x11.7")
a3 A3 paper size (11.7x16.5")
ansid ANSI D paper (22x34")

The output file and parameters can be set with the use of the wxphp_out environment variable.

   setenv wxphp_out HPGL_file
   setenv wxphp_out '|program'
   setenv wxphp_out +filename

The above parameters can be specified with the wxphp_param environment variable:

   setenv wxphp_param ansid,lwidth=.5

Metafile syntax:

   m[,file]

The output file is wxp.meta unless otherwise specified. The output file can also be set with the wxpmeta_out environment variable.

Default Printer

By default, WXP directs all printed output to the Postscript filter for output to a Postscript printer.  If the default printer is a HP LaserJet, the default printed output needs to go to the HPGL filter.  This is done with the wxpprint environment variable:

   setenv wxpprint hpgl 

Any output to device "p" will now go to the HPGL filter as if it were directed to device "h".

Geometry Resource

The geometry of the output can be specified with the geometry resource.

Display

For the display device, a new window is opened on the screen surface. The geometry is used to size the window and specify its location on the screen. The size is specified as a width and height in pixels. The location is based on distance in pixels from the upper left corner of the display surface. In the X and Y values are negative, then the distance is measured from the lower right corner of the display.

   widthxheight[+x+y]

Window/Pixmap

For the window device, the window to be drawn to is already open. Its size and information are passed through the device resource. The geometry now specifies the location of the plot inside the window. By specifying a subset of the overall window size, multi-panel plots can be generated. There are three methods for specifying geometry:

  1. Absolute coordinates - widthxheight[+x+y]
    These coordinates represent the absolute location of the plot inside the window in pixel coordinates.
  2. Panel coordinates - pnxxny[+x+y]
    These coordinates represent the relative panel coordinates. The nx and ny represent the number of plots in each direction. The x and y are the offsets measured from the upper left. For example, to produce a 4 panel plot (2x2) and the current plot is the lower left, the geometry would be:
       -ge=p2x2+0+1
  3. Fractional panel coordinates - pdxxdy[+x+y]
    These coordinates represent the fractional panel coordinates. The dx and dy represent the fraction of the overall window ( 0 < dx < 1)   the panel will use. The x and y are the offsets measured from the lower left. For example, to produce a 4 panel plot (2x2) and the current plot is the upper left, the geometry would be:
       -ge=p.5x.5+0+.5

Postscript

For the postscript device, the geometry represents the size and location of the plot on the page. The units are in .01" (hundredths of an inch). The offset is from the lower left corner of the page (standard Postscript coordinates) For example, if the plot is 4.5"x3.5" in size and offset 1" in each direction, the geometry would be:

   -ge=450x350+100+100

The maximum size of an 8.5x11" page is 1050x800. The page is by default in landscape unless it is changed with the device resource. The default page size can be set in the device resource or with the wxpps_param environment variable.  Panel and Fractional coordinates can also be used.

HPGL

For HPGL plotting devices, the geometry is the same as for Postscript. The geometry represents the size and location of the plot on the page. The units are in .01" (hundredths of an inch). The offset is from the lower left corner of the page.  For example, if the plot is 4.5"x3.5" in size and offset 1" in each direction, the geometry would be:

   -ge=450x350+100+100

The maximum size of an 8.5x11" page may be 1050x800. Plotters have smaller page sizes. The page is by default in landscape unless it is changed with the device resource. The default page size can be set in the device resource or with the wxphp_param environment variable.  Panel and Fractional coordinates can also be used.

Interactive Commands

There is a set of commands that can be run once the plot is finished. These either uses the mouse or the keyboard. Keyboard use requires the Meta key. The <Meta> key is system dependent but is generally the Alt key (for IBM PC style keyboards):

System <Meta> key
IBM <Alt>
Sun <> or <Alt>
HP <Extend Char>
DEC <Compose>
PC-Windows 95/NT <Cntrl>

Here is a list of some of the interactive commands:

Key Sequence Description
Resize Window Redraws data to fit window (in display mode)
<Return> Closes the window
<Meta>q Closes the window
<Meta>d Deletes the current frame (loops only)
<Meta>z Zooms the image (pixel replication)
<Shift>left_button Drag mouse to select region for zoom (redraws data)
<Meta>u Unzooms
<Meta>r Refresh plot
<Meta>p Prints the plot
<Meta>m Outputs data to metafile
<Meta>g Dumps window to GIF file. If a loop, the entire loop is dumped.
<Meta>x Dumps window to XWD file (Unix) or to clipboard (Win95/NT). If a loop, the entire loop is dumped (Unix only).
<Meta>l Toggles loop on and off
<Meta>] Steps forward (static image) or speeds up loop
<Meta>[ Steps backward (static image) or slows down loop
<Meta>left_button Steps backward (static image) or slows down loop
<Meta>mid_button Toggles loop on and off (may not apply to Win95/NT unless you have a 3 button mouse)
<Meta>right_button Steps forward (static image) or speeds up loop
<Meta>v View data at cursor
<Meta>e Edits data point (interactive text prompt)
<Meta>right_button Drag mouse to edit data point (soundings only)
<Meta>c Recompute data (soundings only)
<Meta>s Save data to file

Querying Values

The data for a particular station can also be queried from the plot by moving to the station location and hitting <Meta>v. The output for a composite plot from sfcwx would look like:

Lat:  40.45 Lon:  -86.93 XY:   5.80 -54.56 Pixel: 460.00 325.00
Id: KLAF Lat:  40.42 Lon:  -86.93
Var:    all - temp=72 dewp=52 pres= wbrbc=90-15 cldcv=B wx=     

The first line of data contains the latitude and longitude of the cursor, the projection coordinates of the point and the pixel coordinates. The second line represents location information for a reasonably close station. The third line is the information from that station.

The output from a contour plot would look like:

Lat:  40.65 Lon:  -86.94 XY:   5.76 -54.32 Pixel: 459.00 319.00
Id: KLAF Lat:  40.42 Lon:  -86.93 Grid:  17.24, 10.38 =  70.36     

The second line in this case gives not only a close station but the grid value. The first two numbers are the relative grid coordinates, which gives a rough idea on how close the cursor is to a gridpoint. The last number is a value bilinearly interpolated from the surrounding gridpoints.

NOTE: Since Windows does not allow standard output on graphical applications, queried output will not be displayed. This output is only available if the program messages are redirected to a file through the message resource.

Interactive Zoom

For most WXP plots, there is the ability to interactively zoom the image. This completely redraws the image with the new plot domain resource. To zoom an image, move to the location of a corner of the region to zoom into.  Then while pressing the <Meta>left mouse button, move the cursor to the opposite end of the region. A rubber band box will appear on the screen denoting the selected region. Once the region has been selected, release the mouse button and the screen will clear and the plot will redraw. For plotted data, this may result in more stations being plotted. Stations are plotted based on priority and the priority is set based on domain size. The smaller the domain, the lower the priority is set and the more stations get plotted. For grids, this redraws the grid with the new plot domain. For satellite images, this zooms in on the image.

In order to restore the original image, press <Meta>u for unzoom.

Interactive Editing

In some cases, data can be modified by the user directly form the plot.

Editing Gridpoint Data

Once a grid has been contoured, its values can be modified.  To do this, hit the <Meta>e key and a prompt will appear:

Grid: 12, 10 Val =  66.98 New value:

The user can enter a new value. To see the change, the plot  must be refreshed with the <Meta>r key.  If the output needs to be saved, the <Meta>s key will save the modified grid to a grid file.

Sounding Modification

Once the diagram has been plotted, the sounding can be modified. This can be done by moving the cursor to the line which is to be modified, holding down the <Shift-right button> and moving the cursor to where the new value will be.  If the cursor is right of the temperature line, the temperature sounding is modified. If the cursor is left of the dewpoint line, the dewpoint is modified. This can only be done on the existing levels. This can also be done on the hodograph.

In many cases, the sounding has too much detail to effectively select a level or data point.  It is recommended that the user zoom the plot by using the <Shift-left button> and dragging a box around the area to be zoomed. Remember to start at a corner.

Once the sounding is modified, the plotted data/parameters/indices will update to reflect the changed sounding.  The parcel will not automatically update.  This can be done with the <Meta>r refresh command. The modified sounding can be saved to a raw file using the <Meta>s save command. This can be read in by uacalplt to be replotted.

Postscript Dumps

If the user has opened a window (device display) for plotting, the graphics commands that produce the plot are cached.  These commands can be rerun to refresh the plot on the screen.  They can also be rerun to produce Postscript output for a printer. With the mouse in the window, hit the <Meta>p keys and the output will be saved to the destination specified in the wxpps_print environment variable (see above).

Image Dumps

In addition to Postscript dumps, the output can be saved to an image file. There are two methods of producing image dumps:

  1. Interactive dumps from the window. The user can hit:

    <Meta>g
    to produce a GIF file
    <Meta>x for a XWD file (Unix) or copy to clipboard (Windows)

    The filename is based on the window title. For GIF files, it is based on the first 5 letters of the window title "title.gif". If this is done from within a loop, the filename will also have the loop index "title_in.gif".   For XWD files, extension is ".xwd" rather than ".gif".
  2. Forced dumps from the command line.  This can be accomplished by specifying the "gif:filename" from the plot_param resource or through the out_file resource. The filename is run through the file name convention file as a tag first. Two special keys exist: "%p" for program name and "%i" for frame index. If the filename does not match and existing name convention tag, it is taken as a filename with file name keys (such as %I for image path) expanded.

For further information about WXP, email devo@ks.unisys.com
Last updated by Dan Vietor on June 24, 1998

maps <<
output
>> colors