Home > atmlab > geoplots > gmt > gmt_get_nctype.m

gmt_get_nctype

PURPOSE ^

GMT_GET_NCTYPE Returns the netcdf type of var

SYNOPSIS ^

function nc_type = gmt_get_nctype(variable)

DESCRIPTION ^

 GMT_GET_NCTYPE  Returns the netcdf type of var
 Returns the netcdf type of var

 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_nctype.m

SOURCE CODE ^

0001 function nc_type = gmt_get_nctype(variable)
0002 % GMT_GET_NCTYPE  Returns the netcdf type of var
0003 % Returns the netcdf type of var
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 'uint8' ,'UBYTE',...
0018 'uint16','USHORT',...
0019 'uint32','UINT',...
0020 'int64' ,'INT64',...
0021 'uint64','UINT64');
0022 
0023 if isfield(str,class(variable))
0024     nc_type = str.(class(variable));
0025 else
0026     error(sprintf('gmtlab:%s:input',mfilename),...
0027         'Class %s has no corresponding netcdf type',class(variable))
0028 end
0029

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