# vr2uvf, vr2uvg

Given relative vorticity, compute the non-divergent (rotational) wind components via Spherepack.

## Synopsis

```    procedure vr2uvf(
vort : float,
ur   : float,
vr   : float
)

procedure vr2uvg(
vort : float,
ur   : float,
vr   : float
)
```

## Arguments

vort
relative vorticity array (input, array with two or more dimensions, last two dimensions must be nlat x nlon and input values must be in ascending latitude order)
ur, vr
non-divergent wind components (output, same dimensions as vort, values will be in ascending latitude order)

## Description

vr2uvf and vr2uvg both compute the non-divergent wind components given vorticity array vort and store the results in the arrays ur, vr. nt can be any number of dimensions. vr2uvf operates on an equal (fixed) grid, and vr2uvg operates on a Gaussian grid.

Note: For the arrays whose last two dimensions are nlat x nlon, the rest of the dimensions (if any) are collectively referred to as nt. If the input/output arrays are just two dimensions, then nt can either be considered equal to 1 or nothing at all.

Arrays which have dimensions nt x nlat x nlon should not include the cyclic (wraparound) points when invoking the procedures and functions which use spherical harmonics (Spherepack).

For example, if an array x has dimensions nlat = 64 and nlon = 129, where the "129" represents the cyclic points, then the user should pass the data to the procedure/function via:

```    z = sample ( x([...],:,0:nlon-2) )  ; does not include cyclic points
```

## Example

```begin
nlat  =  64                                       ; dimensions
mlon  = 128
mlon1 = mlon+1
fbfile = "uv300.hs"
; Generic Workstation setup
nrec  = fbinnumrec(fbfile)       ; total number of records in the file
ntim  = nrec/2                       ; number of time steps in dataset

uvmsg = 1e+36

work  = new ( (/nlat,mlon1/), float, uvmsg )
u     = new ( (/nlat,mlon /), float, uvmsg )  ; source u
v     = new ( (/nlat,mlon /), float, uvmsg )  ; source v
dvx   = new ( (/nlat,mlon /), float, uvmsg )  ; divergence (same as dv)
vrx   = new ( (/nlat,mlon /), float, uvmsg )  ; vorticity  (same as vr)
sf    = new ( (/nlat,mlon /), float, uvmsg )  ; stream function
vp    = new ( (/nlat,mlon /), float, uvmsg )  ; velocity potential
uy    = new ( (/nlat,mlon /), float, uvmsg )  ; latitudinal derivative (u)
vy    = new ( (/nlat,mlon /), float, uvmsg )  ; latitudinal derivative (v)
uu    = new ( (/nlat,mlon /), float, uvmsg )  ; reconstructed u
vv    = new ( (/nlat,mlon /), float, uvmsg )  ; reconstructed v
ux    = new ( (/nlat,mlon /), float, uvmsg )  ; reconstructed u
vx    = new ( (/nlat,mlon /), float, uvmsg )  ; reconstructed v

do i = 0,nrec-1,2
month = 1                         ; january
if (i .ge. 2) then
month = 7                     ; july
end if

u    = work(:,0:mlon-1)
v    = work(:,0:mlon-1)

dv = uv2dvG   (u,v)               ; u,v ==> divergence
vr = uv2vrG   (u,v)               ; u,v ==> vorticity (rel)
uv2vrdvg (u,v, vrx,dvx)           ; u,v ==> div and vort
uv2sfvpg (u,v, sf,vp)             ; u,v ==> stream function + velocity pot
ud    = new ( (/nlat,mlon /), float, uvmsg )
vd    = new ( (/nlat,mlon /), float, uvmsg )
ur    = new ( (/nlat,mlon /), float, uvmsg )

dv2uvg   (dv,  ud,vd)             ; dv  ==> divergent  wind components
vr2uvg   (vr,  ur,vr)             ; vr  ==> rotational wind components
vrdv2uvg (vr,dv,   uu,vv)         ; vr,dv > reconstruct original wind
vrdv2uvg (vrx,dvx, ux,vx)         ; vr,dv > reconstruct original wind
end do
end
```

## Error messages

If jer or ker is equal to:
1 : error in the specification of nlat
2 : error in the specification of nlon
4 : error in the specification of nt (jer only)

### Reference Manual Control Panel

\$Revision: 1.13 \$ \$Date: 1999/02/23 15:59:28 \$