Dynlib utils functions: Difference between revisions
No edit summary |
No edit summary |
||
Line 120: | Line 120: | ||
This function is currently not available in dynlib. Use python | This function is currently not available in dynlib. Use python | ||
<code>res = zdata[zdata | <code>res = zdata[zdata > ztest+zthres]</code> instead. | ||
<code>res = high_enough(zdata,ztest,zthres,dx,dy)</code> | <code>res = high_enough(zdata,ztest,zthres,dx,dy)</code> |
Revision as of 18:25, 29 January 2013
Dynlib diagnostic functions
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:
Type | Dim | Description | |
---|---|---|---|
dat | real | (nz,ny,nx) | Input data |
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.mirror_y_domain : make data periodic in y for FFT
res = mirror_y_domain(dat,dx,dy)
Returns the data extended along complementary meridians (to facilitate FFT). For each lon, the reflected (lon+180) is attached below so that data is periodic in x and y. NOTE: Input data must be lats -90 to 90, and nx must be even.
Type | Dim | Description | |
---|---|---|---|
dat | real | (nz,ny,nx) | input data |
Type | Dim | Description | |
---|---|---|---|
res | real | (nz,2*ny-2,nx) | output data |
dynlib.diag.sum_kix : sum along k for flagged k-values
This function is currently not available in dynlib. Use python
dat[kix].sum()
instead.
(res,nres) = sum_kix(dat,kix,dx,dy)
Calculates sum along k dimension for k values which are flagged to 1 in kix vector (length nz).
Type | Dim | Description | |
---|---|---|---|
dat | real | (nz,ny,nx) | input data |
kix | int | (nz) | index flag for summation |
Type | Dim | Description | |
---|---|---|---|
res | real | (ny,nx) | (summed) output data |
nres | int | 0 | Number of data summed = sum(kix) |
dynlib.diag.sum_kix is typically used for calculating seasonal means. To do this, kix is set to 1 for times in the relevant season and 0 elsewhere. After (further) summing res and nres over all years, res/nres gives the mean for the season for all years.
dynlib.diag.high_enough : flags points which are sufficiently above ground
This function is currently not available in dynlib. Use python
res = zdata[zdata > ztest+zthres]
instead.
res = high_enough(zdata,ztest,zthres,dx,dy)
Type | Dim | Description | |
---|---|---|---|
zdata | real | (nz,ny,nx) | geopotential of gridpoints |
ztest | real | (1,ny,nx) | geopotential of topography |
zthres | real | 0 | threshold geopotential height difference |
Type | Dim | Description | ||||
---|---|---|---|---|---|---|
res | int*1 | (nz,ny,nx) |
|