Computes vector spherical harmonic analysis of vector fields on a gaussian grid via spherical harmonics.
procedure vhagc ( u : numeric, v : numeric, br : float or double, bi : float or double, cr : float or double, ci : float or double )
vector function to be analyzed (input, array with two or more dimensions). The two rightmost dimensions must be nlat x nlon.
- input values must be in ascending latitude order
- input arrays must be on a global grid
vector spherical harmonic coefficients. The user must allocate arrays of the appropriate size prior to use. If the last two dimensions are nlat x nlon, then the second-to-the-last dimension is nlat. The last dimension (N) is a function of the comparative size of nlat and nlon. It may be determined as follows:
N = minimum[nlat, (nlon )/2] if nlon is evenNote: The coefficients contained in br, bi, cr, and ci are in mathematical coordinates. The br,bi coefficients are associated with v (north-south, meridional component), and cr,ci are associated with u (east-west, zonal component). Please read the documentation:
N = minimum[nlat, (nlon+1)/2] if nlon is odd
vhagc performs the vector spherical harmonic analysis on the arrays u and v, and stores the results in the arrays br, bi, cr, and ci. In general, vhagc (performs vector spherical harmonic analysis) is used in conjunction with vhsgc (performs vector spherical harmonic synthesis). Note that both vhagc and vhsgc operate on a gaussian grid.
NOTE: This procedure does not allow for missing data (defined by the _FillValue attribute) to be present. The input arrays should not include the cyclic (wraparound) points, as this procedure uses spherical harmonics. (NCL procedures/functions that use spherical harmonics should never be passed input arrays that include cyclic points.)
In the examples below, u and v are on a gaussian grid.
N = nlat if (nlon%2 .eq.0) then ; note % is NCL's modulus operator if (nlat.gt. (nlon+2)/2) then N = (nlon+2)/2 end if else ; nlon must be odd if (nlat.gt. (nlon+1)/2) then N = (nlon+1)/2 end if end if br = new ( (/nlat,N/), float) bi = new ( (/nlat,N/), float) cr = new ( (/nlat,N/), float) ci = new ( (/nlat,N/), float) vhagc (u,v,br,bi,cr,ci) [do something with the coefficients] vhsgc (br,bi,cr,ci,u,v)Example 2
[same if test as in Example 1] br = new ( (/nt,nlat,N/), float) bi = new ( (/nt,nlat,N/), float) cr = new ( (/nt,nlat,N/), float) ci = new ( (/nt,nlat,N/), float) vhagc (u,v,br,bi,cr,ci) [do something with the coefficients] vhsgc (br,bi,cr,ci,u,v)Example 3