Two ways to implement a netCDF copy program for classic files:
create empty target file
add dimensions and global attributes to target
for each variable in the source file
add the variable definition to the target file
copy the variable's attributes to target
copy the variable's data to the target
create empty target file
add dimensions and global attributes to target
add all the variable definitions to the target file
copy all the variable attributes to target
for each variable in the source file
copy the variable's data to the target
Timings on a 44 MByte WRF model output, with about 100 variables:
Timing for Method 1
Timing for Method 2
NetCDF-4 note:
Since netCDF-4 files do not have a
contiguous header, schema changes are efficient.