Home > atmlab > arts > netcdf > arts_nc_write_tensor4.m

arts_nc_write_tensor4

PURPOSE ^

ARTS_NC_WRITE_TENSOR4 Write Tensor4 to ARTS NetCDF file.

SYNOPSIS ^

function arts_nc_write_tensor4 (filename, v, varargin)

DESCRIPTION ^

 ARTS_NC_WRITE_TENSOR4   Write Tensor4 to ARTS NetCDF file.

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

 FORMAT   arts_nc_write_tensor4(filename, v, varargin)
        
 IN    filename Name of NetCDF file.
 IN    v        Tensor4 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_tensor4.m

SOURCE CODE ^

0001 % ARTS_NC_WRITE_TENSOR4   Write Tensor4 to ARTS NetCDF file.
0002 %
0003 %    Writes a Tensor4 to a NetCDF file for use with Arts.
0004 %
0005 % FORMAT   arts_nc_write_tensor4(filename, v, varargin)
0006 %
0007 % IN    filename Name of NetCDF file.
0008 % IN    v        Tensor4 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_tensor4 (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 bdim = netcdf.defDim (ncid, 'nbooks', s(1));
0025 pdim = netcdf.defDim (ncid, 'npages', s(2));
0026 rdim = netcdf.defDim (ncid, 'nrows',  s(3));
0027 cdim = netcdf.defDim (ncid, 'ncols',  s(4));
0028 
0029 varid = netcdf.defVar (ncid, 'Tensor4', 'double', [bdim cdim rdim pdim]);
0030 
0031 netcdf.endDef (ncid);
0032 
0033 netcdf.putVar (ncid, varid, permute(v, [4 3 2 1]));
0034 
0035 netcdf.close (ncid);

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