Reputation: 31
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.
Upvotes: 3
Views: 5096
Reputation: 43642
You can only append one variable at at time, so -A *.nc
is invalid.
If you have var1.nc
, var2.nc
, var3.nc
with common dimensions and sizes, try:
cp var1.nc out.nc
ncks -h -A var2.nc out.nc
ncks -h -A var3.nc out.nc
# repeat as needed
This will combine them into one out.nc
file, leaving the original files unmodified.
Upvotes: 3
Reputation: 8077
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.
Upvotes: 5
Reputation: 6322
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.
Upvotes: 5