NCL Home > Documentation > Functions > Meteorology


Use "highly accurate" spherical harmonics to derive the Q-vector components on a global grid.

Available in version 6.6.0 and later.


load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"  ; This library is automatically loaded
                                                             ; from NCL V6.2.0 onward.
                                                             ; No need for user to explicitly load.

	function qvector_isobaric (
		u            : numeric,  
		v            : numeric,  
		t            : numeric,  
		ss           : numeric,  
		p        [*] : numeric,  
		pdim     [1] : integer,  
		gridType [1] : integer,  
		opt          : integer   

	return_val [dimsizes(x)] :  float or double



Array containing zonal wind components (m/s). The array must be global and ordered south to north.


Array containing meridional wind components (m/s). Same size and shape as u.


Array containing temperatures. Same size and shape as u.


Array containing static stability. Same size and shape as u.


pressure [Pa]


Dimension number for pressure coordinate.


Grid type. gridType=0 means gaussian grid; gridType=1 means regular or fixed grid.



  • opt=0 means return the two Q-vector components (Qi and Qj)
  • opt=1 means return a list variable containing: [/Qi, Qj, dtdx, dtdy, dudx, dudy, dvdx, dvdy/]

Return value

Two Q-vector component arrays of the same size and shape as t. The output will be double if u, v or t is of type double.


Calculate the two Q-vector components on the globe using spherical harmonics This function requires that the grids be global because the "highly accurate" spherical harmonic functions are used to derive the gradients.

From Q-vectors: Q-vectors are used in atmospheric dynamics to understand physical processes such as vertical motion and frontogenesis. Q-vectors are not physical quantities that can be measured in the atmosphere but are derived from the quasi-geostrophic equations and can be used in the previous diagnostic situations. On meteorological charts, Q-vectors point toward upward motion and away from downward motion. Q-vectors are an alternative to the omega equation for diagnosing vertical motion in the quasi-geostrophic equations.

            Qi = -R/(s*p)*[(du/dx)*(dt/dx) + (dv/dx)*(dt/dy)]    ; R is ideal gas constant
            Qj = -R/(s*p)*[(du/dy)*(dt/dx) + (dv/dy)*(dt/dy)]

Steenburgh's notes state that the advantages of the Q-vector form of the omega equation:

    (a) Single forcing term 
    (b) Can be evaluated at a single level
    (a) Without explicitly plotting the Q-vectors, it's extremely difficult (perhaps    
        impossible) to evaluate from traditional synoptic maps
    (b) Not physically intuitive

NOTE: This is a non-linear quantity. Generally, it is not appropriate to use (say) monthly means quantities. Rather, high-frequency (hourly, 3-hr, 6-hr, daily) quantities should be used.

To see gradients derived via spherical harmonics and 'simple' centered finite differences, see: gradients.


   Steenburgh, J. (2011):  Q-vectors

See Also

qvector_isobaric_cfd, beta_dfdy_rossby, grad_latlon_cfd


Example 1: See qvector

Example 2: Sample output from the above: Here the variables u,v (m/s) and T (degK) are ordered south to north and are on a global grid.

   f  = addfile("...", "r")
   u  = f->U    ; (time,lev,lat,lon); (0,1,2,3); m/s
   v  = f->V
   t  = f->T    ; degK

   pPa  = 100*t&level     ; clarity;  p[*]
   pPa@units = "Pa"
   pdim = 1

   ss = static_stability (pPa, t, pdim, opt_ss) 
   printMinMax(ss, 0) ; min=-0.000322343   max=0.0595654

   opt_ss   = 0           ; =0 return static stability only
                          ; =1, return 3 varaibles as part of a list
   pdim     = 1           ; (time,level,lat,lon), (0,1,2,3)   

   cyclic   = True        ; global
   gridType = 1           ; global fixed grid
   opt_qv   = 0           ; return only the two Q-vector components

   qvList   = qvector_isobaric(u,v,t,ss,pPa,pdim,gridType,t&lat,t&lon,opt_adv)
   Qi       = qvList[0]   ; explicitly extract for clarity
   Qj       = qvList[1]   
   delete(qvList)    ; not necessary

   printMinMax(Qi, 0)  

   printMinMax(Qj, 0)  
The edited output:

          Variable: Qi      
          Type: float
          Total Size: 5003712 bytes
                      1250928 values
          Number of Dimensions: 4
          Dimensions and sizes:	[time | 7] x [level | 17] x [lat | 73] x [lon | 144]
                      time: [1823280..1823424]
                      level: [1000..10]
                      lat: [-90..90]
                      lon: [ 0..357.5]
          Number Of Attributes: 4
            _FillValue :	-9.96921e+36
            long_name :	QI
            units :	
            gradients :	spherical harmonics
          (0)	QI : min=-3.66776e-06   max=6.4694e-06
          (0)	===
          Variable: Qj     
          Type: float
          Total Size: 5003712 bytes
                      1250928 values
          Number of Dimensions: 4
          Dimensions and sizes:	[time | 7] x [level | 17] x [lat | 73] x [lon | 144]
                      time: [1823280..1823424]
                      level: [1000..10]
                      lat: [-90..90]
                      lon: [ 0..357.5]
          Number Of Attributes: 4
            _FillValue :	-9.96921e+36
            long_name :	QJ
            units :	
            gradients :	spherical harmonics
          (0)	QJ : min=-1.71243e-05   max=3.36954e-06
          (0)	===