set(0,'defaultaxesfontsize',12); set(0,'defaultlinelinewidth',2); set(0,'defaultlinemarkersize',6); 
path='C:\Documents and Settings\Administrator\My Documents\1ucsd\web\demroes\data\';
axismin=datenum(2007,6,26); axismax=datenum(2007,8,28);
XTicks=[datenum(2007,1,1):datenum(2008,1,1)];
XTickLabels=datestr(XTicks,6);

%%%%%%%%%%%%%%%%%%%%%%    INPUT    %%%%%%%%%%%%%%%%%%%%%%%%%%%%
[timestring, T, RH, p_inHg, wspd_mph, wdir, trash, trash, T_ocean_middle, T_ocean_low, rain_inabs, trash, trash, ...
    trash, trash, PAR_umolesecmeter2, trash, trash, trash] = textread([path,'SIOPier_Compiled.txt'],'%18c%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f','headerlines',2,'delimiter',' ');
clear trash
time = datenum( 2000+str2num(timestring(:,7:8)) , str2num(timestring(:,1:2)),str2num(timestring(:,4:5)) ,...
     str2num(timestring(:,10:11)) , str2num(timestring(:,13:14)) , str2num(timestring(:,16:17)));

%%%%%%%%%%%%%%%%%%  CONVERSION   %%%%%%%%%%%%%%%%%%%%%%%%%%%%
wspd = wspd_mph * 0.44704;
p_mbar = p_inHg * 33.86388;
rain = diff(rain_inabs)*25.4; rain(length(rain_inabs)) = 0;

%%%%%%%%%%%%%%%%%%  DATA QUALITY CONTROL   %%%%%%%%%%%%%%%%%%%%%%%%%%%%
wspd (wspd < 0) = NaN;
wdir (wdir <= 0 ) = NaN;
p_mbar (p_mbar < 500 | p_mbar > 1200 ) = NaN;
RH ( RH<=0 | RH>120 ) = NaN;
rain (rain<0) = NaN;
 
%%%%%%%%%%%%%%%%%%%%%%   FIGURES   %%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure,set(gcf,'name','Wind Direction and Magnitude')
subplot(2,1,1),plot(time,wdir,'k.');
ylabel('Direction [Degrees]'), xlabel('Time')
set(gca,'XTick',XTicks,'XTickLabel',XTickLabels,'XGrid','on','YTick',[0 90 180 270 360],...
    'YTickLabel','0|90|180|270|360','YGrid','on','Box','on')
axis([axismin axismax 0 360])
subplot(2,1,2),plot(time,wspd,'k-');
ylabel('Speed [m/s]'), xlabel('Time')
set(gca,'XTick',XTicks,'XTickLabel',XTickLabels,'XGrid','on','Box','on')
axis([axismin axismax 0 10])

figure,set(gcf,'name','Temp and Hum')
subplot(2,1,1),plot(time,T,'k-');
ylabel('Temperature [C]'), xlabel('Time'), legend('T/RH','Panel','T_{sfc}')
set(gca,'XTick',XTicks,'XTickLabel',XTickLabels,'XGrid','on','Box','on')
axis([axismin axismax 15 25])
subplot(2,1,2),plot(time,RH,'k-');
ylabel('RH [%]'), xlabel('Time')
set(gca,'XTick',XTicks,'XTickLabel',XTickLabels,'XGrid','on','Box','on')
axis([axismin axismax 0 100])

figure,set(gcf,'name','Temp and Hum')
subplot(2,1,1),plot(time,p_mbar,'k-');
ylabel('pressure [mbar]'), xlabel('Time')
set(gca,'XTick',XTicks,'XTickLabel',XTickLabels,'XGrid','on','Box','on')
axis([axismin axismax 950 1020])
subplot(2,1,2),plot(time,rain,'k-');
ylabel('rain [mm]'), xlabel('Time')
set(gca,'XTick',XTicks,'XTickLabel',XTickLabels,'XGrid','on','Box','on')
axis([axismin axismax 0 inf])
