% routine to determine the moon phase of tide

%hmp=input('how many plots?');
hmp=5;

% fyr=input('First year?');
fyr=92;

for i=1:hmp;
  
  subplot(hmp,1,i);
  
  yr=fyr+i-1;
  if yr==96;yr=97;end;
% generate a yearday function
  yd1=julian(5,1,yr,0);
  yd=yd1:1/24:yd1+31;
  hrs94=(yr-94)*365*24;
  leapyr=ceil((yr+59/365-96)/4)*24;
  tothr=yd*24+hrs94+leapyr;
  [u,v]=detide(-67.9*ones(length(tothr),1),40.8*ones(length(tothr),1),tothr');
  plot(yd,v*100,'color','w');
  hold on;
  if yr==92;plot([139 141],[0 0],'linewidth',6,'color','r');
  elseif yr==93;plot([138 140],[0 0],'linewidth',6,'color','r');
  elseif yr==94;plot([138 140],[0 0],'linewidth',6,'color','r');
  elseif yr==95;plot([131 134],[0 0],'linewidth',6,'color','r');
  elseif yr==97;plot([128 131],[0 0],'linewidth',6,'color','r');
  end;
  text(127,0,['19',num2str(yr)],...
    'horizontalalignment','left','color','g','fontsize',20);
  axis([126 142 -60 60]);
  set(gca,'ytick',[-60:20:60],'ygrid','on');
  
  if i~=hmp;
    set(gca,'xticklabels',[],'yticklabels',[]);
  else;
    yd2calab(yr);
  end;
  subpos(i,hmp);
end;


end;  