Compute the meridional and zonal gradients of a variable on a global or limited area rectilinear grid.
Available in version 6.4.0 and later.
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" function grad_latlon_cfd ( z : numeric, ; float, double, integer only lat [*] : numeric, lon [*] : numeric, cyclic  : logical, opt  : logical ) return_val [dimsizes(z)] : float or double
Variable of 2-to-4 dimensions. The two rightmost dimensions must ve (...,lat,lon). Some examples: (lat,lon), (time,lat,lon), (lev,lat,lon), (time,lev,lat,lon).lat
A one-dimensional array containing the latitudes in degrees north. These need not be equally spaced. For example they can be gaussian latitudes.lon
A one-dimensional array containing the longitudes in degrees east. These must be in increasing order and must be equally spaced.cyclic
True: z treated as cyclic in lon and the end values and all the returned values will be calculated via centered differences. False: q NOT treated as cyclic in lon and the end values will use a one-sided difference scheme for the end points. z should not include a cyclic point.opt
Currently not used. Set to False.
A variable of type list. It contains two arrays. Element  contains the meridional gradient and element  contains the zonal gradient. These elements will be the same size and shape as z. The output will be double if z is of type double. If present, meta data will be returned.
A 'worked' example which compares the results between gradients using "spherical harmonics and centered finite differences is available here.
Given a scalar array T on a global rectilinear grid, compute the latitudinal and longitudinal derivatives. The returned variable contains two components: =meridional;  zonal.
gradLatLon = grad_latlon_cfd (T, T&lat T&lon, True, False) T_grad_lat = gradLatLon ; for clarity; explicitly extract variables from returned 'list' T_grad_lon = gradLatLon T_grad_lon@long_name = "longitudinal gradient (derivative)" T_grad_lat@long_name = "latitudinal gradient (derivative)" T_grad_lat@units = "K/m" T_grad_lon@units = "K/m"