Temperature Correction Program
This program is called by
prof_file_all2.m
and uses the variable names as assigned there. Note two functions at bottom.
%tcorrect.m
% Peter Guest 4/15/99
%corrects all tower air temps based on calibration checks
%does not check for bad data flags; these should be set to NaN
%average bias
bp1=-0.0275;
bp2=-0.035;
bp25=-0.028;
bp3= 0.008;
bp4=-0.006;
bp5= 0.005;
bp6= 0.0175;
b1p1= -bp1;
b1p2= -bp2;
b1p25= -bp25;
b1p3= -bp3;
b1p4= -bp4;
b1p5= -bp5;
b1p6= -bp6;
b2p1= -.05 - bp1;
b2p2= -.05 - bp2;
b2p25= -.06 - bp25;
b2p3= -.025 - bp3;
b2p4= .03 - bp4;
b2p5= -.01 - bp5;
b2p6= .04 - bp6;
b3p1= 0 - bp1;
b3p2= -.02 - bp2;
b3p25= -.02 - bp25;
b3p3= .005 - bp3;
b3p4= 0 - bp4;
b3p5= .05 - bp5;
b3p6= .06 - bp6;
b4p1= -.06 - bp1;
b4p2= -.07 - bp2;
b4p25= -.05 - bp25;
b4p3= -.02 - bp3;
b4p4= -.04 - bp4;
b4p5= -.02 - bp5;
b4p6= -.03 - bp6;
b5p1= .17 - bp1;
b5p2= .14 - bp2;
b5p25= -.01 - bp25;
b5p3= .08 - bp3;
b5p4= -.02 - bp4;
b5p5= .11 - bp5;
b5p6= .11 - bp6;
tcor1=correct(t1,jd,b1p1,b1p2,b1p25,b1p3,b1p4,b1p5,b1p6);
tcor2=correct(t2,jd,b2p1,b2p2,b2p25,b2p3,b2p4,b2p5,b2p6);
tcor3=correct(t3,jd,b3p1,b3p2,b3p25,b3p3,b3p4,b3p5,b3p6);
tcor4=correct(t4,jd,b4p1,b4p2,b4p25,b4p3,b4p4,b4p5,b4p6);
tcor5=correct(t5,jd,b5p1,b5p2,b5p25,b5p3,b5p4,b5p5,b5p6);
function tcor = correct(t,jd,b1,b2,b25,b3,b4,b5,b6)
%does Sheba tower temperature and RH corrections
%Peter Guest 4/15/99
%input: t original temperature
% jd Julian day (+ 365 for 1999)
% b1-b6 t1-t biases for calibration periods 1-6
jd1=302;
jd2=371.5;
jd25=425;
jd3=474;
jd4=512.5;
jd5=585;
jd6=611;
i1=find(jd>=jd1 & jd=jd2 & jd=jd25 & jd=jd3 & jd=jd4 & jd=jd5 & jd=jd6);
tb(i1)=linter(jd(i1),jd1,jd2,b1,b2);
tb(i2)=linter(jd(i2),jd2,jd25,b2,b25);
tb(i25)=linter(jd(i25),jd25,jd3,b25,b3);
tb(i3)=linter(jd(i3),jd3,jd4,b3,b4);
tb(i4)=linter(jd(i4),jd4,jd5,b4,b5);
tb(i5)=linter(jd(i5),jd5,jd6,b5,b6);
tb(i6)=b6;
tcor=t+tb';
function value = linter(timeinter,time1,time2,value1,value2)
%performs linear interpolation
%Peter Guest 4/15/99
%input: timeinter array of times when interpolated values are needed
% time1 time of 1st set value
% time2 time of last set value
% value1 first set value
% value2 last set value
%output value array of interpolated values
value = value1 + (value2-value1).*(timeinter-time1)./(time2-time1);
|
|
| Outline Page |
Temperature Page |
|
Last update: 4/22/99
Please send all comments and suggestions to the author, Peter
Guest,