Home > atmlab > arts > netcdf > arts_nc_write_tensor3.m

arts_nc_write_tensor3

PURPOSE ^

ARTS_NC_WRITE_TENSOR3 Write Tensor3 to ARTS NetCDF file.

SYNOPSIS ^

function arts_nc_write_tensor3 (filename, v, varargin)

DESCRIPTION ^

 ARTS_NC_WRITE_TENSOR3   Write Tensor3 to ARTS NetCDF file.

    Writes a Tensor3 to a NetCDF file for use with Arts.

 FORMAT   arts_nc_write_tensor3(filename, v, varargin)
        
 IN    filename  Name of NetCDF file.
 IN    v         Tensor3 variable.
 OPT   varargin  Cell array of name/value pair cells for global attributes

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

arts_nc_write_tensor3.m

SOURCE CODE ^

0001 % ARTS_NC_WRITE_TENSOR3   Write Tensor3 to ARTS NetCDF file.
0002 %
0003 %    Writes a Tensor3 to a NetCDF file for use with Arts.
0004 %
0005 % FORMAT   arts_nc_write_tensor3(filename, v, varargin)
0006 %
0007 % IN    filename  Name of NetCDF file.
0008 % IN    v         Tensor3 variable.
0009 % OPT   varargin  Cell array of name/value pair cells for global attributes
0010 
0011 % 2010-02-03   Created by Oliver Lemke.
0012 
0013 function arts_nc_write_tensor3 (filename, v, varargin)
0014 
0015 ncid = netcdf.create (filename, 'NC_CLOBBER');
0016 
0017 attributes = optargs( varargin, { [] } );
0018 
0019 if (~isempty(attributes))
0020       addncattributes (ncid, attributes);
0021 end
0022 
0023 s = size(v);
0024 pdim = netcdf.defDim (ncid, 'npages', s(1));
0025 rdim = netcdf.defDim (ncid, 'nrows',  s(2));
0026 cdim = netcdf.defDim (ncid, 'ncols',  s(3));
0027 
0028 varid = netcdf.defVar (ncid, 'Tensor3', 'double', [cdim rdim pdim]);
0029 
0030 netcdf.endDef (ncid);
0031 
0032 netcdf.putVar (ncid, varid, permute(v, [3 2 1]));
0033 
0034 netcdf.close (ncid);

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