MATLAB Data input program
Note that the header must be removed from Ola's data file....
%read_prof_file_all2.m
% 3/22/99 Peter
% this replaces read_prof_file_all.m
% reads Ola's hourly average file proc_file_all2_ed.txt
% This file is identical to proc_file_all2_ed_hd.txt but with 2-line header removed
% which was created in March 1999
%contains corrections based on tower intercomparisons 4/15/99
%t,rh,ws,wd,hf,us corrected Note q and Rhi still use old values
%these should be corrected also
clear all
%newer file
load /d/ibis2/guestps/sheba/proc_file_all2_ed.txt;
% jd320 '97 - 272 '98
jd = proc_file_all2_ed(:,1);
press = proc_file_all2_ed(:,2); %florida press mb
z1 = proc_file_all2_ed(:,3);
z2 = proc_file_all2_ed(:,4);
z3 = proc_file_all2_ed(:,5);
z4 = proc_file_all2_ed(:,6);
z5 = proc_file_all2_ed(:,7);
ws1 = proc_file_all2_ed(:,8); %tws
ws2 = proc_file_all2_ed(:,9);
ws3 = proc_file_all2_ed(:,10);
ws4 = proc_file_all2_ed(:,11);
ws5 = proc_file_all2_ed(:,12);
wd1 = proc_file_all2_ed(:,13); %twd
wd2 = proc_file_all2_ed(:,14);
wd3 = proc_file_all2_ed(:,15);
wd4 = proc_file_all2_ed(:,16);
wd5 = proc_file_all2_ed(:,17);
t1 = proc_file_all2_ed(:,18); % C
t2 = proc_file_all2_ed(:,19);
t3 = proc_file_all2_ed(:,20);
t4 = proc_file_all2_ed(:,21);
t5 = proc_file_all2_ed(:,22);
q1 = proc_file_all2_ed(:,23); % g/kg mixing ratio
q2 = proc_file_all2_ed(:,24);
q3 = proc_file_all2_ed(:,25);
q4 = proc_file_all2_ed(:,26);
q5 = proc_file_all2_ed(:,27);
rh1 = proc_file_all2_ed(:,28);
rh2 = proc_file_all2_ed(:,29);
rh3 = proc_file_all2_ed(:,30);
rh4 = proc_file_all2_ed(:,31);
rh5 = proc_file_all2_ed(:,32);
rhi1 = proc_file_all2_ed(:,33); %Rh wrt ice
rhi2 = proc_file_all2_ed(:,34);
rhi3 = proc_file_all2_ed(:,35);
rhi4 = proc_file_all2_ed(:,36);
rhi5 = proc_file_all2_ed(:,37);
T_GE = proc_file_all2_ed(:,38); %GE air? or dew? temp
T_s_epp = proc_file_all2_ed(:,39); %eppley sfc temp e=.99
T_s_brns = proc_file_all2_ed(:,40); %burns sfc temp
Tsnw = proc_file_all2_ed(:,41); % snow surface temp
Tice = proc_file_all2_ed(:,42); %snow/ice interface temp
lwd = proc_file_all2_ed(:,43); %radiations
lwu = proc_file_all2_ed(:,44);
swd = proc_file_all2_ed(:,45);
swu = proc_file_all2_ed(:,46);
RR_org = proc_file_all2_ed(:,47); %rain rate optical sensor
RR_ncr = proc_file_all2_ed(:,48); %rain rate mm/hr ncar witches brew sensor
twr_orien = proc_file_all2_ed(:,49); %tower orientation
us1 = proc_file_all2_ed(:,50); %ustar
us2 = proc_file_all2_ed(:,51);
us3 = proc_file_all2_ed(:,52);
us4 = proc_file_all2_ed(:,53);
us5 = proc_file_all2_ed(:,54);
hs1 = proc_file_all2_ed(:,55); %sensible heat flux
hs2 = proc_file_all2_ed(:,56);
hs3 = proc_file_all2_ed(:,57);
hs4 = proc_file_all2_ed(:,58);
hs5 = proc_file_all2_ed(:,59);
ww1 = proc_file_all2_ed(:,60); %?
ww2 = proc_file_all2_ed(:,61);
ww3 = proc_file_all2_ed(:,62);
ww4 = proc_file_all2_ed(:,63);
ww5 = proc_file_all2_ed(:,64);
sgu1 = proc_file_all2_ed(:,65); %standard deviations
sgu2 = proc_file_all2_ed(:,66);
sgu3 = proc_file_all2_ed(:,67);
sgu4 = proc_file_all2_ed(:,68);
sgu5 = proc_file_all2_ed(:,69);
sgv1 = proc_file_all2_ed(:,70);
sgv2 = proc_file_all2_ed(:,71);
sgv3 = proc_file_all2_ed(:,72);
sgv4 = proc_file_all2_ed(:,73);
sgv5 = proc_file_all2_ed(:,74);
sgw1 = proc_file_all2_ed(:,75);
sgw2 = proc_file_all2_ed(:,76);
sgw3 = proc_file_all2_ed(:,77);
sgw4 = proc_file_all2_ed(:,78);
sgw5 = proc_file_all2_ed(:,79);
sgt1 = proc_file_all2_ed(:,80);
sgt2 = proc_file_all2_ed(:,81);
sgt3 = proc_file_all2_ed(:,82);
sgt4 = proc_file_all2_ed(:,83);
sgt5 = proc_file_all2_ed(:,84);
cu21 = proc_file_all2_ed(:,85); %structure functions
cu22 = proc_file_all2_ed(:,86);
cu23 = proc_file_all2_ed(:,87);
cu24 = proc_file_all2_ed(:,88);
cu25 = proc_file_all2_ed(:,89);
cv21 = proc_file_all2_ed(:,90);
cv22 = proc_file_all2_ed(:,91);
cv23 = proc_file_all2_ed(:,92);
cv24 = proc_file_all2_ed(:,93);
cv25 = proc_file_all2_ed(:,94);
cw21 = proc_file_all2_ed(:,95);
cw22 = proc_file_all2_ed(:,96);
cw23 = proc_file_all2_ed(:,97);
cw24 = proc_file_all2_ed(:,98);
cw25 = proc_file_all2_ed(:,99);
ct21 = proc_file_all2_ed(:,100);
ct22 = proc_file_all2_ed(:,101);
ct23 = proc_file_all2_ed(:,102);
ct24 = proc_file_all2_ed(:,103);
ct25 = proc_file_all2_ed(:,104);
No1 = proc_file_all2_ed(:,105); %?
No2 = proc_file_all2_ed(:,106);
No3 = proc_file_all2_ed(:,107);
No4 = proc_file_all2_ed(:,108);
No5 = proc_file_all2_ed(:,109);
fl1 = proc_file_all2_ed(:,110); %quality flags
fl2 = proc_file_all2_ed(:,111);
fl3 = proc_file_all2_ed(:,112);
fl4 = proc_file_all2_ed(:,113);
fl5 = proc_file_all2_ed(:,114);
%correct heights
z5(4293:4434)=18;
z5(7225:7392)=12.4;
z5(7393:7395)=18.7;
%check z's
ibz=find(z1==999);
z1(ibz)=NaN;
ibz=find(z2==999);
z2(ibz)=NaN;
ibz=find(z3==999);
z3(ibz)=NaN;
ibz=find(z4==999);
z4(ibz)=NaN;
ibz=find(z5==999);
z5(ibz)=NaN;
%check ws's
ibws=find(ws1==9999);
ws1(ibws)=NaN;
ibws=find(ws2==9999);
ws2(ibws)=NaN;
ibws=find(ws3==9999);
ws3(ibws)=NaN;
ibws=find(ws4==9999);
ws4(ibws)=NaN;
ibws=find(ws5==9999);
ws5(ibws)=NaN;
%check wd's
ibws=find(wd1==9999);
wd1(ibws)=NaN;
ibws=find(wd2==9999);
wd2(ibws)=NaN;
ibws=find(wd3==9999);
wd3(ibws)=NaN;
ibws=find(wd4==9999);
wd4(ibws)=NaN;
ibws=find(wd5==9999);
wd5(ibws)=NaN;
%check t's
ibt=find(t1==9999);
t1(ibt)=NaN;
ibt=find(t2==9999);
t2(ibt)=NaN;
ibt=find(t3==9999);
t3(ibt)=NaN;
ibt=find(t4==9999);
t4(ibt)=NaN;
ibt=find(t5==9999);
t5(ibt)=NaN;
%Check q's
iqt=find(q1==9999);
q1(iqt)=NaN;
iqt=find(q2==9999);
q2(iqt)=NaN;
iqt=find(q3==9999);
q3(iqt)=NaN;
iqt=find(q4==9999);
q4(iqt)=NaN;
iqt=find(q5==9999);
q5(iqt)=NaN;
%check Rh's
ibrh = find (rh1==999);
rh1(ibrh)=NaN;
ibrh = find (rh2==999);
rh2(ibrh)=NaN;
ibrh = find (rh3==999);
rh3(ibrh)=NaN;
ibrh = find (rh4==999);
rh4(ibrh)=NaN;
ibrh = find (rh5==999);
rh5(ibrh)=NaN;
%check rhi's
ibrh = find (rhi1==999);
rhi1(ibrh)=NaN;
ibrh = find (rhi2==999);
rhi2(ibrh)=NaN;
ibrh = find (rhi3==999);
rhi3(ibrh)=NaN;
ibrh = find (rhi4==999);
rhi4(ibrh)=NaN;
ibrh = find (rhi5==999);
rhi5(ibrh)=NaN;
%check pressures
ibp=find(press==9999 | press==10000);
press(ibp)=NaN;
%check q's
ibq = find (q1==9999);
q1(ibq)=NaN;
ibq = find (q2==9999);
q2(ibq)=NaN;
ibq = find (q3==9999);
q3(ibq)=NaN;
ibq = find (q4==9999);
q4(ibq)=NaN;
ibq = find (q5==9999);
q5(ibq)=NaN;
%check more temps
ib=find(T_GE==9999);
T_GE(ib)=NaN;
ib=find(T_s_epp==9999);
T_s_epp(ib)=NaN;
ib=find(T_s_brns==9999);
T_s_brns(ib)=NaN;
ib=find(Tsnw==999);
Tsnw(ib)=NaN;
ib=find(Tice==999);
Tice(ib)=NaN;
%check radiation
ib=find(lwd==9999);
lwd(ib)=NaN;
ib=find(lwu==9999);
lwu(ib)=NaN;
%check radiation
ib=find(swd==9999);
swd(ib)=NaN;
ib=find(swu==9999);
swu(ib)=NaN;
%check rainfall
ib=find(RR_org==999);
RR_org(ib)=NaN;
ib=find(RR_ncr==999);
RR_ncr(ib)=NaN;
%check tower orientation
ib=find(twr_orien==999);
twr_orien(ib)=NaN;
%check ustar's
ib=find(us1==9999);
us1(ib)=NaN;
ib=find(us2==9999);
us2(ib)=NaN;
ib=find(us3==9999);
us3(ib)=NaN;
ib=find(us4==9999);
us4(ib)=NaN;
ib=find(us5==9999);
us5(ib)=NaN;
%Check sens heat fluxes
ib=find(hs1==9999);
hs1(ib)=NaN;
ib=find(hs2==9999);
hs2(ib)=NaN;
ib=find(hs3==9999);
hs3(ib)=NaN;
ib=find(hs4==9999);
hs4(ib)=NaN;
ib=find(hs5==9999);
hs5(ib)=NaN;
%determine relative wind direction
rwd1=wd1-twr_orien;
hi=find(rwd1>360);
lo=find(rwd1<0);
rwd1(hi)=rwd1(hi)-360;
rwd1(lo)=rwd1(lo)+360;
rwd2=wd2-twr_orien;
hi=find(rwd2>360);
lo=find(rwd2<0);
rwd2(hi)=rwd2(hi)-360;
rwd2(lo)=rwd2(lo)+360;
rwd3=wd3-twr_orien;
hi=find(rwd3>360);
lo=find(rwd3<0);
rwd3(hi)=rwd3(hi)-360;
rwd3(lo)=rwd3(lo)+360;
rwd4=wd4-twr_orien;
hi=find(rwd4>360);
lo=find(rwd4<0);
rwd4(hi)=rwd4(hi)-360;
rwd4(lo)=rwd4(lo)+360;
rwd5=wd5-twr_orien;
hi=find(rwd5>360);
lo=find(rwd5<0);
rwd5(hi)=rwd5(hi)-360;
rwd5(lo)=rwd5(lo)+360;
%save original values before correcting
wss1=ws1;
wss2=ws2;
wss3=ws3;
wss4=ws4;
wss5=ws5;
wds1=wd1;
wds2=wd2;
wds3=wd3;
wds4=wd4;
wds5=wd5;
rwds1=rwd1;
rwds2=rwd2;
rwds3=rwd3;
rwds4=rwd4;
rwds5=rwd5;
uss1=us1;
uss2=us2;
uss3=us3;
uss4=us4;
uss5=us5;
hss1=hs1;
hss2=hs2;
hss3=hs3;
hss4=hs4;
hss5=hs5;
%corrections based on tower intercomparisons
tcorrect
rhcorrect
windcorrect
%set "main" variables to corrected values
ws1=wsc1;
ws2=wsc2;
ws3=wsc3;
ws4=wsc4;
ws5=wsc5;
wd1=wdc1;
wd2=wdc2;
wd3=wdc3;
wd4=wdc4;
wd5=wdc5;
rwd1=rwdc1;
rwd2=rwdc2;
rwd3=rwdc3;
rwd4=rwdc4;
rwd5=rwdc5;
t1=tcor1;
t2=tcor2;
t3=tcor3;
t4=tcor4;
t5=tcor5;
rh1=rhcor1;
rh2=rhcor2;
rh3=rhcor3;
rh4=rhcor4;
rh5=rhcor5;
%correcting ustar makes calibration period comparisons worse, so I didn't apply
%us1=usc1;
%us2=usc2;
%us3=usc3;
%us4=usc4;
%us5=usc5;
%some derived variables
%calculate corrected relative wind direction calculated in windcorrect
%drag coefficients
cdz1=(us1./ws1).^2;
cdz2=(us2./ws2).^2;
cdz3=(us3./ws3).^2;
cdz4=(us4./ws4).^2;
cdz5=(us5./ws5).^2;
cdzl1=(us1./ws1).^2;
cdzl2=(us2./ws2).^2;
cdzl3=(us3./ws3).^2;
cdzl4=(us4./ws4).^2;
cdzl5=(us5./ws5).^2;
ilow1=find(ws1<2);
ilow2=find(ws2<2);
ilow3=find(ws3<2);
ilow4=find(ws4<2);
ilow5=find(ws5<2);
cdzl1(ilow1)=NaN;
cdzl2(ilow2)=NaN;
cdzl3(ilow3)=NaN;
cdzl4(ilow4)=NaN;
cdzl5(ilow5)=NaN;
|
|
| Outline Page |
Introduction Page |
|
Last update: 9/27/99
Please send all comments and suggestions to the author, Peter
Guest,