 NCL Home > Documentation > Functions > Spherical harmonic routines

# vhsec

Computes vector spherical harmonic syntheses of vector fields on a fixed grid via spherical harmonics.

## Prototype

```	procedure vhsec (
br  : numeric,
bi  : numeric,
cr  : numeric,
ci  : numeric,
u   : float or double,
v   : float or double
)
```

## Arguments

br
bi
cr
ci

arrays containing vector spherical harmonic coefficients (input, two or more dimensions). In general, these were created in the process of doing spherical harmonic analysis by invoking vhagc. These coefficients must be 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 at:

http://www.scd.ucar.edu/css/software/spherepack/vhsec.txt

u
v

arrays containing the reconstructed vector components.

## Description

vhsec performs the vector spherical harmonic synthesis using the coefficients generated by vhaec. Note that both vhaec and vhsec operate on a fixed grid.

NOTE: This procedure does not allow for missing data (defined by the _FillValue attribute) to be present.

If the original input arrays are on a gaussian grid, vhsgc should be used. Also, note that vhsec is the procedural version of vhseC.

## Examples

In the examples below, u and v are on a fixed grid.

Example 1

u(nlat,nlon), v(nlat,nlon)

```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)

vhaec (u,v,br,bi,cr,ci)
[do something with the coefficients]
vhsec (br,bi,cr,ci,u,v)
```
Example 2

u(nt,nlat,nlon), v(nt,nlat,nlon)

```[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)

vhaec (u,v,br,bi,cr,ci)
[do something with the coefficients]
vhsec (br,bi,cr,ci,u,v)
```
Example 3

g(nt,nlvl,nlat,nlon)

```[same if test as in Example 1]

br = new ( (/nt,nlvl,nlat,N/), float)
bi = new ( (/nt,nlvl,nlat,N/), float)
cr = new ( (/nt,nlvl,nlat,N/), float)
ci = new ( (/nt,nlvl,nlat,N/), float)

vhaec (u,v,br,bi,cr,ci)
[do something with the coefficients]
vhsec (br,bi,cr,ci,u,v)
```