function gis_test ( filename )

%*****************************************************************************80
%
%% GIS_TEST reads a GLIMMER GIS data file and prints it out.
%
%  Discussion:
%
%    Although the file contains global attribute information, we
%    do not try to retrieve that.
%
%    Be aware (as I was not) that MATLAB automatically reverses the
%    order of all indices in multiply dimensioned arrays read from
%    a NETCDF file.  Thus, an array which is supposed to be
%    dimensioned THK(TIME,Y1,X1) will be returned instead as
%    THK(X1,Y1,TIME).
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    25 February 2011
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Philippe Huybrechts, Tony Payne,
%    The EISMINT benchmarks for testing ice-sheet models,
%    Annals of Glaciology,
%    Volume 23, 1996, pages 1-14.
%
%    Russ Rew, Glenn Davis, Steve Emmerson, Harvey Davies, Ed Hartne,
%    The NetCDF User's Guide,
%    Unidata Program Center, March 2009.
%
%  Parameters:
%
%    Input, string FILENAME, the name of the GLIMMER NETCDF file to read.
%
  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'GIS_TEST:\n' );
  fprintf ( 1, '  MATLAB version\n' );
  fprintf ( 1, '  Read "%s" and print its contents.\n', filename );

  if ( nargin < 1 )
    fprintf ( 1, '\n' );
    filename = input ( 'Enter the name of the GLIMMER NETCDF file to read.\n' );
  end

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Reading file "%s".\n', filename );

  [ ndims, nvars, ngatts, unlimdimid, level_dim, time_dim, ...
    x0_dim, x1_dim, y0_dim, y1_dim, acab, artm, beta, bheatflx, temp, ...
    thk, time, topg, x0, x1, y0, y1 ] = gis_read ( filename );

  gis_header_print ( ndims, nvars, ngatts, unlimdimid, level_dim, time_dim, ...
    x0_dim, x1_dim, y0_dim, y1_dim, filename );

  if ( 0 )
    gis_data_print ( ndims, nvars, ngatts, unlimdimid, level_dim, time_dim, ...
      x0_dim, x1_dim, y0_dim, y1_dim, acab, artm, beta, bheatflx, temp, ...
      thk, time, topg, x0, x1, y0, y1, filename );
  end
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'GIS_TEST:\n' );
  fprintf ( 1, '  Normal end of execution.\n', filename );

  fprintf ( 1, '\n' );
  timestamp ( );

  return
end
function timestamp ( )

%*****************************************************************************80
%
%% TIMESTAMP prints the current YMDHMS date as a timestamp.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  t = now;
  c = datevec ( t );
  s = datestr ( c, 0 );
  fprintf ( 1, '%s\n', s );

  return
end
