ESM4714
Scientific Visual Data Analysis and Multimedia
Exercise #15: Gridding (curve fitting) 1D, 2D, and 3D data sets using PV-Wave.


Background:
We are often limited to working with sparse data from what could be a continuum of results if time and resources would permit, e.g. we can only afford a coarse finite element mesh or e.g. expensive experimental test specimens can limit us to a few test results. From our eperience we can sometimes safely assume that these results can be connected as a continuous function ("gradient"). The only question to be answered is how good can we fit the data to an exact function: "goodness of fit". This is often a subjective judgment that can be facilitated by a visual image of this gridding process. Using images to verify this "gridding" of data can also help us to avoid numerical artifacts that otherwise might be interpreted as a physical result.

NOTE: Most graphic software packages do not grid sparse or irregular data simply because interpolation of data can lead to serious distortions. It is usually assumed that if regular-uniform data are required by a particular software program then the user must create this uniform mesh of data. Although many software packages grid your data for you, such as PV-Wave, you should be careful not to always questions the results.

NOTE: Highlighted italic text denotes user response.


Objective:
Introduce the user to PV-Wave procedure files that can be used to create continuous data from sparse data sets.

Procedure #1:
Gridding errors in 2D data.

  1. Logon onto mercury -> pluto.smvc.vt.edu at the VT-CAVE classroom (SMVC).

  2. Mount your optical disk (see procedure for mounting scsi devices).
  3. Go to the ESM4714/examples.

  4. Locate the directory (abc) that contains PV-Wave procedure files and data sets for generating a continuous data set.

    viz?% cd /opdisk/ESM4714/examples/grid/new/abc (on VT-CAVE workstations)
    planet?% cd /optical/ESM4714/examples/grid/new/abc (on SMVC workstations)
    planet?% ls -lag
    planet?% wave
    wave>_

    NOTE: There are two directories in the "grid" directory: new and old. The old directory work best with the gridding algorithm used in PV-Wave prior to 1993, and the new directory uses gridding algorithms that work best with either sparse or dense grids. To get more in depth explanation use the PV-WAVE help by typing in help at the PV-WAVE command prompt: wave> help . In both the new and old directory there are two directories: abc and xyz. The abc directory creates a simple plot where all points fall within a plane and the xyz directory also contain the same points but forms an irregular surface that resulted from a slight perturbation out of the same plane in the abc example and forms an irregular surface with some nuerical artifacts. In both examples postscript files are generated for "tv" (black-white) image plot, "shaded- surface" plot, and the "contour" plot.

    Gridding using the newer (after 1993) algorithms

  5. Grid the data in directory ../grid/new/abc. Two images should appear: 1. shaded surface plot, and 2. a contour plot with a tv black&white image shown in the lower right corner where red is used as a background color so that you can view the tv image.

                     Files of Sparse data:
      filenames:  a.dat      b.dat     c.dat
                   0.0        0.0       0.0
                   5.0        0.0       0.0
                  10.0        0.0       0.0
                  15.0        0.0       0.0
                  20.0        0.0       0.0
                   0.0        5.0       5.0
                   5.0        5.0       5.0
                  10.0        5.0       5.0
                  15.0        5.0       5.0
                  20.0        5.0       5.0
                   0.0       10.0      10.0 
                   5.0       10.0      10.0 
                  10.0       10.0      10.0 
                  15.0       10.0      10.0 
                  20.0       10.0      10.0 
                   0.0       15.0      15.0 
                   5.0       15.0      15.0 
                  10.0       15.0      15.0 
                  15.0       15.0      15.0 
                  20.0       15.0      15.0 
                   0.0       20.0      20.0  
                   5.0       20.0      20.0  
                  10.0       20.0      20.0  
                  15.0       20.0      20.0  
                  20.0       20.0      20.0  
    

    wave> m_grid_abc

    NOTE: Both images confirm that all 25 points fall within the same plane.

  6. Grid the data in directory ../grid/new/xyz. Two images should appear: 1. shaded surface plot, and 2. a contour plot with a tv black&white image shown in the lower right corner where red is used as a background color so that you can view the tv image.

                     Files of Sparse data:
      filenames:  x.dat      y.dat     z.dat
                   0.0        0.0       0.0
                   5.0        0.0       0.0
                  10.0        0.0       0.0
                  15.0        0.0       0.0
                  20.0        0.0       0.0
                   0.0        5.0       5.0 
                   5.0        5.0       5.0 
                  10.0        5.0       5.0 
                  15.0        5.0       5.0 
                  20.0        5.0       5.0 
                   0.0       10.0      10.0  
                   5.0       10.0       0.0 <- creates dimple  
                  10.0       10.0       0.0 <- creates dimple 
                  15.0       10.0       0.0 <- creates dimple 
                  20.0       10.0      10.0  
                   0.0       15.0      15.0  
                   5.0       15.0      15.0  
                  10.0       15.0      15.0  
                  15.0       15.0      15.0  
                  20.0       15.0      15.0  
                   0.0       20.0      20.0   
                   5.0       20.0      20.0   
                  10.0       20.0      20.0   
                  15.0       20.0      20.0   
                  20.0       20.0      20.0   
    

    wave> m_grid_abc

    NOTE: Both images confirm that all but 3 points fall within the same plane hence creating dimple in the center of the plane.

    Gridding using the older (prior to 1993) algorithms

  7. Grid the data in directory ../grid/old/abc. Three images should appear of the gridded results: 1. contour plot, 2. "tv" grayscale plot, 3. raised shaded surface plot. A schematic of the original sparse data is shown below along with the three images of the gridded results.

                     Files of Sparse data:
      filenames:  a.dat      b.dat     c.dat
                  50.0       10.0      10.0
                  30.0       20.0      20.0
                  70.0       30.0      30.0
                  20.0       40.0      40.0
                  30.0       50.0      50.0
                 100.0       60.0      60.0
                  10.0       70.0      70.0
                  60.0       80.0      80.0
                  70.0       90.0      90.0
                  90.0      100.0     100.0 
    

    wave> m_grid_xyz

    NOTE: All three images confirm that the original 10 points all fall within the same plane.

  8. Compare the results above with the gridded data in directory xyz. Three images should appear of the gridded results: 1. contour plot, 2. "tv" grayscale plot, 3. raised shaded surface plot.

    The sparse data is shown below along with the three images of the gridded results. Note that the x.dat = a.dat and the y.dat = b.dat, but z.dat is not equal to c.dat, here we changed only the vertical positon of the points.

                     Files of Sparse data:
      filenames:  x.dat      y.dat     z.dat  (old)
                   50.0       10.0      18.0    10.0
                   30.0       20.0      10.0    20.0
                   70.0       30.0      38.0    30.0
                   20.0       40.0      30.0    40.0
                   30.0       50.0      55.0    50.0
                  100.0       60.0      50.0    60.0
                   10.0       70.0      78.0    70.0
                   60.0       80.0      70.0    80.0
                   70.0       90.0      95.0    90.0
                   90.0      100.0      90.0   100.0
    

    wave> m_grid_xyz

    NOTE: All three images confirm that the original 10 points all fall outside of the original plane and the gridding has resulted in an artifical numerical artifact "a cave" which can be best observed in the upper portion of the contour plot.


Procedure #2:
Grid simple 1D, 2D, and 3D data sets.

  1. Find your arl directory again and move into the examples directory where you will find three demo procedure files: grid_demo1.pro, grid_demo2.pro, and grid_demo3.pro. Start up wave and execute each of the three procedure files. The results of these three images are shown below.

viz?% cd /opdisk/arl/examples
wave> grid_demo1
wave> grid_demo2
wave> grid_demo3

NOTE: the original data points are listed in each procedure file. Also notice that when you are looking at these procedure files notice the simplicity of the commandline language.

grid_demo1 (Grids 1D data)

:w

grid_demo2 (Grids 2D data)

grid_demo3 (Grids 3D data)


Click image to return to Visualization home page.
R.D. Kriz
Virginia Tech
College of Engineering
Revised 01/10/99
http://www.sv.vt.edu/classes/ESM4714/exercises/exer15/exer15.html