%   function gbox=bound(bounds,[x],[y]);
%
%   to define an x,y axis dependent on desired method
%   bounds=1 > min/max
%          2 > hardcoded in bounds
%          3 > click corners
    
    function gbox=bound(bounds,x,y);

    if bounds==1;
      [xrg,xma,xmx]=rangejm(x);
      [yrg,yma,ymx]=rangejm(y);
      gbox=[xma-xrg/10 xmx+xrg/10 yma-yrg/10 ymx+yrg/10];
      disp(['Hardcoded gbox to ',...
      num2str(gbox(1)),' ',num2str(gbox(2)),' ',num2str(gbox(3)),' ',num2str(gbox(4)),' ']);
    elseif bounds==2;
      gbox=[-68.75 -67.5 40.6 41.2];
    elseif bounds==3;
      plot([min(x) max(x)],[min(y) max(y)],'+');
      h=axis;
%     prompt user to click corners of desired map
      rangey=h(4)-(h(4)-h(3))/10;
      texth=text(h(1),rangey,' Click 2 Corners','Color','g');
      pause(2);
      set(texth,'Visible','off');
      [xx yy]=ginput(2);
      gbox=[xx(1) xx(2) yy(1) yy(2)];
      grid off;
    end;
