s1 = read_icq4_nomex('../CRUISE_Q5.3/STF030.icq5')

Z = s1.ZMID;
UZ = s1.UZMID;
VZ = s1.VZMID; 

g = loadgrid('/home/cstock/Data/meshes/stw2/stw2')
titl_old = ['GMT Date:',int2str(s1.month),'/',int2str(s1.day),'/2004, 5m currents']
% determine the start of the averaging period
start_sec = s1.curr_seconds - (12.4206*60*60);
if start_sec < 0
  start_day = s1.day - 1;
  start_hour = round((86400 + start_sec)/86400*24);
  start_mon = s1.month
  if start_day == 0
     start_mon = s1.month - 1;
     start_day = 31;
  end
else
  start_day = s1.day;
  start_mon = s1.month;
  start_hour = round((start_sec/86400)*24); 
end
  
end_hour = round(s1.curr_seconds/86400*24);
titl = ['Averaging period start (GMT): ',int2str(start_mon),'/',int2str(start_day),'/',int2str(s1.year),' hour: ',int2str(start_hour),' End: ',int2str(s1.month),'/',int2str(s1.day),'/',int2str(s1.year),' hour: ',int2str(end_hour)]

% vertical integration over top 10 meters
e=[g.e,g.e(:,1)]';
% choose an axis (close up)
ax2 = 1.0e+05 *[0.75  3.25    0.75    2.75];
ax1 = 1.0e+05 *[0 5.0 -0.75 4.0];
x =2.3684e+05;
y =9.0e+04;
x2 = 2.4e5;
y2 = 1.0e5;

U5 = hslice_1(Z,UZ,-5);
V5 = hslice_1(Z,VZ,-5);
a=50000;

clf;
axes('position',[0.05 0.1 0.7 0.8]);
hold on;axis equal;
quiver(g.x,g.y,a*(U5),a*(V5),0,'k');
axis equal;
set(gca,'xtick',[]);
set(gca,'ytick',[]);
axis(ax1);
title(titl)
quiver(x,y,a*.25,0,0,'k');
text(x,y-25000,'.25 m/s');
axis off

axes('position',[0.4 0.1 0.4 0.4]);
hold on;axis equal;
quiver(g.x,g.y,a*(U5),a*(V5),0,'k');
axis equal;
set(gca,'xtick',[]);
set(gca,'ytick',[]);
axis(ax2);
quiver(x2,y2,a*.25,0,0,'k');
text(x2,y2-25000,'.25 m/s');
axis off

load stations_decimal.txt;
sta_dat = stations_decimal;
[xsta ysta] = ll2xy(sta_dat(:,2),sta_dat(:,1));
plot(xsta,ysta,'o')
