@BeginModule
@Name      = Wind
@Title     = Wind transformation
@Section   = Transformation
@Class     = Transformation
@Arguments = ifile ofile
@Operators = dv2uv dv2uvl uv2dv uv2dvl 

@BeginDescription
This module converts divergence and vorticity to U and V wind and vice versa.
@EndDescription
@EndModule


@BeginOperator_dv2uv
@Title     = Divergence and vorticity to U and V wind

@BeginDescription
Calculate U and V wind on a gaussian grid from spherical harmonic 
coefficients of divergence and vorticity. The U and V wind must have
the names u and v or the code numbers 131 and 132.
The number of latitudes of the resulting gaussian grid is calculated 
from the triangular truncation by:
@IfMan

   nlat = NINT((trunc*3 + 1.)/2.)
@EndifMan
@IfDoc
\\
@BeginMath
   \mbox{nlat} = NINT((\mbox{trunc}*\fbox{3} + 1.)/2.)
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginOperator_dv2uvl
@Title     = Divergence and vorticity to U and V wind (linear)

@BeginDescription
Calculate U and V wind on a gaussian grid from spherical harmonic 
coefficients of divergence and vorticity. The U and V wind must have
the names u and v or the code numbers 131 and 132.
The number of latitudes of the resulting gaussian grid is calculated 
from the triangular truncation by:
@IfMan

   nlat = NINT((trunc*2 + 1.)/2.)
@EndifMan
@IfDoc
\\
@BeginMath
   \mbox{nlat} = NINT((\mbox{trunc}*\fbox{2} + 1.)/2.)
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginOperator_uv2dv
@Title     = U and V wind to divergence and vorticity

@BeginDescription
Calculate spherical harmonic coefficients of divergence and vorticity
from U and V wind. The divergence and vorticity must have the names sd
and svo or code numbers 155 and 138.
The triangular truncation of the resulting spherical harmonics
is calculated from the number of latitudes by:
@IfMan

   trunc = (nlat*2 - 1) / 3
@EndifMan
@IfDoc
\\
@BeginMath
   \mbox{trunc} = (\mbox{nlat}*2 - 1) / \fbox{3}
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginOperator_uv2dvl
@Title     = U and V wind to divergence and vorticity (linear)

@BeginDescription
Calculate spherical harmonic coefficients of divergence and vorticity
from U and V wind. The divergence and vorticity must have the names sd
and svo or code numbers 155 and 138.
The triangular truncation of the resulting spherical harmonics
is calculated from the number of latitudes by:
@IfMan

   trunc = (nlat*2 - 1) / 2
@EndifMan
@IfDoc
\\
@BeginMath
   \mbox{trunc} = (\mbox{nlat}*2 - 1) / \fbox{2}
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginExample
Assume a dataset has at least spherical harmonic coefficients
of divergence and vorticity.
To transform the spectral divergence and vorticity to U and V wind, use:
@BeginVerbatim
   cdo dv2uv ifile ofile
@EndVerbatim
@EndExample
