function [urlarray] = derefurl(urls);

%
% This function will deref DODS_URL vector into string matrix. 
% Each individual file/image name is not necessarily to be of 
% the same length.
%
% Formal parameter
% urls: DODS_URL from invertory search.
%
% Returned value
% urlarray: a string matrix of urls.
%  

%
% $Log: derefurl.m,v $
% Revision 1.4  2000/04/14 18:27:16  kwoklin
% Adding nmfsctd.  Data in usgstseries are revised.
% Cat files changes accordingly.   klee
%
% Revision 1.3  2000/03/28 19:04:54  dbyrne
%
%
% Commented out 'disp()' messages, which did not conform to the user-selectable
% pop/workspace option.  -- dbyrne 00/03/28
%
% Revision 1.2  1999/11/23 18:12:15  kwoklin
% R. Signell's time-series and profile data files.   klee
%
% Revision 1.1  1999/06/01 07:10:27  dbyrne
%
%
% Moved up from kleedata/
%
% Revision 1.2  1999/05/28 17:32:48  kwoklin
% Add all globec datasets. Fix depth representation for all globec datasets
% and nbneer dataset. Fix frontal display for htn and glkfront. Make use of
% getjgsta for all jgofs datasets. Point usgsmbay to new server. Point htn,
% glk, fth and prevu to new FF server.                                 klee
%

% $Id: derefurl.m,v 1.4 2000/04/14 18:27:16 kwoklin Exp $
% klee 05/17/99

urlblank = [];
urlarray = [];
space = ' ';
urlblank = find(isspace(urls));
urlbdiff = diff(urlblank);
maxbdiff = max(max(urlbdiff), urlblank(1)-1);
j=1;
if size(urls,2) > 1
  dispstring = sprintf('%s','You are requesing ',num2str(length(urlblank)),' file(s)/image(s). Please wait for dereferencing.');
%  disp(dispstring);
else
  dispstring = sprintf('%s','You are requesing 0 file/image during this time period.');
%  disp(dispstring);
  break;
end
for i = 1:length(urlblank)
  urlarray = [urlarray; [urls(j:urlblank(i)-1),space*ones(1,maxbdiff-(urlblank(i)-j-2))]];
  %urlarray = str2mat(urlarray, urls(j:urlblank(i)-1));   % str2mat is too too slow!
  j = urlblank(i) + 1;
  if rem(i,500) == 0
%    disp('Please wait for dereferencing the returned urls');
  end
end
%disp('... done ...');
