Dsgrid Examples


Overview

This module contains source codes for all of the examples referenced by the other modules in the documentation. If you are using NCAR Graphics, all of the examples are available using the example tool ncargex. Links to all of the example plots are provided. Most of the examples use Dsgrid to interpolate in two dimensions, since it is much easier to illustrate the principles with such examples. The primary use of Dsgrid, however, is intended to be for 3D interpolation, since in most cases the Natgrid package is superior for 2D interpolations.

The following list summarizes the examples:

The plotting subroutines used by the Fortran examples are TDEZ2D and TDEZ3D from the Tdapck package of NCAR Graphics. TDEZ2D is a simplified procedure for drawing a surface and TDEZ3D is a simplified procedure for drawing an isosurface. The C examples use the C functions, c_tdez2d.c and c_tdez3d.c from Tdpack - these are equivalent to the Fortran procedures. If you are not using NCAR Graphics and want to draw the plots, you will have to substitute appropriate calls from the graphics package you are using.

Creating your own executable

If you have access to NCAR Graphics, you can create executables for all of the examples in one of two ways. The easiest is to use the ncargex utility, which is documented with a man page. The other way is to use either ncargf77 (for Fortran) or ncargcc (for C) to compile and execute the source codes.

If you are using NCAR Graphics and the C interface to Dsgrid and you are compiling using ncargcc, then function prototypes for all Dsgrid C functions are contained in a C header file. This can be accessed by inserting the line:

#include <ncarg/ngmath.h>
into your code.

If you do not have access to NCAR Graphics, replace the calls for drawing the plots with calls to the appropriate procedures at your site.

Example 1 -- a simple 3D interpolation

Example 2 -- varying the distance exponent

Example 3 -- smoothness

Example 4 -- using the shadowing feature

Example 5 -- extrapolation

Example 6 -- single point mode


home | contents | defs | params | procedures | exmpls | index