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").  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.


HOMME Note: 

If a CAM-HOMME 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 homme 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 homme_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)" homme_temp.nc homme_template.nc

Then run interpic:

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

 
