uv2dvf, uv2dvg

Given u and v wind components, compute the divergence via Spherepack.


Synopsis

    procedure uv2dvf(
        u  : float,
        v  : float,
        dv : float
    )

    procedure uv2dvg(
        u  : float,
        v  : float,
        dv : float
    )

Arguments

u, v
wind components (input, arrays with two or more dimensions, last two dimensions must be nlat x nlon and input values must be in ascending latitude order)
dv
divergence (output, same dimensions as u and v, values will be in ascending latitude order)

Description

Given wind components u and v, uv2dvf and uv2dvg both compute the divergence and return it in the array dv. uv2dvf operates on an equal (fixed) grid, and uv2dvg 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
  dv    = new ( (/nlat,mlon /), float, uvmsg )  ; divergence
  vr    = new ( (/nlat,mlon /), float, uvmsg )  ; vorticity  (relative)
  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   

   work = fbinrecread(fbfile,i  ,(/nlat,mlon1/),"float")
   u    = work(:,0:mlon-1)
   work = fbinrecread(fbfile,i+1,(/nlat,mlon1/),"float")
   v    = work(:,0:mlon-1)

   uv2dvg   (u,v,dv)            ; u,v ==> divergence
   uv2vrg   (u,v,vr)            ; 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

NG4.1 Home, Index, Examples, Glossary, Feedback, Ref Contents, Ref WhereAmI?


$Revision: 1.12 $ $Date: 1999/02/23 15:59:26 $