The output file only has the 'data_variable' variable. The file_1_variable and file_2_variable variables are gone. I can't figure out any command line options for ncdiff to just copy those variables over. So, I thought I'd try appending them back in. This first command works:
Hi Christine,
First, I think the answer to your question is Yes, and that you just need to use -A instead of -O when appending to the output file.
Second, ncbo traditionally copied unmodified any variables that were only in file1. Then I thought we changed it to also copy unmodified any variables only in file2. Pedro, if you're reading this, is that what we tried to do or do I misremember? We may need to revisit this behavior.
cz
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you! That solved the problem. I vaguely remembered there was a -A append option, but when I looked in the documentation, I somehow managed to miss it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have two files with variables:
file1.nc: data_variable, file_1_variable
file2.nc: data_variable, file_2_variable
if I run
ncdiff -o out.nc file1.nc file2.nc
The output file only has the 'data_variable' variable. The file_1_variable and file_2_variable variables are gone. I can't figure out any command line options for ncdiff to just copy those variables over. So, I thought I'd try appending them back in. This first command works:
ncks -O -v data_variable,file_1_variable file1.nc out.nc
And I get the file_1_variable in out.nc. Yay! The problem comes when I try to add file_2_variable in. If I run
ncks -O data_variable,file_1_variable,file_2_variable file2.nc out.nc
I get an error because ncks is trying to find file_1_variable in file2.nc. But if I run
ncks -O data_variable,file_2_variable file2.nc out.nc
Then ncks removes file_1_variable from out.nc.
So, what do I do?
Hi Christine,
First, I think the answer to your question is Yes, and that you just need to use -A instead of -O when appending to the output file.
Second, ncbo traditionally copied unmodified any variables that were only in file1. Then I thought we changed it to also copy unmodified any variables only in file2. Pedro, if you're reading this, is that what we tried to do or do I misremember? We may need to revisit this behavior.
cz
Thank you! That solved the problem. I vaguely remembered there was a -A append option, but when I looked in the documentation, I somehow managed to miss it.