function y=windplot(tc,u,v,year)
fpath=['/data/span9/bahr/perlprogs/'];
mond=[0,32,60,91,121,152,182,213,244,274,305,335,366];
if(rem(year,4)==0),
	leap=[0 0 1 1 1 1 1 1 1 1 1 1 1];
	ileap=1;
else,
	leap=[0 0 0 0 0 0 0 0 0 0 0 0 0];
	ileap=0;
end
mond=mond+leap;
eval(['load ',fpath,'mooringid.dat']);
mid=mooringid;
fid=fopen([fpath,'wind.ppl'],'w');
fprintf(fid,'pltype,0\n');
fprintf(fid,'pltnme,%swind.meta\n',fpath(:));
fprintf(fid,'dfltfnt,@tr\n');
fprintf(fid,'window,on\n');
fprintf(fid,'size,11.0,11.0\n');
fprintf(fid,'axlen,6.2,4.9\n');
fprintf(fid,'limits,-99,XLE,on\n');
fprintf(fid,'limits,-99,YLE,on\n');
fprintf(fid,'axlabp,-1,-1\n');
fprintf(fid,'axlint,1,1\n');
fprintf(fid,'axnmtc,1,1\n');
fprintf(fid,'axset,1,1,1,1\n');
fprintf(fid,'taxis,10,on\n');
fprintf(fid,'txnmtc,-1\n');
fprintf(fid,'txlint,24,2\n');
fprintf(fid,'txtype,DAYS,HR\n');
% Now compute the start and stop time limits for the plot
%yy=rem(year,100);
yy=year;
tlow=min(tc);
thig=max(tc);
if(thig-tlow) < 7,
	thig=tlow+7;
end
if tlow < 0,
	if ileap==1,
		tlow=tlow+366;
	else,
		tlow=tlow+365;
	end
end
for i=1:12,
	if (thig >mond(i))&(thig <= mond(i+1)),
		moh=i;
		if i==1,
			dah=fix(thig-mond(i));
		else,
			dah=fix(thig-mond(i))+1;
		end
		hoh=rem(thig,1);
		hoh=fix(hoh*24);
	end
	if (tlow > mond(i))&(tlow <= mond(i+1)),
		mol=i;
		if i==1,
			dal=fix(tlow-mond(i));
		else,
			dal=fix(tlow-mond(i))+1;
		end
		hol=rem(tlow,1);
		mil=hol;
		hol=fix(hol*24);
		mil=mil*24-hol;
		mil=fix(mil*60);
	end
end
if(moh==1)&(dah < 7),
	yo=year-1;
%	yo=rem(yo,100);
else,
	yo=yy;
end
if mol < 10,
	mol=['0',num2str(mol)];
else,
	mol=num2str(mol);
end
if moh < 10,
	moh=['0',num2str(moh)];
else,
	moh=num2str(moh);
end
if dal < 10,
	dal=['0',num2str(dal)];
else,
	dal=num2str(dal);
end
if dah < 10,
	dah=['0',num2str(dah)];
else,
	dah=num2str(dah);
end
if hol < 10,
	hol=['0',num2str(hol)];
else,
	hol=num2str(hol);
end
if hoh < 10,
	hoh=['0',num2str(hoh)];
else,
	hoh=num2str(hoh);
end
if mil < 10,
	mil=['0',num2str(mil)];
else,
	mil=num2str(mil);
end
tstar=['W',num2str(yo),mol,dal,hol,'00'];
tstop=['W',num2str(yy),moh,dah,hoh,'00'];
tstart=['W',num2str(yo),mol,dal,hol,mil];
fprintf(fid,'time,%s,%s,%s\n',tstar(:),tstop(:),tstart(:));
fprintf(fid,'format,free\n');
fprintf(fid,'ylab,@tr Wind Speed (m/s)\n');
fprintf(fid,'skp,0,%swind%d.dat\n',fpath(:),mid);
fprintf(fid,'vars,1,,1,2\n');
fprintf(fid,'rd\n');
fprintf(fid,'plotv\n');
fprintf(fid,'exit\n');
fclose(fid);
y=0;
