 
  
   
    
 
 
Consider implementing a program to just copy data.
$ nccopy input_file output_file
    create empty output file
    add dimensions and global attributes in input to output
  
    for each variable in the input file
         add the variable definition to the output file
         copy the variable's attributes to output
         copy the variable's data to the output
  
  
    create empty output file
    add dimensions and global attributes to output
  
    for each variable in the input file
        add the variable definition to the output file
        copy the variable's attributes to output
  
    for each variable in the input file
        copy the variable's data to the output
  
  If output is a classic netCDF file, which method is faster, and why? If the input has record variables, can the faster algorithm be improved?
For HDF5-based netCDF-4 files, schema changes such as adding new variables are efficient, because both metadata and data can be appended to a netCDF-4 file.