disp('read_pc_day_sjohnson_05') fclose('all'); % modified on 30-mar-01 by D.E.Lane for Kai 2001 cruise % modified 10 nov 03 by cfairall for the weller 2003 cruise % modified 09 jul 04 by hare jd=num2str(ddd); if ddd<100 jd=['0' num2str(ddd)]; end; if ddd<10 jd=['00' num2str(ddd)]; end; plotit=0; prtit=1; clear jad; hr='00'; %input('gmt hr','s'); g=0.0098; %adiabatic lapse rate eps_w=0.97; %emissivity of water sig_sb=5.67e-8; %Stefan Boltzmann constant blk=1; %10-min index jax=1; backchk=0; N15=[];N16=[];N17=[];N18=[];N19=[];N20=[];N21=[];N22=[];N41=[]; n15=[];n16=[];n17=[];n18=[];n19=[];n20=[];n21=[];n22=[];n41=[]; for jam=0:23, %cycle thru 24 hourly stats files if jam<10, hr=['0',num2str(jam)]; else hr=num2str(jam); end; %end if jam e=['d:\data\day',jd,'\P2_' jd hr]; disp(['Reading means file from hour ',num2str(jam)]); flist=fopen(e,'r'); if flist>0, %if the file exists, dmp=fgets(flist); %read header line while feof(flist)==0, stx=fgetl(flist); if length(stx)>15, if stx(15:17)==',09', n15=str2num(stx(78:84)); n16=str2num(stx(88:94)); N15=[N15 n15];N16=[N16 n16]; end; if stx(15:17)==',17' n17=str2num(stx(18:24)); if n17 < 0 %correcting for bad seaSnake n17 = 26; end; n18=str2num(stx(28:34)); n19=str2num(stx(38:44)); n20=str2num(stx(48:54)); n21=str2num(stx(58:64)); n22=str2num(stx(68:74)); N17=[N17 n17];N18=[N18 n18];N19=[N19 n19]; N20=[N20 n20];N21=[N21 n21];N22=[N22 n22]; end; if stx(15:17)==',41' n41=str2num(stx(18:24)); N41=[N41 n41]; end; end; end; %end while feof end; %end if flist end; %end for jam Tc=N15-0.45; %correct for bias, day 321 Td=N16-.1; %correct for bias Tsea=N17+0.06; %correct for lead resistance 20C Tvais=N18; Rhvais=N19; therm=N20; psp=N21; org=N22; aspir_on=N41; %aspirator swich -5 means back flow if length(Tc)<1440; Tc=[Tc (1:1440-length(Tc)).*0+Tc(length(Tc))]; end; if length(Td)<1440; Td=[Td (1:1440-length(Td)).*0+Td(length(Td))]; end; if length(Tsea)<1440; Tsea=[Tsea (1:1440-length(Tsea)).*0+Tsea(length(Tsea))]; end; if length(Tvais)<1440; Tvais=[Tvais (1:1440-length(Tvais)).*0+Tvais(length(Tvais))]; end; if length(Rhvais)<1440; Rhvais=[Rhvais (1:1440-length(Rhvais)).*0+Rhvais(length(Rhvais))]; end; if length(therm)<1440; therm=[therm (1:1440-length(therm)).*0+therm(length(therm))]; end; if length(psp)<1440; psp=[psp (1:1440-length(psp)).*0+psp(length(psp))]; end; if length(org)<1440; org=[org (1:1440-length(org)).*0+org(length(org))]; end; if length(aspir_on)<1440; aspir_on=[aspir_on (1:1440-length(aspir_on)).*0+aspir_on(length(aspir_on))]; end; avgpsp=mean(psp); avgrain=mean(org); avgTvais=mean(Tvais); avgsnake=mean(Tsea); avgRHvais=mean(Rhvais); avgQvais=avgRHvais/100*qsea(avgTvais) pp=ones(length(Tvais),1)*1009; qvais=qair_p([Tvais' Rhvais' pp]); pir=therm+sig_sb*(Tc+273.16).^4-4*sig_sb*((Td+273.16).^4-(Tc+273.16).^4); pp=ones(length(Tvais),1)*1009; for iii=2:length(org); if org(iii)==0, org(iii)=org(iii-1); end; if Tc(iii)==0, Tc(iii)=Tc(iii-1); end; if Td(iii)==0, Td(iii)=Td(iii-1); end; if pir(iii)==0, pir(iii)=pir(iii-1); end; if psp(iii)==0, psp(iii)=psp(iii-1); end; if Tvais(iii)==0, Tvais(iii)=Tvais(iii-1); end; if Rhvais(iii)==0, Rhvais(iii)=Rhvais(iii-1); end; if Tsea(iii)==0, Tsea(iii)=Tsea(iii-1); end; end; org_carrier=org; jad=ddd+(0:length(psp)-1)/1440; jad_pc=jad; xtext=['Jday ',num2str(jd),' 2005']; figure;plot(jad,Tc,jad,Td,jad,Tsea,jad,Tvais);title('ETL Temperatures (case; dome; snake, Tair)');xlabel(xtext) figure;plot(jad,psp);title('ETL psp');xlabel(xtext) figure;plot(jad,pir);title('ETL pir');xlabel(xtext) figure;plot(jad,Rhvais);title('ETL RH');xlabel(xtext) figure;plot(jad,org);title('ETL org rain rate');xlabel(xtext) figure;plot(jad,aspir_on);title('ETL aspirator');xlabel(xtext) np=length(psp); if prtit==1; prt_jas_means_sjohnson_05; end; if plotit==1; Tll=-25; hll=70; uul=10; vul=10; Tul=-0; hul=100; sul=12; Rlul=30; Rlll=-100; Rtul=300; Rtll=125; Rsul=1100; Rsll=0; j_st=jad(1); j_en=jad(np); figure;plot(jad(1:np),Tvais(1:np),'b',jad(1:np),Tsea(1:np),'g',jad(1:np),Td1(1:np),'r',jad(1:np),Tc1(1:np),'m');xlabel('Jday (2005)');ylabel('Temperature (C)');title('Tair_v=blue; Tsea_s_n_a_k_e=green; T_d_o_m_e_1=red; T_c_a_s_e_1=magenta;'); figure;h=plot(jad(1:np),Tvais(1:np),jad(1:np),Tsea(1:np));set(gca,'fontsize',14);set(h,'LineWidth',2);xlabel('Jday (2005)');ylabel('Temperature (C)');title('Tair_v=blue; Tsea_s_n_a_k_e=green'); figure;h=plot(jad(1:np),pir1(1:np));set(gca,'fontsize',14);set(h,'LineWidth',2);xlabel('Jday (2005)');ylabel('Pir (W/m^2)');title('Downward IR Flux'); figure;h=plot(jad(1:np),psp1(1:np));set(gca,'fontsize',14);set(h,'LineWidth',2);xlabel('Jday (2005)');ylabel('Psp (W/m^2)');axis([j_st j_en Rsll Rsul]);title('Downward Solar Flux'); hold on; figure;plot(jad(1:np),org(1:np));xlabel('Jday (2005)');ylabel('ORG Precipitation Rate (mm/hr)');axis([j_st j_en 0 50]);title('STI Optical Rain Gauge'); end; %clear jd jax jam jad j_st j_en hul hr hll g flist f eps_w e dmp blk backchk ans %clear vul uul tzilch therm1 therm2 sul stz sty stx st2 st1 st0 sig_sb psp1 psp2 prtit prt_it plotit %clear Tc1 Tc2 Td1 Td2 Tll Tsea Tul Tvais jazz m0 n0 nl1 np npz nr1 org pir1 pir2 %clear Rhvais Rlll Rlul Rsll Rsul Rtll Rtul