append data for a single level into a multi-level file
Added by Chris Fletcher over 13 years ago
I would like to append a lat-lon grid for a single level from file1 into file2 which is on multiple levels. If file1 is on level 3 hPa, and file2 has 60 levels ranging from 1000 -- 0.001 hPa (and including 3 hPa), then is there a way to replace the level 3 hPa data in file2 with that from file1?
Another way to put the question, can the cat or merge operators work on the level dimension?
Thanks
Chris
Replies (2)
RE: append data for a single level into a multi-level file - Added by Chris Fletcher over 13 years ago
Actually, I think I have a solution using both NCO and CDO:
1. I split file2 into two parts (0:levidx-1, and levidx:59):
ncks -d lev,0,30 file2 file2_part1
ncks -d lev,31,59 file2 file2_part2
2. I appended the data from file1 into file2_part2 for level index 0 of file2_part2 (which now correctly corresponds to 3 hPa)
ncks -A -d lev,0 file1 file2_part2
3. I stitched the files back together using cdo merge
cdo merge file2_part1 file2_part2 outfile
Hopefully someone else will find this useful.
RE: append data for a single level into a multi-level file - Added by Uwe Schulzweida over 13 years ago
Thanks for your message! This feature will be available with the replace operator in the next CDO release (version 1.5.2):
cdo replace file2 file1 outfile
Cheers, Uwe