'Concatenate netcdf files with different variables - using nco

I want to concatenate two sets of netcdf files using nco, where each set has about 30 files.

Set 1 contains: longitude, latitude, time and v.

Set 2 contains: longitude, latitude, time and u.

I have tried:

ncks *.nc out.nc    

but I get:

Error received 97 filenames; need no more than two

then I tried:

ncks -A *.nc out.nc

but the error persists:

Error received 97 filenames; need no more than two

Please can you point me in the right direction, I am quite new to this.

Thanks in advance.



Solution 1:[1]

Your first try should work if you use ncrcat instead of ncks:

ncrcat *.nc out.nc

And be careful that your wildcard expression evaluates to the files you intend, i.e., that ls *.nc results in all input files and nothing else.

Solution 2:[2]

As an alternative you can also use Climate Data Operators (CDO):

cdo cat *.nc out.nc

assuming all files are on the same grid and times.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Charlie Zender
Solution 2 Luke Davis