if wctd==1;

% Directions for General Oceanics ctd data prep:                                   
%
%       Once you have obtained the .CNV or .PRS files   
%       from the commercial CTD post-processing software, you  
%       will do the following in the first phase of this script
%
%                       1. Remove header        
%                       2. Remove commas        
%                       3. Rename these .mtl
%                       4. generate a lat/lon header file
%
%       You do this header stripping with a call to fortran routines
%       "cnv2mtl.for" and "prs2mtl.for", respectively.
%
%    str=menu('Want to run the Fortran to strip headers',...
%            'yes','no ');
    disp('Hardcoded to NOT run the head stripping routine.');
    str=2;
    if str==1;
      !prs2mtl.exe
    end;

    disp(' ')
    disp('Data file assumed as follows:')
    disp('  column 1 -> Pressure   ')
    disp('  column 2 -> Temperature')
    disp('  column 3 -> Salinity   ')
    disp('  column 4 -> Radiometry')
    disp('  column 5 -> Fluorometry   ')
    disp('  column 6 -> Transmission   ')
    disp(' ')

    disp('You will need a position file of the eventlog sort output form: ')
    disp('NOTE: Lats & Lons should already be in decimal degree form...')

%   pth=input('Enter pthectory of data: ','s');
    pth='/home3/ocn/jmanning/gbs98/ctd/';

%   Note: I make a CTD header file from the eventlog ascii output
%       and store the info needed in 3 columns ( lat, lon, sta, depth)
     if nsec>1;
       posn=['sec',num2str(ksec)];
     else;
       posn=input('Please enter the lat/lon filename (w/o .dat ext.) . ','s'); 
     end;
     eval(['load ',pth,posn,'.dat'])
     eval(['posn=',posn,';'])
     [ncasts,ncols]=size(posn);
     snum=posn(:,3);
     begin=posn(1,3);
     stop=posn(ncasts,3);
     q=posn(:,1:2);
     inc=1;

elseif wctd==2;

% Directions for Seabird Electronics (model 19) ctd data prep:                                   
%
%   str=menu('Want to run the Fortran to strip headers',...
%            'yes','no ');
%HARDCODE
    inc=1;
    str=2;
     if str==1;
       !cnv2mtl
     end;

     disp(' ')
     disp('Data file:')
     disp('  column 1 -> Pressure   ') 
     disp('  column 2 -> Temperature')
     disp('  column 3 -> Salinity   ')
     disp(' ')

     disp('You will need a position file of the header.dat form: ')
     disp('NOTE: Lats & Lons should be in degrees and decimal minutes...')

     %pth=input('Enter directory of data: ','s');
     pth='c:\gbs99\bongo';

     posn=input('Please enter the lat/lon filename (w/o .dat ext.) . ','s');
