# cf.relative_vorticity

`cf.``relative_vorticity`(u, v, cyclic=None, one_sided_at_boundary=False)

  Calculate the relative vorticity using centred finite differences. According to the formula given here:

  https://www.ncl.ucar.edu/Document/Functions/Built-in/uv2vr_cfd.shtml

  “According to H.B. Bluestein [Synoptic-Dynamic Meteorology in Midlatitudes, 1992, Oxford Univ. Press p113-114], let D represent the partial derivative, a the radius of the earth, phi the latitude and dx2/dy2 the appropriate longitudinal and latitudinal spacing, respectively. Then, letting j be the latitude y-subscript, and i be the longitude x-subscript:

  > rv = Dv/Dx - Du/Dy + (u/a)*tan(phi)

  > rv(j,i) = (v(j,i+1)-v(j,i-1))/dx2(j)
  >   - (u(j+1,i)-u(j-1,i))/dy2(j)
  >   - (u(j,i)/a)*tan(phi(j))

  The last term accounts for the convergence of the meridians on a sphere.”

  The grid may be global or limited area. If missing values are present then missing values will be returned at points where the centred finite difference could not be calculated. The boundary conditions may be cyclic in longitude. The noncyclic boundaries may either be filled with missing values or calculated with off-centre finite differences.

  Parameters: | u: cf.Field A field containing the x-wind. Must be on the same grid as the y-wind. v: cf.Field A field containing the y-wind. Must be on the same grid as the x-wind. cyclic: `bool`, optional Whether the longitude is cyclic or not. By default this is autodetected. one_sided_at_boundary: `bool`, optional If True then if the field is not cyclic off-centre finite differences are calculated at the boundaries, otherwise missing values are used at the boundaries.
  Returns: | rv: cf.Field The relative vorticity calculated with centred finite differences.