6.5 ncdump and ncgen together
Used together, ncdump and ncgen can
accomplish simple netCDF manipulations with little or no programming.
ncdump and ncgen
To edit metadata or data in a netCDF file:
- Use ncdump to convert netCDF file to CDL
- Use a text editor to make desired change to CDL
- Use ncgen to turn modified CDL back into
- Note: not practical for huge netCDF files or if modifying
lots of files. For that, need to write a program using netCDF library.
To create a new netCDF file with lots of metadata:
Use a text editor to write a CDL file with lots of metadata but little or no data.
Use ncgen to generate corresponding C or Fortran program for
- Insert appropriate netCDF "var_put" calls for writing
- Compile and run program to create netCDF file.
- Use ncdump to verify result.