@BeginModule
@NewPage
@Name      = Selbox
@Title     = Select a box of a field
@Section   = Selection
@Class     = Selection
@Arguments = ifile ofile
@Operators = sellonlatbox selindexbox

@BeginDescription
Selects a box of the rectangularly understood field. All input fields need to have the same horizontal grid.
@EndDescription
@EndModule


@BeginOperator_sellonlatbox
@Title     = Select a longitude/latitude box
@Parameter = lon1 lon2 lat1 lat2

@BeginDescription
Selects a regular longitude/latitude box. The user has to give the longitudes and latitudes of the 
edges of the box. Considered are only those grid cells with the grid center inside the lon/lat box.
For rotated lon/lat grids the parameter needs to be rotated coordinates.
@EndDescription
@EndOperator


@BeginOperator_selindexbox
@Title     = Select an index box
@Parameter = idx1 idx2 idy1 idy2

@BeginDescription
Selects an index box. The user has to give the indexes of the edges of the box. The index of the 
left edge may be greater then that of the right edge.
@EndDescription
@EndOperator


@BeginParameter idx1
@Item = lon1
FLOAT    Western longitude
@Item = lon2
FLOAT    Eastern longitude
@Item = lat1
FLOAT    Southern or northern latitude
@Item = lat2
FLOAT    Northern or southern latitude
@Item = idx1
INTEGER  Index of first longitude
@Item = idx2
INTEGER  Index of last longitude
@Item = idy1
INTEGER  Index of first latitude
@Item = idy2
INTEGER  Index of last latitude
@EndParameter


@BeginExample
To select the region with the longitudes from 120E to 90W and latitudes from 20N to 20S from all input fields use:
@BeginVerbatim
   cdo sellonlatbox,120,-90,20,-20 ifile ofile
@EndVerbatim
If the input dataset has fields on a Gaussian N16 grid, the same box can be selected with @oper{selindexbox} by:
@BeginVerbatim
   cdo selindexbox,23,48,13,20 ifile ofile
@EndVerbatim
@EndExample
