function [times, pass_times, url] = nscat30cat(catalog_server, time, ranges)
%----------------------------------------------------------------------------
%
% Consult the nscat30 catalog server to find images that fall within the time
% range given by the user.
%
% Formal parameters:
% catalog_server: URL of the catalog server.
% time: The time range of the data set.
%
% The return values are:
% times: The time in years (and fractions, see note below) for all hits.
% pass_times: This is a matrix of time with the year and day
% url: dummy return value to satisfy cat function type signature.
%
% $Id: nscat30cat.m,v 1.8 1998/11/09 20:26:57 dbyrne Exp $
%
%----------------------------------------------------------------------------

% $Log: nscat30cat.m,v $
% Revision 1.8  1998/11/09 20:26:57  dbyrne
% *** empty log message ***
%
% Revision 1.5  1998/10/23 15:26:07  root
% updating NSCAT 3.0
%
% Revision 1.4  1998/10/22 18:30:29  root
% updating.
%
% Revision 1.3  1998/09/13 15:41:00  root
% meshed James' changes.
%
% Revision 1.5  1998/09/13 02:29:01  dbyrne
% Modified so it loads nscat30_cat.mat, not nscat30_cat3.mat
%
% Revision 1.4  1998/07/13 20:29:30  jimg
% Fixes from the final test of the new build process
%
% Revision 1.3  1998/05/14 21:59:35  dbyrne
% Many small fixes.  DAB 98/05/14
% $Log: nscat30cat.m,v $
% Revision 1.8  1998/11/09 20:26:57  dbyrne
% *** empty log message ***
%
% Revision 1.5  1998/10/23 15:26:07  root
% updating NSCAT 3.0
%
% Revision 1.4  1998/10/22 18:30:29  root
% updating.
%
% Revision 1.3  1998/09/13 15:41:00  root
% meshed James' changes.
%
% Revision 1.2  1998/09/09 15:04:30  dbyrne
% Eliminating all global variables.
%
% Revision 1.1  1998/05/17 14:18:08  dbyrne
% *** empty log message ***
%
% Revision 1.1  1997/12/11 06:20:45  jimg
% Switched to full archive of data. Added catalog server.
%

% N.B. ranges are space and time constraint info.
load nscat30_cat.mat
times_cat = day2year(pass_times_cat(:,2)+0.5,pass_times_cat(:,1));

pass_times = [];
times = [];
% dummy initialization to match other Cat_m_Files
% url = [];
% URL is a STRING!
url = '';
% Get beginning and ending of time interval.

start_time = max(time(1), ranges(4,1));
end_time = min(time(2), ranges(4,2));

start_year = floor(start_time);
start_day = year2day(start_time, start_year);

end_year = floor(end_time);
end_day = year2day(end_time, end_year);

ncat = size(times_cat,2);
i = find(times_cat > start_time & times_cat < end_time);
times = times_cat(i);
pass_times = pass_times_cat(i,:);
% I don't understand this; is num_passes a global? If so, how does its value
% get `passed' back without a `global ...' declaration? 6/8/98 jhrg
% No one else understands this either.  I bet it's an artifact -- dbyrne 98/09/13 
%num_passes = j;

return;
