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

% The preceding empty line is important
% $Log: gbnfdriu.m,v $
% Revision 1.5  2000/03/31 20:53:48  kwoklin
% Add to handle falty loaddods call.    klee
%
% Revision 1.4  1999/07/21 15:35:53  dbyrne
%
%
% Corrected language in Acknowledgements.  --dbyrne 99/07/21
%
% Revision 1.3  1999/06/24 19:05:00  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:37  dbyrne
%
%
% quick bug fixes for AGU -- dbyrne 99/06/01
%
% Revision 1.1  1999/06/01 07:10:31  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: gbnfdriu.m,v 1.5 2000/03/31 20:53:48 kwoklin 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,:));
dayname = deblank(DodsName1(2,:));

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

StartYear = passtimes(whichurl,1);
StartYrday = passtimes(whichurl,2);
EndYrday = passtimes(whichurl,3);
Constraint = [Constraint, '&',yearname,'=',num2str(StartYear),'&',dayname,'>=', num2str(StartYrday,7), ...
                          '&',dayname,'<=', num2str(EndYrday,7)];

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 = ['?cruise_id,year,yrday0_gmt,'];
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

  

  

  
