NCL > Application examples > Basic examples

Ngmath example 4

Simple 3D interpolation

This example can be created using HLU C and FORTRAN library calls or NCL. It demonstrates how to use the Dsgrid package to do a simple 3D interpolation using a simple inverse distance weighted interpolation algorithm (Dsgrid is part of the Ngmath library). Tdpack is used to draw the 3D graphic. The names of the source files for this example are nm04c.c, nm04f.f, and nm04n.ncl.

Discussion

This module discusses how to use the Dsgrid package using calls to the Ngmath library and the HLU library.

Creating the plot using HLUs

The HLU C program that generates this plot is called nm04c.c.

Creating the plot using HLU FORTRAN library calls

The HLU FORTRAN program that generates this plot is called nm04f.f.

Creating the plot using NCL

The NCL script that generates this plot is called nm04n.ncl.

The data

This plot does not use any external data.

How to run this example

This example can be generated using a C program (nm04c.c), a FORTRAN program (nm04f.f), or an NCL script (nm04n.ncl). The examples are installed in the following locations:

  • $NCARG_ROOT/lib/ncarg/hluex/ngmath/nm04c.c
  • $NCARG_ROOT/lib/ncarg/hluex/ngmath/nm04f.f
  • $NCARG_ROOT/lib/ncarg/nclex/ngmath/nm04n.ncl
You can copy this example and run it by typing "ng4ex nm04c", "ng4ex nm04f", or "ng4ex nm04n". A copy of the source file and resource file will be placed in your current working directory. The source code will be compiled and automatically run for you.

working directory and run through NCL for you.