## 3.2 Creating a Visual Program: Two short examples

If necessary, review 3.1 , "Editing a Visual Program: The Basics".

### A simple two-dimensional field

In this first example, we will import a two-dimensional field on a regular grid. The data describe the topography (elevation) of the southeastern United States. First start Data Explorer by typing

    dx -edit

or choose `New Visual Program` from the Data Explorer Startup window.

From the Import and Export Category in the top left palette, choose the Import module. Place it on the large blank canvas area.

From the Realization Category choose the RubberSheet module. Place it below the Import module. From the Rendering Category choose the Image module. Place it below the RubberSheet module.

Now connect the output of Import to the first input of RubberSheet, and connect the output of Rubbersheet to the input of Image. Notice that the first tab of Import is colored differently than any other tabs visible. This is because this parameter is required. This is the file name of the data file to import.

Open the configuration dialog box for Import. Specify the first parameter (name) as `/usr/share/dx/samples/data/southeastern_topo.dx`.

Execute the visual program by selecting `Execute Once` from the `Execute` menu. You should see an image showing the topography as a deformed surface.

To add colors, insert an AutoColor module (Transformation Category) between RubberSheet and Image (or between Import and RubberSheet).

### A simple three-dimensional field

In this second example, we will import a three-dimensional field on a regular grid. The data describe the cloud water density in a simulation of a storm.

As before, place an Import tool from the Import and Export Category on the canvas. Place an Isosurface tool from the Realization Category below Import. Place an Image tool from the Rendering Category below Isosurface. Connect the output of Import to the first input of Isosurface, and connect the output of Isosurface to the input of Image.

Open the configuration dialog box for Import, and type in the `name` parameter as `/usr/share/dx/samples/data/cloudwater`.

Execute. You will see an isosurface (constant value surface) of the cloudwater density. Not that if you are using the same Image tool as in the previous example, you may need to "reset the camera" for the new data set. Choose `Reset` from the `Options` menu of the Image window.

Open the configuration dialog box for Isosurface. Notice that the default for the isovalue (the second input) is the data mean. Change it to the value 0.1 by typing over the `Value` field. Execute.

For more complex visualizations, continue with the examples in 3.6 , "Visualizing 2-Dimensional Data", 3.7 , "Visualizing 3-Dimensional Data", and 3.8 , "Tasks and Tools". A short tutorial on importing data may be found in 3.3 , "Importing Data" and 3.5 , "Importing Your Own Data".

[ OpenDX Home at IBM | OpenDX.org ]