Interpolating To and From Spherical Geodesic Grids
Surface Elevation Represented on the 10242 Spherical Geodesic Grid
Data can be interpolated to and from spherical geodesic grids in an accurate and conservative manner. The process of interpolating data can be completed in 4 steps. We have provided sample files at each step, so you can actually skips steps 1 through 3 if you wish and go straight to the interpolation step. If you wish to use this methodology for your own purposes, eventually you will have to go through each step. Step 1 is downloading some software and, therefore, only needs to be completed once. Step 2 is grid generation and must only be done once for each grid involved in the interpolation. Step 3 is only done once for each pair of grids in which data is being mapped between. The actual interpolation which is done in Step 4.
Step 1: Obtain SCRIP (Spherical Coordinate Remapping and Interpolation Package)
This step is not necessary in order to get started. SCRIP finds the remapping weights linking two grids and we have provided sample remapping data files to get you started. This package was developed at LANL by J.W. Jones and allows data to be remapped between two arbitrary grids. This package has been tested on a variety of platforms. In addition, it is currently implemented into the CSU Flux Coupler and the NCAR Flux Coupler to allow the grids of the different climate sub-systems to communitate. The package allows data to be interpolated between grids using bilinear, nearest-neighbor, 1st-order conservative, or a 2nd-order conservative manner. Here as CSU, we most often use the 1st-order conservative scheme.
Step 2: Generate Grids in NetCDF format
The input to SCRIP is grid data in netCDF format. You must have netCDF 3.0 (or later) libraries installed on your system.
Some sample spherical geodesic grids
and sample latitude-longitude grids
are provided to get you started.
There is even a sample POP grid available. Note that all
data files are gzipped, after downloading use the gunzip command to expand them.
An ncdump -h on the spherical geodesic grid file (C02562.global.nc) yields the following:
grid_size = 2562 ;
grid_corners = 6 ;
grid_rank = 1 ;
int grid_dims(grid_rank) ;
double grid_center_lat(grid_size) ;
grid_center_lat:units = "radians" ;
double grid_center_lon(grid_size) ;
grid_center_lon:units = "radians" ;
int grid_imask(grid_size) ;
grid_imask:units = "unitless" ;
double grid_corner_lat(grid_size, grid_corners) ;
grid_corner_lat:units = "radians" ;
double grid_corner_lon(grid_size, grid_corners) ;
grid_corner_lon:units = "radians" ;
:title = "Geodesic C02562, axially-symmetric wrt rotation about N and S Pole " ;}.
In the "variables" section it is evident that each grid cell has a defined center (grid_center_lat and grid_center_lon) and defined corners (grid_corner_lat, grid_corner_lon). The variable, grid_imask, allows grid cells to be excluded from the remapping process. By defining corners of the grid cells, elements are formed. SCRIP determines the remapping between any two grids by finding grid cells which overlap.
Step 3: SCRIP essentially finds the number of links between two grids and assigns a weight to those links based on the amount of overlap between the two cells.
These weights are written into a netCFD data file.
After the weights have been generated, interpolation can be completed by a simple vector multiply.
The weights linking the spherical geodesic grids to sample latitude-longitude grids are provided.
Step 4: Once the grid data is put into netCDF format and the remapping weights linking two grids
have been computed, data can be interpolated to or from the spherical geodesic grids. We have
provided a set of subroutines to do this. Download the Tarball, gunzip it and tar -xvf it. It
will create a subdirectory ./interpol. Read all of the comments in driver.f90. The code is
currently set up to interpolate orography from the 2562 grid to the 4x5 lat-lon grid. All the
data files you need to complete this sample interpolation are included in the Tarball. You may
need to set the appropriate paths in the makefile for your machine. After make, an exec named
intepolate is created. Upon completion of the execution, two netcdf files are created. test4.nc
and test8.nc contain the 2562 orgraphy interpolated onto the 4x5 grid using both the real*4 and
Gzip-compressed tar file containing all of the above modules, plus
required input data files and 2 validation files.
A testimonial from a satisfied customer!
"I was able, after getting a very small amount of help from Dr Ringler, to pull
the information and code for running grid conversions off the BUGS website and
make it work. This involved going to the link called Interpolating To and
From Geodesic Grids.
The only help I needed from Dr Ringler was obtaining the location of the grid
re-mapping file(s) for the various grids. He had included these in the tarfile
he gave us, so once he told me the names I was on my way. I found the web links
easy to follow and well written. A real piece of cake!"
Signed, a satisfied customer.