NetCDFFile
Read and write NetCDF files
Declaration
classdef NetCDFFile < NetCDFGroupOverview
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.
Typical usage patterns include: 1) Create/open a file and obtain the root group interface. 2) Define dimensions, then define variables referencing those dimensions. 3) Attach global and variable attributes, and synchronize/close.
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
- Initializing
NetCDFFileOpen an existing NetCDF file or create a new file at path.
- Accessing file properties
- Working with groups
duplicatethe NetCDF dataset to a new file.