25 March 2008, eaton

Running gnumake in this directory will create an executable named
"interpic".  Its function is to take an input CAM history or initial file
and interpolate all time samples to a new horizontal and/or vertical
resolution.

The output resolution is determined by the coordinates in a template netcdf
file ("-t template_file").  Previously made coordinate files are located in 
inputdata/atm/cam/coords.  If a coordinate for a field in the input file
exists in the template file (the coordinate must have the same name in both
files), then the field that appears in the output file will be interpolated
from the input file coordinate to the template file coordinate.  By default
all fields contained in the input file are interpolated and written to the
output file.

Certain variable names are hardwired into the interpic code and are
automatically recognized as variables that contain coordinate information.
The variable names are: rlon, nlon, wnummax, hyai, hybi, hyam, hybm, gw,
w_stag, lat, lon, slat, slon, lev, ilev.

The code assumes that the netCDF conventions for coordinate variables have
been followed, i.e., the dimension of a 1D coordinate variable has the same
name as the associated variable.  This means that the following dimension
names which are hardwired into the code are also treated specially: lon,
slon, lat, slat, lev, ilev, time.  In addition, the extension of the code
to treat unstructured grids added the dimension name "ncol" to identify the
dimension of the global column indices.


This code will eventually replace the original version of interpic.  It is,
however, still missing some functionality:

. If interpolating to a staggered grid, the input dataset must be on a
  staggered grid.  The original code had hardwired logic to allow
  interpolating from a Gauss grid to a staggered grid.  The current code
  assumes the dimension names of the output grid are the same as the input
  grid.  It's missing the special logic to allow the lat dimension of V to
  become the slat dimension of VS (and similar for U --> US).

It has been generalized as follows:

. Can produce non-rectangular grids for output, e.g. cubed sphere grid.

. No longer requires separate steps to produce a template file containing
  the desired fields declared on the desire output grid.  The user just
  supplies a template file containing the desired output grid.

. The output precision may optionally be reduced to real*4 when the input
  data is real*8 (see commandline option -p).  The precision override does
  not apply to the coordinate variables which are always output as real*8.

. Fields from the input file may optionally be excluded from the output
  file (see commandline option -e).

. Fields from the template file may optionally be included on the output
  file (see commandline option -i).


There are round-off level differences with the original interpic code due
to changes in the interpolation routine.


SE Note: 

If a CAM-SE file doesn't already exist for the desired output grid, a
template file can be constructed as follows:

Start with an output file from a SE test case at the resolution that you
want.

Create the template file by extracting the lat,lon and ncol variables from
the test case file:

% ncks -v lat,lon baroclinic1.nc SE_temp.nc

Convert the lat and lon variables from radians to degrees

% ncap -O  -s "lat=lat*90./asin(1.0);lon=lon*90./asin(1.0)" SE_temp.nc SE_template.nc

Add the vertical coordinates (from another cam input file)

% ncks -vhyai,hyam,hybi,hybm cami_0000-09-01_64x128_L30_c031210.nc  SE_template.nc


Then run interpic:

% interpic -t SE_template.nc inputfile.nc outputfile.nc

Finally if you started with an FV based initial file you will need to rename US and VS to
U and V.    
