function florida_census_reader_test ( )

%*****************************************************************************80
%
%% FLORIDA_CENSUS_READER_TEST tests FLORIDA_CENSUS_READER.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    30 June 2016
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'FLORIDA_CENSUS_READER_TEST:\n' );
  fprintf ( 1, '  FLORIDA_CENSUS_READER reads a file "florida_census.csv"\n' );
  fprintf ( 1, '  and returns the longitude, latitude, populiation and\n' );
  fprintf ( 1, '  census district ID form several thousand sites.\n' );
%
%  Read the longitude, latitude and name of each city.
%
  filename = 'florida_census.csv';
  [ lon, lat, pop, geoid ] = florida_census_reader ( filename );
%
%  Get the size of the data.
%
  n = length ( lon );
%
%  Print some of the data.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, '       #        GEOID       POP       Longitude        Latitude\n' );
  fprintf ( 1, '\n' );
  for i = 1 : n
    if ( i <= 10 || n - 9 <= i )
      fprintf ( 1, '%8d  %11d  %8d  %14.6f  %14.6f\n', i, geoid(i), pop(i), lon(i), lat(i) );
    elseif ( i == 11 )
      fprintf ( 1, '........  ...........  ........  ..............  ..............\n' );
    end
  end
%
%  Get some stats.
%
  pop_min = min ( pop(1:n) );
  pop_max = max ( pop(1:n) );
  pop_sum = sum ( pop(1:n) );
  pop_avg = pop_sum / n;
  lon_min = min ( lon(1:n) );
  lon_max = max ( lon(1:n) );
  lat_min = min ( lat(1:n) );
  lat_max = max ( lat(1:n) );

  fprintf ( 1, '\n' );
  fprintf ( 1, '     Min               %8d  %14.6f  %14.6f\n', pop_min, lon_min, lat_min );
  fprintf ( 1, '     Avg               %8d\n', floor ( pop_avg ) );
  fprintf ( 1, '     Max               %8d  %14.6f  %14.6f\n', pop_max, lon_max, lat_max );
  fprintf ( 1, '     Sum               %8d\n', pop_sum );
%
%  Save a cut down version of the file.
%
  filename = 'florida_census.txt';
  output = fopen ( filename, 'wt' );
  for i = 1 : n
    fprintf ( output, '  %d', geoid(i) );
    fprintf ( output, '  %d', pop(i) );
    fprintf ( output, '  %g', lon(i) );
    fprintf ( output, '  %g', lat(i) );
    fprintf ( output, '\n' );
  end
%
%  Close the file.
%
  fclose ( output );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Created a cut-down geoid/pop/lon/lat file: "%s"\n', filename );
  
  return
end

