@BeginModule
@NewPage
@Name      = Spectral
@Title     = Spectral transformation
@Section   = Transformation
@Class     = Transformation
@Arguments = ifile ofile
@Operators = sp2gp sp2gpl gp2sp gp2spl sp2sp

@BeginDescription
This module transforms fields on gaussian grids to spectral coefficients 
and vice versa.
@EndDescription
@EndModule


@BeginOperator_sp2gp
@Title     = Spectral to gridpoint

@BeginDescription
Convert all fields with spectral coefficients to regular gaussian
grid. 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_sp2gpl
@Title     = Spectral to gridpoint linear

@BeginDescription
Convert all fields with spectral coefficients to regular gaussian
grid. 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

Use this operator to convert ERA40 data e.g. from TL159 to N80.
@EndDescription
@EndOperator


@BeginOperator_gp2sp
@Title     = Gridpoint to spectral

@BeginDescription
Convert all gaussian gridpoint fields to spectral coefficients.
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_gp2spl
@Title     = Gridpoint to spectral linear

@BeginDescription
Convert all gaussian gridpoint fields to spectral coefficients.
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

Use this operator to convert ERA40 data e.g. from N80 to TL159
instead of T106.
@EndDescription
@EndOperator


@BeginOperator_sp2sp
@Title     = Spectral to spectral
@Parameter = trunc

@BeginDescription
Change the triangular truncation of all spectral fields.
The operator performs downward conversion by cutting the resolution.
Upward conversions are achieved by filling in zeros.
@EndDescription
@EndOperator


@BeginOperator_spcut
@Title     = Cut spectral wave number
@Parameter = wnums

@BeginDescription
Set the user defined wave numbers to zero.
@EndDescription
@EndOperator


@BeginParameter wnums
@Item = trunc
INTEGER  New spectral resolution
@C @Item = wnums
@C INTEGER  Comma separated list of wave numbers
@EndParameter


@BeginExample
To transform spectral coefficients from T106 to N80 gaussian grid use:
@BeginVerbatim
   cdo sp2gp ifile ofile
@EndVerbatim
To transform spectral coefficients from TL159 to N80 gaussian grid use:
@BeginVerbatim
   cdo sp2gpl ifile ofile
@EndVerbatim
@EndExample
