Dynlib derivatives functions: Difference between revisions

From gfi
No edit summary
No edit summary
Line 1: Line 1:
== Dynlib derivatives ==
== Dynlib partial derivatives libary ==


The functions generally operate on real arrays with dimension (nz,ny,nx) where nz is number of times or levels, and ny and nx are the number of latitudes and longitudes, respectively. The function descriptions below contain detailed descriptions of arguments and returns where there is any deviation from this pattern; otherwise they may be assumed to be of the form:
The functions generally operate on real arrays with dimension (nz,ny,nx) where nz is number of times or levels, and ny and nx are the number of latitudes and longitudes, respectively. The function descriptions below contain detailed descriptions of arguments and returns where there is any deviation from this pattern; otherwise they may be assumed to be of the form:

Revision as of 18:39, 29 January 2013

Dynlib partial derivatives libary

The functions generally operate on real arrays with dimension (nz,ny,nx) where nz is number of times or levels, and ny and nx are the number of latitudes and longitudes, respectively. The function descriptions below contain detailed descriptions of arguments and returns where there is any deviation from this pattern; otherwise they may be assumed to be of the form:

Arguments:
Type Dim Description
dat real (nz,ny,nx) The input data
Returns:
Type Dim Description
res real (nz,ny,nx) output data

The ubiquitous inputs dx and dy are all of the form

Type Dim Description
dx real (ny,nx) dx(j,i) = x(j, i+1) - x(j, i-1) (in metres)
dy real (ny,nx) dy(j,i) = y(j+1, i) - y(j-1, i) (in metres)

Typically, the results for each level or time are computed individually in 2-D fashion, though they are returned as a 3-D array of the same size as the input.

dynlib.diag.ddx : partial x derivative

res=ddx(dat,dx,dy)

Calculates the partial x derivative of dat, using centred differences. For a non-EW-cyclic grid, 0 is returned on the edges of the x domain.

dynlib.diag.ddy : partial y derivative

res=ddy(dat,dx,dy)

Calculates the partial y derivative of dat, using centred differences. For a non-EW-cyclic grid, 0 is returned on all edges of the x,y domain. For an EW-cyclic grid, 0 is returned on the first and last latitudes.

dynlib.diag.grad : 2-D gradient

(resx,resy)=grad(dat,dx,dy)

Calculates the 2-D gradient of dat, using centred differences in x and y. For a non-EW-cyclic grid, 0 is returned on all edges of the x,y domain. For an EW-cyclic grid, 0 is returned on the first and last latitudes.

dynlib.diag.lap2 : 2-D laplacian

res=lap2(dat,dx,dy)

Calculates the 2-D laplacian of dat, using centred differences. For a non-EW-cyclic grid, 0 is returned on all edges of the x,y domain. For an EW-cyclic grid, 0 is returned on the first and last latitudes.