NetCDFFile

A class for reading and writing to NetCDF files


Declaration

classdef NetCDFFile < handle

Overview

NetCDF files are a standard file format for reading and writing data. This class is designed to simplify the task of adding new dimensions, variables, and attributes to a NetCDF file compared to using the built-in ncread and ncwrite functions.

  ncfile = NetCDFFile('myfile.nc')
 
  % create two new dimensions and add them to the file
  x = linspace(0,10,11);
  y = linspace(-10,0,11);
  ncfile.addDimension('x',x);
  ncfile.addDimension('y',y);
 
  % Create new multi-dimensional variables, and add those to the file
  [X,Y] = ncgrid(x,y);
  ncfile.addVariable(X,{'x','y'});
  ncfile.addVariable(Y,{'x','y'});

Topics