Next: ncflint netCDF File Interpolator, Previous: ncea netCDF Ensemble Averager, Up: Operator Reference Manual
ncecat [-4] [-A] [-C] [-c] [-D dbg] [-d dim,[min][,[max][,[stride]]] [-F] [-h] [-l path] [-n loop] [-O] [-o output-file] [-p path] [-R] [-r] [-t thr_nbr] [-v var[,...]] [-x] [input-files] [output-file]
DESCRIPTION
ncecat concatenates an arbitrary number of input files into a single output file. A new record dimension acts as the glue to bind the input file data together. Each variable in each input file becomes one record in the same variable in the output file. The input-files are stored consecutively as records in output-file. All input-files must contain all extracted variables (or else there would be "gaps" in the output file).
Each extracted variable must be constant in size and rank across all input-files. The only exception is that ncecat allows files to differ in the record dimension size if the requested record hyperslab (see Hyperslabs) resolves to the same size for all files. This allows easier gluing/averaging of unequal length timeseries from simulation ensembles (e.g., the IPCC AR4 archive).
Thus, the output-file size is the sum of the sizes of the
extracted variables in the input files.
See Averaging vs. Concatenating, for a description of the
distinctions between the various averagers and concatenators.
As a multi-file operator, ncecat will read the list of
input-files from stdin
if they are not specified
as positional arguments on the command line
(see Large Numbers of Files).
Consider five realizations, 85a.nc, 85b.nc,
... 85e.nc of 1985 predictions from the same climate
model.
Then ncecat 85?.nc 85_ens.nc
glues the individual realizations
together into the single file, 85_ens.nc.
If an input variable was dimensioned [lat
,lon
], it will
have dimensions [record
,lat
,lon
] in the output
file.
A restriction of ncecat is that the hyperslabs of the
processed variables must be the same from file to file.
Normally this means all the input files are the same size, and contain
data on different realizations of the same variables.
Consider a model experiment which generated five realizations of one year of data, say 1985. You can imagine that the experimenter slightly perturbs the initial conditions of the problem before generating each new solution. Assume each file contains all twelve months (a seasonal cycle) of data and we want to produce a single file containing all the seasonal cycles. Here the numeric filename suffix denotes the experiment number (not the month):
ncecat 85_01.nc 85_02.nc 85_03.nc 85_04.nc 85_05.nc 85.nc ncecat 85_0[1-5].nc 85.nc ncecat -n 5,2,1 85_01.nc 85.nc
These three commands produce identical answers. See Specifying Input Files, for an explanation of the distinctions between these methods. The output file, 85.nc, is five times the size as a single input-file. It contains 60 months of data (which might or might not be stored in the record dimension, depending on the input files).
Consider a file with an existing record dimension named time
.
and suppose the user wishes to convert time
from a record
dimension to a non-record dimension.
This may be useful, for example, when the user has another use for the
record variable.
The procedure is to use ncecat followed by ncwa
ncecat in.nc out.nc # Convert time to non-record dimension ncwa -a record in.nc out.nc # Remove new degenerate record dimension
The second step removes the degenerate record dimension. See ncpdq netCDF Permute Dimensions Quickly for other methods of changing variable dimensionality, including the record dimension.