Home > atmlab > arts > xml > xmlWriteGFieldWrapper.m

xmlWriteGFieldWrapper

PURPOSE ^

Writes a GField to an XML file.

SYNOPSIS ^

function xmlWriteGFieldWrapper(fid, fidb, data, precision, dim)

DESCRIPTION ^

 Writes a GField to an XML file.

    Internal function that should never be called directly.
    Use *xmlStore* instead.

 FORMAT   xmlWriteGFieldWrapper(fid, fidb, data, precision, dim)

 IN    fid        File descriptor
 IN    fidb       File descriptor for binary file
 IN    data       GriddedField3
 IN    precision  Precision for floats

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

xmlWriteGFieldWrapper.m

SOURCE CODE ^

0001 % Writes a GField to an XML file.
0002 %
0003 %    Internal function that should never be called directly.
0004 %    Use *xmlStore* instead.
0005 %
0006 % FORMAT   xmlWriteGFieldWrapper(fid, fidb, data, precision, dim)
0007 %
0008 % IN    fid        File descriptor
0009 % IN    fidb       File descriptor for binary file
0010 % IN    data       GriddedField3
0011 % IN    precision  Precision for floats
0012 
0013 % 2008-07-02   Created by Oliver Lemke.
0014 
0015 function xmlWriteGFieldWrapper(fid, fidb, data, precision, dim)
0016 
0017   % GriddedField
0018   if isfield( data, 'name' )
0019     attrlist = xmlAddAttribute ([], 'name', data.name);
0020   else
0021     attrlist = [];
0022   end
0023   xmlWriteTag (fid, ['GriddedField' sprintf('%d', dim)], attrlist);
0024 
0025   % Grids
0026   for i = 1:dim
0027     attrlist = xmlAddAttribute ([], 'name', data.gridnames{i});
0028     if (length(data.grids{i})~=0 && iscellstr(data.grids{i}(1)))
0029       xmlWriteArrayOf (fid, fidb, data.grids{i}, 'String', precision, attrlist);
0030     else
0031       xmlWriteVector (fid, fidb, data.grids{i}, precision, attrlist);
0032     end
0033   end
0034 
0035   % Data
0036   if isfield( data, 'dataname' )
0037     attrlist = xmlAddAttribute ([], 'name', data.dataname);
0038   else
0039     attrlist = [];
0040   end
0041   switch dim
0042     case 1
0043       xmlWriteVector (fid, fidb, data.data, precision, attrlist);
0044     case 2
0045       xmlWriteMatrix (fid, fidb, data.data, precision, attrlist);
0046     case 3
0047       xmlWriteTensor3 (fid, fidb, data.data, precision, attrlist);
0048     case 4
0049       xmlWriteTensor4 (fid, fidb, data.data, precision, attrlist);
0050     case 5
0051       xmlWriteTensor5 (fid, fidb, data.data, precision, attrlist);
0052     case 6
0053       xmlWriteTensor6 (fid, fidb, data.data, precision, attrlist);
0054     case 7
0055       xmlWriteTensor7 (fid, fidb, data.data, precision, attrlist);
0056   end
0057 
0058   xmlWriteCloseTag (fid, ['GriddedField' sprintf('%d', dim)]);
0059

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