Home > atmlab > gformat > atmdata_empty.m

atmdata_empty

PURPOSE ^

ATMDATA_EMPTY Creates an empty and minimal atmdata structure

SYNOPSIS ^

function G = atmdata_empty( dim )

DESCRIPTION ^

 ATMDATA_EMPTY   Creates an empty and minimal atmdata structure

    The returned structure has the minimal set of fields for the selected
    dimensionality. Most fields are set to be empty. Exceptions:

       DIM is set to *dim* 

       TYPE is set to 'atmdata'.
    
       Grid names and grid units are set as described in *isatmdata*,
       beside GRID4_NAME that is set to '?'.

 FORMAT   G = atmdata_empty( [ dim ] )
        
 OUT   G     Created atmlab structure.
 OPT   dim   Dimensionality. Default is 0. Max is 5.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

atmdata_empty.m

SOURCE CODE ^

0001 % ATMDATA_EMPTY   Creates an empty and minimal atmdata structure
0002 %
0003 %    The returned structure has the minimal set of fields for the selected
0004 %    dimensionality. Most fields are set to be empty. Exceptions:
0005 %
0006 %       DIM is set to *dim*
0007 %
0008 %       TYPE is set to 'atmdata'.
0009 %
0010 %       Grid names and grid units are set as described in *isatmdata*,
0011 %       beside GRID4_NAME that is set to '?'.
0012 %
0013 % FORMAT   G = atmdata_empty( [ dim ] )
0014 %
0015 % OUT   G     Created atmlab structure.
0016 % OPT   dim   Dimensionality. Default is 0. Max is 5.
0017 
0018 % 2010-01-06   Created by Patrick Eriksson.
0019 
0020 function G = atmdata_empty( dim )
0021 %
0022 if nargin < 1  |  isempty(dim)
0023   dim = 0;
0024 end
0025  
0026 G           = gf_empty( dim );
0027 G.TYPE      = 'atmdata';
0028 
0029 % If dim iswhole etc. is checked by gf_empty, but we need to check:
0030 if atmlab('STRICT_ASSERT') & ( dim<0 | dim>5 )
0031   error( 'Input argument must be between 0 and 5.' );
0032 end
0033 
0034 
0035 
0036 
0037 % Any changes here must be described in header of *isatmdata* !!!
0038   
0039 grid_names  = { 'Pressure', 'Latitude', 'Longitude', '?', 'Hour' };
0040 grid_units  = { 'Pa', 'deg', 'deg', '', '' };
0041 
0042 for d = 1 : dim
0043   G = gf_set_grid( G, d, [], grid_names{d}, grid_units{d} );
0044 end
0045

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