Home > atmlab > files > addncattributes.m

addncattributes

PURPOSE ^

ADDNCATTRIBUTES Add global attributes to a NetCDF file.

SYNOPSIS ^

function addncattributes (ncid, attributes)

DESCRIPTION ^

 ADDNCATTRIBUTES   Add global attributes to a NetCDF file.

    Adds the given global attributes to a NetCDF file.

    e.g.: addncattributes(ncid, struct('attr1', 'value1', 'attr2', 2))

 FORMAT   addncattributes(ncid, attributes)
        
 IN    ncid        Name of NetCDF file.
 IN    attributes  Structure with name/value pairs.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

addncattributes.m

SOURCE CODE ^

0001 % ADDNCATTRIBUTES   Add global attributes to a NetCDF file.
0002 %
0003 %    Adds the given global attributes to a NetCDF file.
0004 %
0005 %    e.g.: addncattributes(ncid, struct('attr1', 'value1', 'attr2', 2))
0006 %
0007 % FORMAT   addncattributes(ncid, attributes)
0008 %
0009 % IN    ncid        Name of NetCDF file.
0010 % IN    attributes  Structure with name/value pairs.
0011 
0012 % 2010-07-06   Created by Oliver Lemke.
0013 
0014 function addncattributes (ncid, attributes)
0015 
0016 fields = fieldnames(attributes);
0017 for f = fields'
0018     netcdf.putAtt (ncid, netcdf.getConstant('GLOBAL'), ...
0019                    char(f{1}), attributes.(f{1}));
0020 end
0021

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005