function [ut,vt,ydt]=maktide(ts);
%
% for generating a time series of tide from Julio's "detide.m" routine
%
% where  ts = yeardays of interest
%       
% define the area of interest (single lat/lon point)
%lat=input('Enter Latitude in decimal degrees (41.87, for example): ');
%lon=input('Enter Longitude in decimal degrees (67.90, for example): ');
%lon=lon*(-1);
disp('HARDCODED lat/lon');
lat=41.93
lon=-69.93

% enter start mth, day, yr
%mth=input('month? ');
%day=input('day? ');
%yr=input('yr? ');
%hr=input('GMT hour?');
disp('HARDCODED start time')
mth=5;
day=13;
yr=95;
hr=0000;

% calculate yearday
styd=julian(mth,day,yr,hr);

% calculate hours from 1/1/94
lpd=floor(abs((yr-94)/4));
disp([num2str(lpd),' leapyears accounted for']);
stc=styd*24+(yr-94)*365*24+lpd*24;

% enter end mth, day, yr
%mth=input('month? ');
%day=input('day? ');
%yr=input('yr? ');
%hr=input('hour?');
disp('HARDCODE end time')
mth=5;
day=13;
yr=95;
hr=2400;

% calculate yearday
etc=julian(mth,day,yr,hr);

% calculate hours from 1/1/94
etc=etc*24+(yr-94)*365*24+lpd*24;

% note that if an time sereis (yearday) is input then 
% we use that, if not we generate a time series.
if nargin>0;

% make this input time series in "hours"
  tsh=ts*24+(yr-94)*365*24;

% subtract 24 hours for leap years
  kount=0;
  for kk=yr:1:92;
    if rem(92-kk,4)==0;
      kount=kount+1;
    end;
  end;
  tsh=tsh-kount*24;

  for k=1:length(ts);
    [ut(k),vt(k)]=detide(lon,lat,tsh(k));
    ydt(k)=(tsh(k)-((yr-94)*365*24))/24;
  end;
% add 24 hours for leap years
  ydt=ydt+kount;


  
else;
% generate tidal data where "tinc" is desired interval in hours
  disp('HARDCODED time int')
  tinc=0.50;
  for k=1:floor(etc-stc)*(1/tinc);
    [ut(k),vt(k)]=detide(lon,lat,stc+k*tinc-tinc);
    ydt(k)=styd+(k*tinc-tinc)/24;
  end;
end;

% plot results
subplot(3,1,1);
plot(ydt,ut*100);
title('east/west tide')
set(gca,'xticklabels',[' ']);
subplot(3,1,2);
plot(ydt,vt*100);
title('n/s tide')
ylabel('cm/s');
xlabel(['GMT Yearday 19',num2str(yr)]);
subplot(3,1,3);
[x,y]=provecxy(ut*100,vt*100,tinc*3600,ydt,range(ydt)/5*24*3600);
plot(x,y);
axis('equal');
disp('press return to continue')
keyboard




