function nc_create_empty ( ncfile, mode )
% NC_CREATE_EMPTY:  creates an empty netCDF file 
%
% USAGE: nc_create_empty ( ncfile, mode );
%
% PARAMETERS:
% Input:
%     ncfile:
%         netCDF file to be created
%     mode:
%         Optional.  If not provided, NC_CLOBBER is assumed.
%
% EXAMPLE:
% Suppose you wish to create a netCDF file with large file support 
% (LFS).  This would do it.
%
%     >> my_mode = bitor ( nc_clobber_mode, nc_64bit_offset_mode );
%     >> nc_create_empty ( 'test.nc', my_mode );
%
%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% $Id:$
% $LastChangedDate:$
% $LastChangedRevision:$
% $LastChangedBy:$
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

if ( nargin < 1)
	error ( '%s:  must provide at least one input argument.\n', mfilename );
end

%
% Set the default mode if necessary.
if nargin == 1
	mode = nc_clobber_mode;
end

if ( nargin > 2 )
	error ( '%s:  too many input argument.\n', mfilename );
end

[ncid, status] = mexnc ( 'CREATE', ncfile, mode );
if ( status ~= 0 )
	ncerr = mexnc ( 'STRERROR', status );
	error ( '%s:  CREATE failed on %s, error message ''%s''.\n', mfilename, ncfile, ncerr  );
end

status = mexnc ( 'CLOSE', ncid );
if ( status ~= 0 )
	ncerr = mexnc ( 'STRERROR', status );
	error ( '%s:  CLOSE failed on %s, error message ''%s''.\n', mfilename, ncfile, ncerr  );
end

