function [varsize, return_status] = nc_varsize(ncfile, varname)
% NC_VARSIZE:  return the size of the requested netncfile variable
%
% USAGE: [varsize, status] = nc_varsize( netncfile_file, variable )
%
% PARAMETERS:
%   Input:
%      ncfile:  path to netncfile file
%      var:  name of requested variable
%   Output:
%      varsize: size of requested variable 
%      status:  -1 if function failed, 0 if ok
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% $Name:  $
% $Id: nc_varsize.m,v 1.1 2005/06/29 16:07:00 brian Exp $
% AUTHOR:  johnevans@acm.org
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%






%
% assume failure until success is known
varsize = [];
return_status = -1;

% Show usage if too few arguments.
%
if nargin~=2 
	fprintf ( 2, '%s:  Must have two input arguments.\n', mfilename  );
	return
end

if ~strcmp(class(ncfile),'char')
	fprintf ( 2, '%s:  Both inputs must be character.\n', mfilename  );
	return
end
if ~strcmp(class(varname),'char')
	fprintf ( 2, '%s:  Both inputs must be character.\n', mfilename  );
	return
end


[v, status] = nc_getvarinfo ( ncfile, varname );
if ( status < 0 )
	fprintf ( 2, '%s:  nc_getvarinfo failed on %s, %s.\n', mfilename, ncfile, varname );
	return
end

varsize = v.Size;
return_status = 0;



