DS-MERGE(1)

NAME
ds-merge - Merge datasets along a dimension.

SYNOPSIS
ds merge dim input... output [options]

DESCRIPTION
Merge datasets along a dimension dim. If the dimension is not defined in the dataset, merge along a new dimension dim. If new is none and dim is not new, variables without the dimension dim are set with the first occurrence of the variable. If new is not none and dim is not new, variables without the dimension dim are merged along a new dimension new. If variables is not none, only those variables are merged along a new dimension, and other variables are set to the first occurrence of the variable. Variables which are merged along a new dimension and are not present in all datasets have their subsets corresponding to the datasets where they are missing filled with missing values. Dataset and variable metadata are merged sequentially from all datasets, with metadata from later datasets overriding metadata from the former ones.

ARGUMENTS

dim Name of a dimension to merge along.

input
    Input file.

output
    Output file.

options
    See help for ds for global options.

OPTIONS

new: value
    Name of a new dimension or none.

variables: { value... } | none
    Variables to merge along a new dimension or none for all variables.

EXAMPLES
Write example data to dataset1.nc.

    $ ds set { time none time { 1 2 3 } long_name: time units: s } { temperature none time { 16. 18. 21. } long_name: temperature units: celsius } title: "Temperature data" none dataset1.nc

Write example data to dataset2.nc.

    $ ds set { time none time { 4 5 6 } long_name: time units: s } { temperature none time { 23. 25. 28. } long_name: temperature units: celsius } title: "Temperature data" none dataset2.nc

Merge dataset1.nc and dataset2.nc and write the result to dataset.nc.

    $ ds merge time dataset1.nc dataset2.nc dataset.nc

Print time and temperature variables in dataset.nc.

    $ ds cat time temperature dataset.nc
    time temperature
    1 16.000000
    2 18.000000
    3 21.000000
    4 23.000000
    5 25.000000
    6 28.000000