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,5,28); axismax=datenum(2007,9,17);
XTicks=[datenum(2007,1,1):datenum(2008,1,1)];
XTickLabels=datestr(XTicks,6);

%%%%%%%%%%%%%%%%%%%%%%    INPUT    %%%%%%%%%%%%%%%%%%%%%%%%%%%%
[timestring, trash, hour, NO2] = ...
    textread(strcat(path,'NO2_overland_notext.dat'),'%11c%u%u%f','delimiter','\t','headerlines',1);
% fid = fopen([path,'NO2_overland.dat'],'r');
% data = fgetl(fid);

time = datenum( str2num(timestring(:,1:4)) , str2num(timestring(:,6:7)),str2num(timestring(:,9:10)) , hour,0,0);

figure,plot(time,NO2,'k-')
ylabel('NO2 [ppm]'), xlabel('Time')
set(gca,'XTick',XTicks,'XTickLabel',XTickLabels,'XGrid','on','Box','on')
axis([axismin axismax 0 inf])
break

%%%%%%%%%%%%%%%%%%  DATA QUALITY CONTROL   %%%%%%%%%%%%%%%%%%%%%%%%%%%%
Temp_F (Temp_F == 0 | Temp_F < -100 | Temp_F > 150 ) = NaN;
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;

T = (Temp_F-32)*5/9;
%%%%%%%%%%%%%%%%%%%%%%   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 -8 40])
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 [?]'), xlabel('Time')
set(gca,'XTick',XTicks,'XTickLabel',XTickLabels,'XGrid','on','Box','on')
axis([axismin axismax 0 inf])
