2011 Unidata NetCDF Workshop > Formats and Performance
15.4 NetCDF Classic Performance Tips
Avoid premature optimization: worry about
performance only after you determine where the bottlenecks are.
- The netCDF classic file format is mature and implementation is efficient for
many uses.
- With netCDF, all file metadata is read into memory
when file is opened, so functions that get metadata ("_inq_" functions) are very
fast.
- To avoid copying data when the file schema changes, do one of the following
- Create all needed dimensions, variables, and attributes
before writing data, or
- Reserve extra space in the file header for later additions
(using
nc__enddef()
in C, NF__ENDDEF()
or
NF90__ENDDEF()
for Fortran, setExtraHeaderBytes()
method
of NetcdfFileWritable for Java)
nc__enddef()
in C
NF__ENDDEF()
or NF90__ENDDEF()
for
Fortran
- setExtraHeaderBytes() method of NetcdfFileWritable for
Java
- Use netCDF-4 format
2011 Unidata NetCDF Workshop > Formats and Performance