Home > atmlab > geoplots > gmt > gmt_get_nctype3.m

gmt_get_nctype3

PURPOSE ^

GMT_GET_NCTYPE3 Returns the netcdf type of var

SYNOPSIS ^

function nc_type = gmt_get_nctype3(variable)

DESCRIPTION ^

 GMT_GET_NCTYPE3  Returns the netcdf type of var
 Returns the netcdf type of var for necdf3

 OUT nc_type    string containing the netcdf type
 IN  var    input data whos type will be determined

 Created by Salomon Eliasson
 $Id: gmt_get_nctype.m 6862 2011-04-17 20:27:55Z seliasson $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

gmt_get_nctype3.m

SOURCE CODE ^

0001 function nc_type = gmt_get_nctype3(variable)
0002 % GMT_GET_NCTYPE3  Returns the netcdf type of var
0003 % Returns the netcdf type of var for necdf3
0004 %
0005 % OUT nc_type    string containing the netcdf type
0006 % IN  var    input data whos type will be determined
0007 %
0008 % Created by Salomon Eliasson
0009 % $Id: gmt_get_nctype.m 6862 2011-04-17 20:27:55Z seliasson $
0010 
0011 
0012 str = struct('logical','BYTE','int8','BYTE',...
0013 'int16' ,'SHORT',...
0014 'int32' ,'INT',...
0015 'single','FLOAT',...
0016 'double','DOUBLE',...
0017 'int64' ,'INT64');
0018 
0019 notsupported={'uint8','uint16','uint32','uint64'};
0020 
0021 assert(~ismember(class(variable),notsupported),['atmlab:' mfilename ''],....
0022     'data type: ''%s'' is not supported by netcdf3',class(variable))
0023 
0024 if isfield(str,class(variable))
0025     nc_type = str.(class(variable));
0026 else
0027     error(sprintf('gmtlab:%s:input',mfilename),...
0028         'Class %s has no corresponding netcdf type',class(variable))
0029 end
0030

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