% copyright 2003 by DGL at Brigham Young University
%
% plot slice shapes produced by sea_RT_ave1 (slices near the equator)
%

if ~exist('slice')
  load slice.DAT
end
  
pnt=9+2*[0:7 0];
rad=0.5;

for ib=0:1,
  for ascend=0:1,
    figure(ib+2*ascend+1)
    clf
    hold on
    
    for ang=0:45:(360-45)
      if ascend == 1
	lon_off=rad*cos((-ang+90)*pi/180);
	lat_off=rad*sin((-ang+90)*pi/180);
      else
	lon_off=-rad*cos((-ang+90)*pi/180);
	lat_off=-rad*sin((-ang+90)*pi/180);  
      end
      ind=find(slice(:,6)==ib & slice(:,2)==ascend);
      mv=min(abs(slice(ind,5)-ang));
      ind=find(slice(:,6)==ib & slice(:,2)==ascend & abs(slice(:,5)-ang)==mv);
  
      for islice=1:8
	lon=slice(ind(islice),pnt)-slice(ind(islice),7)+lon_off;
	lat=slice(ind(islice),pnt+1)-slice(ind(islice),8)+lat_off;
	plot(lon,lat)
      end
    end
    if ascend == 1
      myarrow([0, 0]',[0.3*rad*cos((90+7)*pi/180),0.3*rad]');
    else
      myarrow([0, 0]',[0.3*rad*cos((90+7)*pi/180),-0.3*rad]');
    end
    hold off
    xlabel('Longitude (deg)')
    ylabel('Lattitude (deg)')
    
    if ascend==1
      if ib==0
	title('H-pol Inner Beam, Ascending')
	print -djpeg AHsliceslices.jpg
      else
	title('V-pol Outer Beam, Ascending')
	print -djpeg AVsliceslices.jpg
      end
    else
      if ib==0
	title('H-pol Inner Beam, Descending')
	print -djpeg DHsliceslices.jpg
      else
	title('V-pol Outer Beam, Descending')
	print -djpeg DVsliceslices.jpg
      end
    end
    
  end
end






