@BeginModule
@NewPage
@Name      = Merge
@Title     = Merge datasets
@Section   = File operations
@Class     = File operation
@Arguments = ifiles ofile
@Operators = merge mergetime

@BeginDescription
This module reads datasets from several input files, merges them and writes the resulting dataset to @file{ofile}.
@EndDescription
@EndModule


@BeginOperator_merge
@Title     = Merge datasets with different fields

@BeginDescription
Merges time series of different fields from several input datasets. The number 
of fields per timestep written to @file{ofile} is the sum of the field numbers 
per timestep in all input datasets. The time series on all input datasets are 
required to have different fields and the same number of timesteps.
The fields in each different input file either have to be different variables
or different levels of the same variable. A mixture of different variables on
different levels in different input files is not allowed.
@EndDescription
@EndOperator


@BeginOperator_mergetime
@Title     = Merge datasets sorted by date and time

@BeginDescription
Merges all timesteps of all input files sorted by date and time.
All input files need to have the same structure with the same variables on 
different timesteps. After this operation every input timestep is in @file{ofile} 
and all timesteps are sorted by date and time.
@EndDescription
@EndOperator


@BeginEnvironment
@Item = SKIP_SAME_TIME
If set to 1, skips all timesteps with a double entry of the same timestamp.
@EndEnvironment


@BeginExample
Assume three datasets with the same number of timesteps and different variables in each dataset.
To merge these datasets to a new dataset use:
@BeginVerbatim
   cdo merge ifile1 ifile2 ifile3 ofile
@EndVerbatim
Assume you split a 6 hourly dataset with @oper{splithour}. This produces four datasets, one for each hour.
The following command merges them together:
@BeginVerbatim
   cdo mergetime ifile1 ifile2 ifile3 ifile4 ofile
@EndVerbatim
@EndExample
