NetCDFFile

Read and write NetCDF files


Declaration

classdef NetCDFFile < NetCDFGroup

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.

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
    • NetCDFFile Open an existing NetCDF file or create a new file at path.
  • Accessing file properties
    • close the underlying NetCDF file handle.
    • delete Destructor: close the file handle if still open.
    • filename File name (base name + extension) derived from path.
    • format NetCDF format identifier.
    • path File path to the NetCDF dataset.
    • sync Synchronize in-memory changes to disk.
  • Working with groups
    • duplicate the NetCDF dataset to a new file.


This site uses Just the Docs, a documentation theme for Jekyll.