Many computational science projects involve large two dimensional arrays of floating point numbers. For arrays of small dimension, it is possible to examine the values in the arrays by simply inspecting an ascii file. However, for arrays of even modest size, other techniques are required. In this quickstart tutorial, we illustrate how one can create and interrogate a data set consisting of floating point numbers on a regular two dimensional grid. Although several software packages are available for this task, we have selected NCSA X Image because it is in the public domain and is well documented in the NCSA literature. The application NCSA X Image can be obtained via anonymous ftp from

ftp.ncsa.uiuc.edu
The application X Image requires data sets in the Hierarchical Data Format (HDF files), so before beginning any visualization work involving X Image, check with your system administrator to be sure that the HDF library has been installed on your system. In addition to providing a quick start in the use of X Image, a second aim of this document is to illustrate some basic calls to the HDF library.

To begin to become acquainted with X Image and the HDF library, consider the example FORTRAN code listed below as Code 1. This code creates a two dimensional (rank 2) scientific data set (SDS). Having created a sample data set we will then describe how to use the X Image application to display and interrogate that data set.

Code 1:
program ex2_1 parameter(M=200,N=200) dimension u(M,N) c the integer array shape specifies a two dimensional array c DFSDsetdims is an HDF library routine for setting the c dimensions of the scientific data set to be written c DFSDputdata is an HDF library routine for writing an array as a c scientific data set integer shape(2), DFSDsetdims, DFSDputdata character fn*10 shape(1) = M shape(2) = N fn = 'ex2_1.sds' xj = 0.0 do 1 j = 1,N xj = xj + 1.0 xi = 0.0 do 1 i = 1,M xi = xi + 1.0 u(i,j) = .01*(xi*xi - xj*xj) 1 continue iret = DFSDsetdims( 2, shape ) if(iret.ne.0) write(6,*) 'return code dims was ', iret iret = DFSDputdata( fn, 2, shape, u ) if(iret.ne.0) write(6,*) 'return code put was ', iret end
Assuming the HDF library has been installed and your path is properly set, then to run program ex2_1 enter

f77 ex2_1.f -ldf

a.out
After successful execution a file named ex2_1.sds will be written to your current directory.

Having completed the construction of the scientific data set ex2_1.sds, the X Image application can be used to view and interrogate the data set. If X Image is installed and in your path, it can be invoked from an X-Window environment by entering

ximage
at the prompt. Figure 1 shows the choices available when X Image is initiated. Left clicking on Dataset will lead to a loading of a data set; Palette will open a palette manipulation tool; while Animate will ask for a list of files to display in succession.

To continue the example, click the left mouse button on the Dataset button to activate the panel displayed in Figure 2. Select ex2_1.sds as the Current Filename and open it. This selection can be made either by typing the file name or by scrolling to and clicking on the file. In either case, then left click on the button labeled Open.

Having opened the scientific data set ex2_1.sds, you will be able to choose one of the viewing options displayed in Figure 3 . The choice Display Cartesian provides a color xy-raster map representation of the scientific data set; Display Polar provides an r-theta raster map; Display Data Set gives a spread sheet of the floating point numbers in the data set; and Graph give access to both contour maps and xy plots along cross-sections. Experiment with each of these features.

To continue with a concrete example, left click on Display Cartesian. At this point you should see a raster map similar to Figure 4.

When using X Image, it is typical that the initial display of the data set is unsatisfactory for purposes of scientific visualization. This initial display usually uses the default system color palette. So, depending on how your particular workstation has been set up, your initial display may differ from Figure 4.