Home > atmlab > gformat > gf2griddedfield.m

gf2griddedfield

PURPOSE ^

GF2GRIDDEDFIELD CONVERTS A GFORMAT STRUCTURE INTO A GRIDDED FIELD

SYNOPSIS ^

function [GF,type] = gf2griddedfield(G)

DESCRIPTION ^

 GF2GRIDDEDFIELD   CONVERTS A GFORMAT STRUCTURE INTO A GRIDDED FIELD

    Converts data having the G format into data having the arts xml 
    GriddedField format to use with e.g. xmlStore.

 FORMAT  [GF,type] = gf2griddedfield( G )
        
 OUT   GF      GriddedField
       type    String diescribing the type.
 IN    file    GFormat struckt

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

gf2griddedfield.m

SOURCE CODE ^

0001 % GF2GRIDDEDFIELD   CONVERTS A GFORMAT STRUCTURE INTO A GRIDDED FIELD
0002 %
0003 %    Converts data having the G format into data having the arts xml
0004 %    GriddedField format to use with e.g. xmlStore.
0005 %
0006 % FORMAT  [GF,type] = gf2griddedfield( G )
0007 %
0008 % OUT   GF      GriddedField
0009 %       type    String diescribing the type.
0010 % IN    file    GFormat struckt
0011 
0012 % 2011-02-08   Created by Ole Martin Christensen.
0013 
0014 function [GF,type] = gf2griddedfield(G)
0015 
0016 if atmlab('STRICT_ASSERT')
0017   rqre_nargin( 1, nargin );
0018   %
0019   if ~isgformat(G)
0020     error('Input data must be a GFormat structure');
0021   end
0022   if G.DIM < 1 || G.DIM > 4
0023     error('Input data must have atleast one and maximum four dimensions')
0024   end
0025 end
0026 
0027 
0028 GF.name  = G.NAME;
0029 GF.data  = G.DATA;
0030 GF.dataname = G.DATA_NAME;
0031 for i = 1:G.DIM
0032     n= num2str(i);
0033     GF.grids{i} = eval(['G.GRID' n]);
0034     GF.gridnames{i} = eval(['G.GRID' n '_NAME']);
0035 end
0036 type = ['GriddedField', num2str(G.DIM)];
0037 
0038

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