Reputation: 1174
I am using netcdf operators to append two NCEP netCDF files together. These files are of different sizes but they represent the same atmospheric variable i.e. geopotential height. One is at 1000 hPa and the other file is at 925 hPa.They have the same dimensions and same latitudinal and longitudinal extent. Both represent the same time instant
This is the command I am using - ncks -A hgt_1000.nc hgt_925.nc
The command runs without any issue but when I look at the output of hgt_925.nc it looks the files have not merged. Looking at the NCO documentation it looks they have to be the same size to append. Is there another way forward or should I write my own code to append ? These are netCDF4 files classic files downloaded using nccopy.
Upvotes: 3
Views: 3148
Reputation: 128
You can also use the CDO to merge the netcdf files.
The command cdo merge hgt_1000.nc hgt_925.nc out.nc
Upvotes: 3
Reputation: 6352
new answer, based on new user information:
Since your input files already have a level dimension, the proceducre to follow is here. Turn level into a record dimension, then concatenate files along it with ncrcat, then permute back with ncpdq. The manual has examples.
old answer:
What you want to do seems to be what NCO would handle with ncecat (appending is for copying new variables to existing files). Concatenate the files together and rename the resulting record variable as, e.g., level, with
ncecat -u level hgt_1000.nc hgt_925.nc out.nc
Upvotes: 3