function [url,loaddodsbool,infotext] = gbrlctdu ...
         (getarchive, getranges, getmode, getvariablelist, getserverlist, passtimes, passdepths, whichurl)
%
%    This function will build gbrlctd file names and return infotext and url to the browser
%

% The preceding empty line is important
% $Log: gbrlctdu.m,v $
% Revision 1.4  1999/07/21 15:35:54  dbyrne
%
%
% Corrected language in Acknowledgements.  --dbyrne 99/07/21
%
% Revision 1.3  1999/06/24 19:05:01  kwoklin
% Change file name of nbnerr.m. Fix some display bugs, define precision level
% of lat/lon/depth/time, and fix some more bugs in globec files.        klee
%
% Revision 1.2  1999/06/01 16:12:38  dbyrne
%
%
% quick bug fixes for AGU -- dbyrne 99/06/01
%
% Revision 1.1  1999/06/01 07:10:33  dbyrne
%
%
% Moved up from kleedata/
%
% Revision 1.3  1999/05/28 22:53:05  kwoklin
% Point to new server for all jgofs datasets. Update getjgsta on loaddods.
% Fix infotext for all gb geturl files. Fix transmissivity for some gb
% files. Modify some variable names on gb files.       klee
%

% $Id: gbrlctdu.m,v 1.4 1999/07/21 15:35:54 dbyrne Exp $
% klee 04/01/99

if exist(getarchive) == 2   
  eval(getarchive)
else
  dodsmsg('Metadata not found!')
  return
end

url = []; infotext = []; text = []; Constraint = [];
loaddodsbool = 1;
URLdepth = []; URLlat = []; URLlon = [];
yearname = deblank(DodsName1(1,:));
monthname = deblank(DodsName1(2,:));
dayname = deblank(DodsName1(3,:));

URLdepth = ['&',DepthName,'>=',num2str(passtimes(whichurl,5),6),'&',DepthName,'<=', num2str(passtimes(whichurl,6),6)];
URLlat = ['&',LatitudeName(1,:),'>=',num2str(passtimes(whichurl,7),4),...
          '&',LatitudeName(1,:),'<=',num2str(passtimes(whichurl,8),4)];
% for [-180, 180]  
URLlon = ['&',LongitudeName(1,:),'>=',num2str(passtimes(whichurl,9),4),...
          '&',LongitudeName(1,:),'<=',num2str(passtimes(whichurl,10),4)];
Constraint = [Constraint, URLdepth, URLlat, URLlon]; 

StartYear = passtimes(whichurl,1);
StartMonth = passtimes(whichurl,2); 
StartDay = passtimes(whichurl,3); EndDay = passtimes(whichurl,4);
Constraint = [Constraint, '&',yearname,'=',num2str(StartYear),'&',monthname,'=',num2str(StartMonth),...
              '&',dayname,'>=',num2str(StartDay), '&',dayname,'<=', num2str(EndDay)];

returned_var = [];
for i = 1:size(getvariablelist,1)
  returned_var = [returned_var, dods_dbk(getvariablelist(i,:))];  
  if i < size(getvariablelist,1)
    returned_var = [returned_var, ','];
  end
end
returned_var = [returned_var, ',', deblank(OptionalVariables(1,:))];
url = [Server, '?', returned_var, Constraint];

tmpvar = ['?cruiseid,station,year_s,month_s,day_s'];
tmptext = ['loaddods ''', Server, tmpvar, Constraint, ''''];
infotext = sprintf('%s\n%s\n%s\n%s\n%s\n%s\n','   ',...
                  ['"Cruiseid" is stored as a character variable. Searches on character variables',...
                  ' are not supported by this version of the DODS Matlab GUI.',...
                  '   ',...
                  '** To get Cruise Id information ** ',...
                  'please issue the ''loaddods'' command from the MATLAB prompt line, using a URL like this:',...
                  '   '], ...
                  ['URL = ',Server], ...
                  ['Proj = ',tmpvar] ,...
                  ['Sel = ',Constraint], ...
                  ['   '],...
                  ['They will return a set of date, depth and cruiseid vectors corresponding to each other.']);

return

  

  

  
