netcdf_test a MATLAB code which calls netcdf(), which reads and writes files in a portable format.

NETCDF (Network Common Data Form) is a set of software libraries and machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data.


The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.


netcdf_test is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version.

Related Programs:

cdl, a data directory of examples of CDL files, a text version of NETCDF files created by the NCDUMP program;

gfd2, a dataset directory which contains geophysical data, stored in NetCDF format.

netcdf a data directory which contains examples of NETCDF files, a format for the interchange of scientific data.


  1. Russ Rew, Glenn Davis, Steve Emmerson, Harvey Davies, Ed Hartne,
    The NetCDF User's Guide,
    Unidata Program Center, March 2009.

Examples and Tests:

SIMPLE_XY_WRITE writes data to a NETCDF file. The data is a simple two-dimensional array.

SIMPLE_XY_READ reads data from a NETCDF file.

SFC_PRES_TEMP_WRITE writes data to a NETCDF file. The data will include units attributes and coordinate dimensions.

SFC_PRES_TEMP_READ reads data from a NETCDF file.

PRES_TEMP_4D_WRITE writes data to a NETCDF file. The data will be four-dimensional and use a record dimension.

PRES_TEMP_4D_READ reads data from a NETCDF file.

Last revised on 27 July 2021.