h = figure('Visible','off');
plot(CastData.ReleaseTime,CastData.Battery,'rx-');
set(gca,'xtick',[CastData.ReleaseTime(1):2:CastData.ReleaseTime(end)])
datetick('x','keeplimits','keepticks');
xlabel('GMT');
ylabel('Battery Voltage');
foo = axis;
foo(3) = 9.0;
foo(4) = 14.0;
axis(foo);

set(h,'Units','pixels');
rect = get(h,'Position');
rect(3) = 550;
rect(4) = 200;
set(h,'Position',rect);
set(h,'PaperPositionMode','auto');

print -dpng BatteryVoltage
print -depsc2 BatteryVoltage


h = figure('Visible','off');
PercentComplete = 100*(1-length(find(CastData.BottomDepth < 45))/length(CastData.BottomDepth));
plot(CastData.ReleaseTime,CastData.BottomDepth,'bx',CastData.ReleaseTime,CastData.TopDepth,'gx');
%title(['Profile Performance: ',num2str(PercentComplete,'%4.1f'),'% Complete Profiles']);
set(gca,'xtick',[CastData.ReleaseTime(1):2:CastData.ReleaseTime(end)])
datetick('x','keeplimits','keepticks');
set(gca,'YDir','reverse') ;
xlabel('GMT');
ylabel('Depth (m)');
legend('Profile Start Depth','Profile Stop Depth','Location','NorthWest');
set(h,'Units','pixels');
rect = get(h,'Position');
rect(3) = 550;
rect(4) = 200;
set(h,'Position',rect);
set(h,'PaperPositionMode','auto');
print -dpng ProfileDepths
print -depsc2 ProfileDepths



h = figure('Visible','off');
plot(CastData.ReleaseTime,CastData.UpVel,'bx-',CastData.ReleaseTime,CastData.DownVel,'rx-');
set(gca,'xtick',[CastData.ReleaseTime(1):2:CastData.ReleaseTime(end)])
datetick('x','keeplimits','keepticks');
xlabel('GMT');
ylabel('Velocity (m/s)');
legend('Profile Velocity (Up)','Climb Velocity (Down)','Location','NorthWest');
set(h,'Units','pixels');
rect = get(h,'Position');
rect(3) = 550;
rect(4) = 200;
set(h,'Position',rect);
set(h,'PaperPositionMode','auto');
print -dpng ProfileSpeeds
print -depsc2 ProfileSpeeds



fid = fopen('Status.html','w');
fprintf(fid,'<html> \n<body> \n<pre> \n');
fprintf(fid,'            <big><b>Most Recent Profile occured at: %s GMT</b></big> \n',datestr(CastData.ReleaseTime(end)));
fprintf(fid,'  Note:  The data ommissions near on April3-4 evident in the plots  \n');
fprintf(fid,'         were caused by a data processing problem, not a profiler failure \n');
fprintf(fid,'         The problem is being addressed and the complete data-set will appear soon \n');
fprintf(fid,'</body> \n </html>\n </pre> \n');
fclose(fid);

!cp Status.html W:/MOOSVP/.
!cp ProfileSpeeds.png W:/MOOSVP/.
!cp ProfileDepths.png W:/MOOSVP/.
!cp BatteryVoltage.png W:/MOOSVP/.