%     posn='s1';
     pf=posn;
     eval(['load ',pth,'\',posn,'.dat'])
     eval(['posn=',posn,';'])
     [ncasts,ncols]=size(posn);
     snum=posn(:,2);
     begin=posn(1,2);
     stop=posn(ncasts,2);

% calculate lat/lon in decimal degrees

     for i=1:ncasts
     % HARDCODED TO READ HEADER.DAT STYLE FILE
 	q(i,1)=floor(posn(i,7)/100)+(posn(i,7)-floor(posn(i,7)/100)*100)/60;
 	q(i,2)=floor(posn(i,8)/100)+(posn(i,8)-floor(posn(i,8)/100)*100)/60;
     end

elseif wctd==3;

% Directions for old "report syle" ctd data prep:                                   
%

    disp(' ')
    disp('Data file:')
    disp('  column 1 -> Pressure   ') 
    disp('  column 2 -> Temperature')
    disp('  column 3 -> Salinity   ')
    disp('  column 4 -> Sigmat   ')
    disp(' ')
 
    disp('You will need a position file of the header.dat form: ')
    disp('NOTE: Lats & Lons should be in decimal degrees...')

    %pth=input('Enter directory of data: ','s');
    pth='/home3/ocn/jmanning/wcr/hydro/mtl';

    posn=input('Please enter the lat/lon filename (w/o .dat ext.) . ','s');
    %posn='s1';
    pf=posn;
    eval(['load ',pth,'/',posn,'.dat'])
    eval(['posn=',posn,';'])
    [ncasts,ncols]=size(posn);
    snum=posn(:,1);
    begin=posn(1,1);
    stop=posn(ncasts,1);

  % calculate lat/lon in decimal degrees
    q=posn(:,5:6);

elseif wctd==4;

% Directions for ".data" formatted ctd data prep:                                   
%

    disp('Hardcoded to read "data" form');
    disp(' ')
    disp('Data file:')
    disp('  column 3 -> Pressure   ') 
    disp('  column 5 -> Temperature')
    disp('  column 6 -> Salinity   ')
    disp('  column 7 -> Sigmat   ')
    disp('  column 9 -> lat (dec deg)  ')
    disp('  column10 -> lon (dec deg negative)  ')
    disp(' ')

%   skip the data loading if "posn" exist
    ep=exist('posn');
    if ep==0; 
       %     pth=input('Enter directory of data: ','s');

       cp=computer;

       if cp(1:3)=='SGI';
          pth='/data5/jmanning/ctd/data/';

       else;

          pth='f:\ctd\data\';

       end;   

      posnn=input('Please enter the filename (w/o path or .data ext.) . ','s');
%      posn='oc303';

%     get year from this file name
      yr=posnn(3:4);
      if str2num(yr)<75|str2num(yr)>99;
        yr=input('Input 2-digit year: ','s');
      end;
      disp(['Hardcoded data input file to: ',pth,posnn])
      eval(['load ',pth,posnn,'.data'])
      eval(['posn=',posnn,';'])
    end;

%   spec=menu('How to specify station numbers?','hardcoded','stan.dat','prompted');
    spec=3;   
    if spec==3;
      begin=input('First station? ')
      stop=input('Last station? ');
    elseif spec==2;
      load stan.dat
      begin=stan(ksec,1);
      stop=stan(ksec,2);
    elseif spec==1;
     if ksec==1;
       begin=18;
       stop=11;
     elseif ksec==2;
%       begin=34;
%       stop=29;
      begin=19;
      stop=26;
     elseif ksec==3;
%       begin=75;
%       stop=70;
      begin=34;
      stop=27;
     elseif ksec==4;
%       begin=16;
%       stop=26;
       begin=35;
       stop=42;
     elseif ksec==5;
%       begin=122;
%       stop=126;
      begin=49;
      stop=43;
     elseif ksec==6;
       begin=50;
       stop=55;
     elseif ksec==7;
       begin=61;
       stop=56;
     end;
   end;

%   find latlon associated with these
   id=find(diff(posn(:,11))~=0);
%  add the first station to this id
   id=[1;id+1];
   if begin>stop;
      id2=find(posn(id,11)<=begin&posn(id,11)>=stop);
      q=posn(id(id2(length(id2):-1:1)),9:10);
      yd=posn(id(id2(length(id2):-1:1)),4);
   elseif begin<stop;
     id2=find(posn(id,11)>=begin&posn(id,11)<=stop);
     q=posn(id(id2),9:10);
     yd=posn(id(id2),4);
   elseif begin==stop;
     clear snum;
     snum=input('Enter station number vector: ');
     for ie=1:length(snum);
       id2=find(posn(id,11)==snum(ie));
       q(ie,:)=posn(id(id2),9:10);
       yd(ie,:)=posn(id(id2),4);
     end;
   end;


   if begin~=stop;
%     define station numbers based on "begin", "stop", and what is available in file     
      avail=posn(id(id2),11);
      if begin>stop; inc=-1; else; inc=1; end;
      jj=0;
      clear snum
      for ii=begin:inc:stop;
        for kk=1:length(avail);
          if ii==avail(kk);
            jj=jj+1;
            snum(jj)=ii;
          end;
        end;
      end;
    end;

    ncasts=length(snum);
    

elseif wctd==5;

% Directions for "jgofs" formatted ctd data prep:                                   


    disp(' ')
    disp('Data file assumed as follows:')
    disp('  column 1 -> Pressure   ')
    disp('  column 2 -> Temperature')
    disp('  column 3 -> Salinity   ')
    disp('  column 4 -> Radiometry')
    disp('  column 5 -> Fluorometry   ')
    disp('  column 6 -> Transmission   ')
    disp(' ')


%   pth=input('Enter directory of data: ','s');
    pth='/data1/jgofs/sj9507/';

%    disp('You will need a position file of the .h3 sort output form: ')
%    disp('NOTE: Lats & Lons should already be in decimal degree form...')
%    posn=input('Please enter the lat/lon filename: ','s'); 
    posn=[pth,'sg1c5.h3'];
    id=fopen(posn,'r');
%    scan file until you have data
    disp('Hardcoded to skip 3 lines in the ".h3" file');
    fgetl(id);fgetl(id);fgetl(id);
    disp('Hardcoded to read 68 lines in the ".h3" file');
    clear posn;
    posn=ones(5,68);
    for i=1:68;
      posn(:,i)=fscanf(id,'%f',5);
      fscanf(id,'%s',1);
    end;
    posn=posn';
    snum=posn(:,3);
    begin=input('First station? ');
    stop=input('Last station? ');

%   find latlon associated with these
    if begin>stop;
      id2=find(posn(:,3)<=begin&posn(:,3)>=stop);
      q=[posn(id2(length(id2):-1:1),5) posn(id2(length(id2):-1:1),4)*(-1)];
    else;
      id2=find(posn(:,3)>=begin&posn(:,3)<=stop);
      q=[posn(id2,5) posn(id2,4)*(-1)];
    end;


%   define station numbers based on "begin", "stop", and what is available in file     
    avail=posn(id2,3);
    if begin>stop; inc=-1; else; inc=1; end;
    jj=0;
    clear snum
    for ii=begin:inc:stop;
      for kk=1:length(avail);
        if ii==avail(kk);
          jj=jj+1;
          snum(jj)=ii;
        end;
      end;
    end;
    ncasts=length(snum);
 
elseif wctd==6;

%   necessary for model output (Note: distances already calculated)
%    wop=menu('Which type of nrv file?','single historical','quoddy produced');
    wop=1;
    if wop==1;
      ksec=3;
%     case of single Fundy produced sections ("s3r2nrv.f")
%     we should consider adding "dummy" in vel2nrv" to make consistent      w/rvts
      eval(['load /data5/jmanning/model/bank150/may97/r63f/may97wtf',num2str(ksec+1),'.nrv']);
      eval(['posn=may97wtf',num2str(ksec+1),';']);
%      eval(['load /data5/jmanning/model/bank150/may97/r63/may97_vsec',num2str(ksec+1),'_st.nrv']);
%      eval(['posn=may97_vsec',num2str(ksec+1),'_st;']);
%      eval(['load /data5/jmanning/model/bank150/may97/r63/t66_63.nrv']);
%      posn=t66_63;
      ksec=1;
      id=find(diff(posn(:,2))~=0);
      id=[1;id+1];
      len=[diff(id)];
      len=[len(1);len];
      ncasts=length(id);
      snum=posn(id,1);
%     note: since distance is always "relative to endpoint 2"
%           according to "s3r2nrv.f" code, we may need to reverse
%      posn(:,2)=-1*(posn(:,2)-max(posn(:,2)));
%      here is where I reference the 60m isobath
      disp('Hardocded to  reference to 60m isobath')
%      posn(:,2)=posn(:,2)-21013;
      posn(:,2)=posn(:,2)-4633;
      disp('Hardcoded to use cm/sec units')
      posn(:,5:7)=posn(:,5:7)*100;
   elseif wop==2;

%     case of mulitple quoddy produced sections             
      if fh>=24;fd=fd+1;fh=fh-24;end;
%      eval(['load /data5/jmanning/model/bank150/midmay95/r33/v',num2str(fd),num2str(fh),'.rvt']);
       eval(['load /data5/jmanning/model/bank150/may97/r63/rvt/v',num2str(fd),num2str(fh),'.rvt']);
%      eval(['load /home3/ocn/jmanning/model/hcast/bank150/v',num2str(fd),num2str(fh),'.rvt']);
      eval(['posn=v',num2str(fd),num2str(fh),';']);
      fh=fh+1;
      id=find(diff(posn(:,2))~=0);
      id=[1;id+1];
      len=[diff(id)];
      len=[len(1);len];
      ncasts=length(id);
      snum=posn(id,1);
%     heres where we reverse the sign of quoddy2vrt output
      posn(:,2)=-1*(posn(:,2)-max(posn(:,2)));
%     heres where we make the axis reference to 60m isobath
     posn(:,2)=posn(:,2)-19520;
%      posn(:,2)=posn(:,2);
   end;

elseif wctd==7;
%
% Directions for SEABIRD MODEL 911 formatted ctd data prep:                                   

    disp(' ')
    disp('Data file assumed as follows:')
    disp('  column 1 -> Pressure   ')
    disp('  column 2 -> Temperature')
    disp('  column 3 -> conductivity   ')
    disp('  column 4 -> salinity')
    disp('  column 5 -> Transmission   ')
    disp(' ')


%   pth=input('Enter directory of data: ','s');
    pth='c:\gbs99\ctd\el9904\';

%    disp('You will find a position in each file. ')
%    disp('NOTE: Lats & Lons should already be in dddmm degree form...')
%   snum=input('Enter station number vector: ');
%    snum=[16 17 18 19];
     snum=[2:2:12];
%   snum=[30:38];
%     snum=[17 16 15 13 12]
%    snum=[25:-1:18]
%    snum=[30:-1:26]
    %initialize q
    q=[NaN NaN];
    ncasts=length(snum);
    begin=snum(1);
    stop=snum(ncasts);
%   for each station go into the file and get position (lat/lon)
    for jj=1:ncasts;
      if snum(jj)<10,numz='00';else;numz='0';end;
      id=fopen([pth,'del04',numz,num2str(snum(jj)),'.cnv'],'r');
      str1='NMEA';
      mark=fgetl(id);
      [mark1,rem]=strtok(mark);
      [mark2,rem]=strtok(rem);
      while strcmp(str1,mark2)~=1
         mark=fgetl(id);
         [mark1,rem]=strtok(mark);
         [mark2,rem]=strtok(rem);
      end
      [Lat,rem]=strtok(rem);
      [equals,rem]=strtok(rem);
      [degrees,rem]=strtok(rem);
      [dec_min,rem]=strtok(rem);
      lat=str2num(degrees)+str2num(dec_min)/60;
      %mark=fgetl(id);
      mark=fgetl(id);
      [mark1,rem]=strtok(mark);
      [mark2,rem]=strtok(rem);
      [Lon,rem]=strtok(rem);
      [equals,rem]=strtok(rem);
      [degrees,rem]=strtok(rem);
      [dec_min,rem]=strtok(rem);
      lon=str2num(degrees)+str2num(dec_min)/60;
      q(jj,1)=lat;
      q(jj,2)=lon;
      fclose(id)
      
%      for jk=1:12;fgetl(id);end;
%      lin=fgetl(id);
%      lad=str2num(lin(15:16));lam=str2num(lin(17:21));
%      lin=fgetl(id);
%      lod=str2num(lin(15:16));lom=str2num(lin(17:21));    
%      [q(jj,1),q(jj,2)]=ddmm2dec(lad*100+lam,lod*100+lom);
    end;

elseif wctd==8;    % Julio ADCP option

%    again=menu('Get new ADCP data?','y','n');
    again=1;
    if again==1;
      ttt=input('Enter mth day gmthour to start: ');
      ttp=input('Enter mth day gmthourmin to stop: ');
      jdw1=julian(ttt(:,1),ttt(:,2),95,ttt(:,3))
      jdw2=julian(ttp(:,1),ttp(:,2),95,ttp(:,3))
      sec=input('Which section? (Enter zero if new section) ');

      if sec==0;
        [y]=adcpprof(jdw1,jdw2,2);
      else;
        [y]=adcpprof(jdw1,jdw2,2,sec);
      end;
%      y=[xx yy z bbotd u v uf vf yd];     
      ss=input([' You have ',num2str(length(y)),'values. What subsample "n"? ']);
%      ss=5;
      yadcp=y(1:ss:length(y),:);

%     eliminate bogus (3 knots) velocity
      ibv=find(yadcp(:,5)>-150&yadcp(:,5)<150&yadcp(:,6)>-150&yadcp(:,6)<150)
      yadcp=yadcp(ibv,:);
    end;

elseif wctd==9;    % Charlie Flagg ADCP option

%   again=menu('Get new ADCP data?','y','n');
    again=exist('yad');
    if again==0;

%     note: data comes in ascii (1) or mat (2) form
      wd=2;
      if wd==1;

%       ttt=input('Enter mth day gmthour to start: ');
%       ttt=[5 4 953];
        ttt=[4 1 1301];
%       ttp=input('Enter mth day gmthourmin to stop: ');
%       ttp=[5 4 1903];
        ttp=[4 1 2303];
        jdw1=julian(ttt(:,1),ttt(:,2),95,ttt(:,3))
        jdw2=julian(ttp(:,1),ttp(:,2),95,ttp(:,3))
      
%       execute Charles Hannah's read program
        fname='/data5/jmanning/adcp/en264/EN264.ADCP.o4d';
        [data,gridname,year,ncol,gmt]=read_obs(fname);

%       extract only data of interest
        idi=find(data(:,1)>=jdw1&data(:,1)<=jdw2);
        data=data(idi,:);

%       estimate bottom depths from negative diffs
        idb=find(diff(data(:,4))<0);
        dep(1:idb(1))=data(1:idb(1),4)+15;
        for ikk=2:length(idb);
          dep(idb(ikk-1)+1:idb(ikk))=data(idb(ikk),4)*ones(idb(ikk)-idb(ikk-1),1)+15;
        end;
        dep(idb(length(idb))+1:length(data))=data(length(data),4)*ones(length(data)-idb(ikk),1)+15;

%       estimate filtered velocity using julio's routine
%       calculate depth averaged tide
%       detide w/julios routine which requires time in hours since 1/1/94
        [ut,vt]=detide(data(:,2),data(:,3),data(:,1)*24+365*24);
        uf=data(:,5)-ut;vf=data(:,6)-vt;
        yad=[data(:,2:4) dep' data(:,5:6) uf vf];     

      elseif wd==2;
%       fn='en266/en26624777'
        fn=input('Enter adcp mat filename including subdirectory: ','s');
        eval(['load /data5/jmanning/adcp/',fn])
        lon=lon-360;

%       make corrections to the file points
        ld=length(days);
        lon(ld)=lon(ld-2);
        lat(ld)=lat(ld-2);
        days(ld)=days(ld-2);
        lon(ld-1)=lon(ld-2);
        lat(ld-1)=lat(ld-2);
        days(ld-1)=days(ld-2);

%       estimate filtered velocity using either julio's routine or quoddy
        dtm=menu('What method?','julios','quoddy');
        if dtm==1;

%         Julio's
%         calculate depth averaged tide
%         detide w/julios routine which requires time in hours since 1/1/94
          [ut,vt]=detide(lon,lat,days*24+365*24);
          jj=0;
          for ii=1:length(days);
            for kk=1:length(zc);
              jj=jj+1;
              days2(jj)=days(ii);
              uf(jj)=u(ii,kk)-ut(ii);vf(jj)=v(ii,kk)-vt(ii);
              lon2(jj)=lon(ii);
              lat2(jj)=lat(ii);
              dep(jj)=zc(kk);
              wdep2(jj)=water_depth(kk);
              u2(jj)=u(ii,kk);v2(jj)=v(ii,kk);
            end;
          end;
          yad=[lon2; lat2; dep; wdep2; u2; v2; uf; vf; days2]';
          save /data5/jmanning/adcp/oc303/nb/yad yad;
          clear lon2 lat2 dep wdep2 u2 v2 uf vf days2;

        elseif dtm==2;

%         QUODDY method
%         read the appropriate QUODDY2VRVT output file for each time
%         but do this later inside versec/contadcp & after gridding
%         Note: the following doloop makes a vector out of matrices
          disp(' ')
          disp('generating a yadcp matrix...')
          rotate=-24.4;
          disp(['and rotating u&v by ',num2str(rotate),' degrees']);
          jj=0;
          for ii=1:length(days);
            for kk=1:length(zc);
              jj=jj+1;
              days2(jj)=days(ii);
              lon2(jj)=lon(ii);
              lat2(jj)=lat(ii);
              dep(jj)=zc(kk);
              wdep2(jj)=water_depth(ii);
%             here's where we rotate u&v to cross&along bank
              [u2(jj),v2(jj)]=rot(rotate,u(ii,kk),v(ii,kk));
            end;
          end;
%         need to change sign of Flagg sample depth to negative
%         to conform with other adcp output formats
          dep=-dep;
          yad=[lon2; lat2; dep; wdep2; u2; v2; u2; v2; days2]';
          clear lon2 lat2 dep wdep2 u2 v2 days2;
        end;
      end;

%      ss=input([' You have ',num2str(length(yad)),'values. What subsample "n"? ']);
      ss=2;
      disp('Hardcode Subsample by 2');
      yad=yad(1:ss:length(yad),:);

%     eliminate bogus (3 knots) velocity
      ibv=find(yad(:,5)>-150&yad(:,5)<150&yad(:,6)>-150&yad(:,6)<150);
      yad=yad(ibv,:);
    end;
  
%       bb2mat adcp format

 elseif wctd==10;
%   again=menu('Get new ADCP data?','y','n');
    again=exist('yad');   
    if again==0;
       disp('Loading adcp data...')
%       fn='/data5/jmanning/adcp/oc303/oc303_6tll'
%       fn='/data5/jmanning/adcp/al9805/adcp4tll';
       fn='/data5/jmanning/adcp/al9707/f27tll';
       disp(['loading ',fn]);
       eval(['load ',fn]);
       [nr,nc]=size(yadcp);
       disp(['This has ',num2str(nr),' data points.']);
%       ssr=input('Subsample rate?   ');
       ssr=1;
       disp(['subsampling every ',num2str(ssr),' points...']);
       yad=yadcp(1:ssr:nr,:);

% rid of NaN's
       disp('ridding of nans...');
       idn=find(isnan(yad(:,5))~=1);
       yad=yad(idn,:);

% rotate u & v to be cross & along isobath
       disp(' ')
%       disp('generating a yadcp matrix...')
%       rotate=-24.4;
%       disp(['rotating ',num2str(rotate,' degrees']);
%       [yad(:,5),yad(:,6)]=rot(rotate,yad(:,5),yad(:,6));
       

    end;
       
  elseif wctd==11;

%   case of loading GLOBEC JGOFS ".mat" file
    load /data5/jmanning/ctd/jgofout/oc303/nmfs_ctdsb

%     get rid of NaNs
      id1=find(isnan(cast)~=1);
      cast=cast(id1);
      lat=lat(id1);
      lon=lon(id1);
      press=press(id1);
      temp_ctd=temp_ctd(id1);
      sal_ctd=sal_ctd(id1);

%     limit to desired cast
%     WARNING: NEEDS TO BE MODIFY TO HANDLE NON-SEQUENTIL CTDS

      snum=input('Enter station number vector: ');
      id1=find(cast>=min(snum)&cast<=max(snum));
      cast=cast(id1);
      lat=lat(id1);
      lon=lon(id1);
      press=press(id1);
      temp_ctd=temp_ctd(id1);
      sal_ctd=sal_ctd(id1);


%     find distinct cast headers
      id=find(diff(cast)~=0);
      id=[1;id+1];


      len=[diff(id)];
      len=[len;length(cast)-id(length(id))+1];
      q=[lat(id) lon(id)];
      ncasts=length(q);


 elseif wctd==12;
%       Wiebe's "curtain" format
%   again=menu('Get new ADCP data?','y','n');
    again=exist('yad');   
    if again==0;
       disp('Loading acoustic data...')
       fn='/data5/jmanning/adcp/al9707/andy2/leg';
       disp(['loading ',fn]);
       eval(['load ',fn]);
       [nr,nc]=size(leg4);

%      for each time (column) build a set of data
       ssr=10;
       disp(['Warning: Subsampled the acoustics by ',num2str(ssr)]); 
       for kk=1:ssr:nc;
         bs=10*log10(leg4(6:55,kk));
         if kk==1;
           yad=[leg4(2,kk)*ones(50,1) leg4(3,kk)*ones(50,1) [-1:-1:-50]' ones(50,1) bs bs bs bs leg4(1,kk)-1+4/24*ones(50,1)  leg4(6:55,kk)];
         else;
           yad1=[leg4(2,kk)*ones(50,1) leg4(3,kk)*ones(50,1) [-1:-1:-50]' ones(50,1) bs bs bs bs leg4(1,kk)-1+4/24*ones(50,1)  leg4(6:55,kk)];
           yad=[yad; yad1];
         end;
       end;

    end;


  end;

if wctd==9|wctd==10|wctd==12;

%      specify transect by yearday
%       aut=menu('How to specify times per transect?','hardcoded','userprompt')
       aut=1;
    
       if aut==1;
%        may98 sections
%         sst=[124.47  124.55  124.577 124.641 124.662 124.710 124.736 124.826]; %deploy#1
%          sst=[125.079 125.112 125.125 125.161  125.166  125.211 125.221 125.259]; %deploy#3
%          sst=[125.557 125.591 125.604 125.642 125.645 125.687 125.702 125.732]; %deploy#4
%        may97 sections
%         sst=[128.179  128.562 128.625  129.062 129.146  129.549 129.6146 129.9688 130.0375 130.3896 130.442 130.724];
%        Aug97 sections
%         sst=[177.6049 177.6167 177.6241 177.6336 177.6407 177.6512 177.6587 177.6680 177.6778 177.6866 177.6938 177.7028];
%         sst=[ 177.6587 177.6680 177.6778 177.6866 177.6938 177.7028];
         sst=[177.6587 177.6680]
         miny=sst(ksec*2-1);
         maxy=sst(ksec*2);
       else;
%         miny=input('min yrday0_gmt?');
          miny=177.67777
%          miny=128.625
%          miny=124.47;
%          miny=131.5043
%         maxy=input('max yrday0_gmt?');
          maxy=177.6875
%         maxy=129.062
%          maxy=131.5687
%          maxy=124.55;
       end;

       id=find(yad(:,9)>=miny&yad(:,9)<=maxy);
       yadcp=yad(id,:);

end; 