cdfcenter −− create cell-centered variables from cell-edge variables
cdfcenter edgeindex centerindex suffix var1 ...
Cdfcenter is used in conjunction with numerical models which output staggered grids to create cell-centered fields from cell-edge fields. One dimension at a time is centered -- make successive calls to center in more than one dimension. However, any number of cell-edge variables are converted to cell-centered variables in one call. "Edgeindex" is the index field in a particular direction for the cell-edge variables, while "centerindex" is the index field in that direction for the cell-centered variables. The size of "centerindex" must be one less than the size of "edgeindex". The cell center value is obtained by averaging the surrounding cell edge values. The variables to be centered are given on the command line after the first three parameters. "Suffix" is the string added to each variable name to make the name distinct from that of the edge variable.
kestrel% cdfcenter xe xc c u < in_file > out_file
In this example the cell-edge variable "u" is used to create a new centered variable "uc". The index field "xe" gives cell edge positions while "xc" gives cell center positions.
kestrel% cdfcenter xe xc c u v < in_file | cdfcenter ye yc c uc vc > out_file
In this example variables "u" and "v" on the corners of a two-dimensional (or higher) grid are used to create centered variables in the x-y plane "ucc" and "vcc". Intermediate variables "uc" and "vc" are also created.