Computes the divergent (irrotational) wind components for a fixed grid via spherical harmonics.
function dv2uvF ( dv : numeric ) return_val [2, dimsizes(dv)] : float or double
Divergence array (input, two or more dimensions, where the rightmost two dimensions must be lat x lon)
- input values must be in ascending latitude order
- input array must be on a global grid
The results are returned in an array dimensioned 2 x N x nlat x nlon, where the 0-th point of the leftmost dimension contains the u component and the 1-th point of the leftmost dimension contains the v component (both in ascending latitude order). N represents all but the last two dimensions of dv. If the input array is two-dimensional, then N can either be considered equal to 1 or nothing at all. The array returned will be of type double if the input is double, and float otherwise.
The function dv2uvF computes the divergent wind components given an array, dv, containing divergence and operates on a fixed grid.
This function does not handle missing values (defined by the _FillValue attribute). If any missing values are encountered in a particular 2D input grid, then all of the values in the corresponding output grid will be set to the default missing value appropriate to the type of the output.
Arrays which have dimensions N x nlat x nlon should not include the cyclic (wraparound) points when invoking the procedures and functions which use spherical harmonics (Spherepack).
Use dv2uvF_Wrap if retention of metadata is desired.
Let div(nlat,mlon) be an array on a fixed grid. Then:
uvd = dv2uvF (div)will return the divergent zonal and meridional wind components.
uvd(0,nlat,mlon) <== divergent zonal wind componentsThese values are the same as those returned by the procedural version of this routine but the user does not have to explicitly allocate memory. For example:
uvd(1,nlat,mlon) <== divergent meridional wind components
Read u/v from a netCDF file and compute divergence:
f = addfile ("UV.nc", "r") u = f->U v = f->V div = uv2dvF(u,v) ;computes divergence given the u and v components (on a fixed grid) uvd = dv2uvF (div)
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)