Chapter 5.  Creating NetCDF Files

Table of Contents

Classic NetCDF Files
NetCDF-4 Classic Model Format
64-bit offset NetCDF Files

Classic NetCDF Files

Creating and writing to netCDF files requires either the mex-file or R2008b and better as a backend for SNCTOOLS. Creating netCDF files with the java backend is not supported.

Before actually creating a netCDF file, let's figure out what we want to create in the first place. Suppose we have a rectangular time series grid of data. The spatial dimensions of the data are latitude and longitude.

Creating an empty netCDF file is as simple as using the rather aptly-named nc_create_empty.m m-file as so.

nc_create_empty ( 'test.nc' )
nc_dump ( 'test.nc' )

netcdf test.nc {



}