close all
clear all

base_path = getenv('BASE_PATH');
%base_path = [];
if(isempty(base_path))
  base_path = '../';
end
FTP_path = '/mbari/FTP/pub/Hamilton/LongTermPlots/';
DecodedFiles_path = [base_path 'DecodedResults/'];
WebSiteImagePath = [base_path 'images/'];
HourlyResults_path = [base_path 'HourlyResults/'];
HourlyAveragesFilename = 'HourlyAverages.mat';

load([HourlyResults_path HourlyAveragesFilename]);

HourlyData.Time_DateNum = HourlyData.Time_DateNum - 7/24;  %Correct for GMT

filename{1} = 'EntireDeployment';
for i = 1:1
   
fh1 = figure('Position',[372  61  1018  1399],'paperposition',[.5 .5 10 16],'PaperType','tabloid','Visible','off','renderer','painter');

ah1 = subplot(9,1,1);
plot(HourlyData.Time_DateNum,HourlyData.PC_Power);
ylabel('Watts');
legend('Hourly Mean Power','Location','NorthWest');
grid on
datetick('x','mm/dd');

ah2 = subplot(9,1,2);
plot(HourlyData.Time_DateNum,HourlyData.PC_Power_max);
ylabel('Watts');
legend('Hourly Max Power','Location','NorthWest');
grid on
datetick('x','mm/dd');


ah3 = subplot(9,1,3);
plot(HourlyData.Time_DateNum,HourlyData.BC_Voltage);
ylabel('Batt Voltage');
legend('Hourly Mean Batt Voltage','Location','NorthWest');
grid on
datetick('x','mm/dd');

ah4 = subplot(9,1,4);
plot(HourlyData.Time_DateNum,HourlyData.BC_VBalance_min,'r-'); %These labels appear backwards in datafiles...
hold all;
plot(HourlyData.Time_DateNum,HourlyData.BC_VStopCharge_min,'b-');
ylabel('V');
legend('Hourly Min VStopCharge','Hourly Min VBalance','Location','NorthWest');
grid on
datetick('x','mm/dd');

ah5 = subplot(9,1,5);
plot(HourlyData.Time_DateNum,HourlyData.BC_GroundFault);
ylabel('mA');
legend('GroundFault Signal','Location','NorthWest');
grid on
datetick('x','mm/dd');

ah6 = subplot(9,1,6);
plot(HourlyData.Time_DateNum,HourlyData.BC_Hydrogen);
ylabel('% LEL');
legend('H2','Location','NorthWest');
grid on
datetick('x','mm/dd');

ah7 = subplot(9,1,7);
plot(HourlyData.Time_DateNum,HourlyData.SC_Range);
hold on;
plot(HourlyData.Time_DateNum,HourlyData.SC_Range_max);
plot(HourlyData.Time_DateNum,HourlyData.SC_Range_min);
ylabel('Piston Location (in)');
legend('Hourly Range Mean','Hourly Range Max','Hourly RangeMin','Location','NorthWest');
grid on
datetick('x','mm/dd');

ah8 = subplot(9,1,8);
plot(HourlyData.Time_DateNum,HourlyData.SC_LoadCell);
hold on;
plot(HourlyData.Time_DateNum,HourlyData.SC_LoadCell_max);
plot(HourlyData.Time_DateNum,HourlyData.SC_LoadCell_min);
ylabel('Load Cell (lbs)');
legend('Hourly Mean','Hourly Max','Hourly Min','Location','NorthWest');
grid on
datetick('x','mm/dd');


ah9 = subplot(9,1,9);
plot(HourlyData.Time_DateNum,HourlyData.PC_DiffPress);
ylabel('(psi)');
legend('PTO Comp Pressure (Hourly Mean)','Location','NorthWest');
%ylim([(min(HourlyData.PC_DiffPress)-.5) 4]);
grid on
datetick('x','mm/dd');



print([WebSiteImagePath filename{i} '.pdf'],'-dpdf')

    
end

exit
