├── README.md ├── albedot1.mat ├── s2hms.m ├── viscair.m ├── rhadj.m ├── hms2h.m ├── satvap.m ├── ep.m ├── wavdist2.m ├── air_dens.m ├── stressve.m ├── spshftve.m ├── stresslp.m ├── spshftlp.m ├── vapor.m ├── albedo.m ├── omegalmc.m ├── delq.m ├── stresstc.m ├── spshfttc.m ├── cdnlp.m ├── yearday.m ├── binave.m ├── qsat.m ├── cdntc.m ├── swhf.m ├── cdnve.m ├── wavdist1.m ├── julianmd.m ├── greg2.m ├── wavedist.m ├── relhumid.m ├── lwhf.m ├── wdnotes.m ├── t_hfbulktc.m ├── sw_visc.m ├── sunrise.m ├── slhftc.m ├── clskswr.m ├── cloudcor.m ├── rain_flux.m ├── sw_tcond.m ├── contents.m ├── blwhf.m ├── as_consts.m ├── reedcf.m ├── soradna1.m ├── cool_skin.m ├── readme.m ├── test2_5b.dat ├── hfbulktc.m ├── no_skin_out.txt └── yes_skin_out.txt /README.md: -------------------------------------------------------------------------------- 1 | # air-sea 2 | -------------------------------------------------------------------------------- /albedot1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sea-mat/air-sea/HEAD/albedot1.mat -------------------------------------------------------------------------------- /s2hms.m: -------------------------------------------------------------------------------- 1 | function [hr,min,sec]=s2hms(secs) 2 | % S2HMS: converts seconds to interger hour, minute, and seconds. 3 | % [hr,min,sec]=S2HMS(secs) converts seconds to integer hour, minute, 4 | % and seconds. 5 | 6 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7 | % 3/11/96: version 1.0 8 | % 8/5/99: version 2.0 9 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 10 | 11 | sec=round(secs); 12 | hr=floor(sec./3600); 13 | min=floor(rem(sec,3600)./60); 14 | sec=round(rem(sec,60)); 15 | 16 | -------------------------------------------------------------------------------- /viscair.m: -------------------------------------------------------------------------------- 1 | function vis=viscair(Ta) 2 | % VISCAIR: computes viscosity of air 3 | % vis=VISCAIR(Ta) computes the kinematic viscosity of dry air as a 4 | % function of air temperature following Andreas (1989), CRREL Report 5 | % 89-11. 6 | % 7 | % INPUT: Ta - air temperature [C] 8 | % 9 | % OUTPUT: vis - air viscosity [m^2/s] 10 | 11 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 12 | % 3/8/97: version 1.0 13 | % 8/5/99: version 2.0 14 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 15 | 16 | vis = 1.326e-5*(1 + 6.542e-3*Ta + 8.301e-6*Ta.^2 - 4.84e-9*Ta.^3); 17 | 18 | -------------------------------------------------------------------------------- /rhadj.m: -------------------------------------------------------------------------------- 1 | function rha = rhadj(rh,rhmax) 2 | % RHADJ: rescales RH to have a maximum of 100%. 3 | % RHADJ(rh,rhmax) rescales RH so that the maximum values do not 4 | % exceed 100%. Assumes values between 93% and rhmax should be 5 | % rescaled to 93 - 100% (the calibration curves of RH sensors usually 6 | % become nonlinear above ~ 90%, and may peak above 100% in this range 7 | % above ~ 90% where their calibration becomes unstable.) 8 | 9 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 10 | % 4/10/98: version 1.0 11 | % 8/5/99: version 2.0 12 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 13 | 14 | rhl=93; 15 | 16 | rhn=rh; 17 | a=(100-rhl)./(rhmax-rhl); 18 | drh=rh-rhl; 19 | j=find(drh>0); 20 | rhn(j)=rhl+a.*drh(j); 21 | 22 | rha=rhn; -------------------------------------------------------------------------------- /hms2h.m: -------------------------------------------------------------------------------- 1 | function [hours]=hms2h(h,m,s); 2 | % HMS2H: converts hours, minutes, and seconds to hours. 3 | % [hours]=HMS2H(h,m,s) converts hours, minutes, and seconds to hours 4 | % 5 | % INPUT: h - integer hours 6 | % m - minutes 7 | % s - secs 8 | % 9 | % OUTPUT: hours - decimal hours 10 | % 11 | % Usage: [hours]=hms2h(h,m,s); or [hours]=hms2h(hhmmss); 12 | 13 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 14 | % 3/8/97: version 1.0 15 | % 8/5/99: version 2.0 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | 18 | if nargin== 1, 19 | hms=h; 20 | h=floor(hms/10000); 21 | ms=hms-h*10000; 22 | m=floor(ms/100); 23 | s=ms-m*100; 24 | hours=h+m/60+s/3600; 25 | else 26 | hours=h+(m+s/60)/60; 27 | end 28 | 29 | 30 | -------------------------------------------------------------------------------- /satvap.m: -------------------------------------------------------------------------------- 1 | function ew=satvap(Ta,P) 2 | % SATVAP: computes saturation vapor pressure 3 | % q=satvap(Ta) computes the vapor pressure at satuation at air 4 | % temperature Ta (deg C). From Gill (1982), Atmos-Ocean Dynamics, 606. 5 | % 6 | % INPUT: Ta- air temperature [C] 7 | % p - pressure (optional) [mb] 8 | % 9 | % OUTPUT: q - saturation vapour pressure [mb] 10 | 11 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 12 | % 3/8/97: version 1.0 13 | % 8/27/98: version 1.1 (corrected by RP) 14 | % 8/5/99: version 2.0 15 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 | 17 | as_consts; 18 | 19 | if nargin<2, 20 | P=P_default; 21 | end; 22 | if nargin==0, 23 | Ta=Ta_default; 24 | end; 25 | 26 | ew=power(10,((0.7859+0.03477*Ta)./(1+0.00412*Ta))); 27 | 28 | fw=1 + 1e-6*P.*(4.5+0.0006*Ta.^2); 29 | 30 | ew=fw.*ew; 31 | -------------------------------------------------------------------------------- /ep.m: -------------------------------------------------------------------------------- 1 | function [E,P]=ep(rfd,Qlat) 2 | % EP: computes evap and precip accumulation 3 | % [E,P]=EP(rfd,Qlat) computes precipitation and evaporation 4 | % accumulation from rainfall rate rfd and latent heat 5 | % flux Qlat. Assumes hourly input. 6 | % 7 | % INPUT: rfd - precip rate [mm/min] 8 | % Qlat - latent heat flux [W/m^2] 9 | % 10 | % OUTPUT: P - precip accumulation [m] 11 | % E - evaporation accumulation [m] 12 | 13 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 14 | % 8/5/99: version 2.0 15 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 | 17 | % compute P 18 | P=cumsum(rfd)./1000; % convert mm to m 19 | dt=60; % for hourly data, dt = 60 min 20 | P=P.*dt; 21 | 22 | % compute E 23 | Le=2.5e6; % heat of vaporization (W/m^2) 24 | pw=1025; % density of seawater (kg/m^3) at 32 psu, 10 degC, 0 db 25 | dt=3600; % seconds per hour 26 | E=cumsum(Qlat).*dt./(Le.*pw); 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /wavdist2.m: -------------------------------------------------------------------------------- 1 | function y=wavdist2(za) 2 | % WAVDIST2: plots wave distortion effects on wind at za. 3 | % WAVDIST2(za) plots the effects of wave distortion on the 4 | % wind Ua measured at height za for the following significant 5 | % wave heights Hw=[0:2:8] in m. 6 | % 7 | % INPUT: za - wind measurement height [m] 8 | 9 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 10 | % 5/5/97: version 1.0 11 | % 4/10/98: version 1.1 12 | % 8/5/99: version 2.0 13 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 14 | 15 | Hw=[0:2:8]; 16 | Ua=[0.01:.01:20]'; 17 | 18 | N=length(Hw); 19 | M=length(Ua); 20 | Ut=zeros(M,N); 21 | 22 | clg 23 | hold on 24 | for n=1:N 25 | Ut=wavdist1(Ua,za,Hw(n)); 26 | plot(Ua,Ut) 27 | end 28 | 29 | title(['Predicted effects of wave distortion on wind speed at height ',num2str(za),' m']) 30 | xlabel('Measured wind speed Ua (m/s)') 31 | ylabel('Predicted wind speed Ut (m/s)') 32 | text(10,2,'Wave height increment = 2 m') 33 | grid 34 | 35 | 36 | -------------------------------------------------------------------------------- /air_dens.m: -------------------------------------------------------------------------------- 1 | function rhoa=air_dens(Ta,RH,Pa) 2 | % AIR_DENS: computes computes the density of moist air. 3 | % rhoa=AIR_DENS(Ta,RH,Pa) computes the density of moist air. 4 | % Air pressure is optional. 5 | % 6 | % INPUT: Ta - air temperature Ta [C] 7 | % RH - relative humidity [%] 8 | % Pa - air pressure (optional) [mb] 9 | % 10 | % OUTPUT: rhoa - air density [kg/m^3] 11 | 12 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 13 | % 4/7/99: version 1.2 (contributed by AA) 14 | % 8/5/99: version 2.0 15 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 | 17 | % load constants 18 | as_consts; 19 | 20 | if nargin == 2 21 | Pa = P_default; 22 | end 23 | 24 | o61 = 1/eps_air-1; % 0.61 (moisture correction for temp.) 25 | Q = (0.01.*RH).*qsat(Ta,Pa); % specific humidity of air [kg/kg] 26 | T = Ta+CtoK; % convert to K 27 | Tv = T.*(1 + o61*Q); % air virtual temperature 28 | rhoa = (100*Pa)./(gas_const_R*Tv); % air density [kg/m^3] 29 | 30 | -------------------------------------------------------------------------------- /stressve.m: -------------------------------------------------------------------------------- 1 | function tau=stressve(sp,z,rhoa) 2 | % STRESSVE: computes stress using Vera (1983) neutral drag law. 3 | % tau = STRESSVE(sp,z,rhoa) computes the neutral wind stress given the wind 4 | % speed at height z following Vera (1983) [see Large, Morzel, and Crawford 5 | % (1995), J. Phys. Oceanog., 25, 2959-2971 (eqn. 8)]. Assumes z a fixed 6 | % scalar. Air density is an optional input. 7 | % 8 | % INPUT: sp - wind speed [m/s] 9 | % z - measurement height [m] 10 | % rhoa - air density (optional) [kg/m^3] 11 | % 12 | % OUTPUT: tau - wind stress [N/m^2] 13 | 14 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 15 | % 3/8/97: version 1.0 16 | % 8/26/98: version 1.1 (revised by RP) 17 | % 4/2/99: version 1.2 (air density option added by AA) 18 | % 8/5/99: version 2.0 19 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 20 | 21 | % load constants 22 | as_consts; 23 | 24 | if nargin == 2 25 | rhoa = rho_air; 26 | end 27 | 28 | [cd,u10]=cdnve(sp,z); 29 | tau=rhoa*(cd.*u10.^2); 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /spshftve.m: -------------------------------------------------------------------------------- 1 | function [sp2,ustar]=spshftve(sp1,z1,z2) 2 | % SPSHFTVE: adjusts wind speed from z1 to z2 following Vera (1983). 3 | % sp2 = SPSHFTVE(sp1,z1,z2) shifts the wind speed sp1 measured at z1 to 4 | % z2 using the neutral drag law of Vera (1983) [see Large, Morzel, 5 | % and Crawford (1995), J. Phys. Oceanog., 25, 2959-2971 (eqn. 8)]. 6 | % Assumes z1 and z2 scalars. 7 | % 8 | % INPUT: sp1 - measured wind speed [m/s] 9 | % z1 - measurement height [m] 10 | % z2 - desired height of sp2 [m] 11 | % 12 | % OUTPUT: sp2 - predicted wind speed [m/s] 13 | % ustar - friction velocity [m/s] 14 | 15 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 | % 3/8/97: version 1.0 17 | % 8/27/98: version 1.1 (revised to use CDNVE efficiently by RP) 18 | % 8/5/99: version 2.0 19 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 20 | 21 | % set constants 22 | as_consts; 23 | 24 | % find cd and ustar 25 | [cd10,sp10]=cdnve(sp1,z1); 26 | 27 | ustar=sqrt(cd10).*sp10; 28 | 29 | sp2=sp10+ustar.*log(z2./10)/kappa; 30 | 31 | -------------------------------------------------------------------------------- /stresslp.m: -------------------------------------------------------------------------------- 1 | function tau=stresslp(sp,z,rhoa) 2 | % STRESSLP: computes neutral wind stress following Large and Pond (1981). 3 | % tau = STRESSLP(sp,z,rhoa) computes the neutral wind stress given the wind 4 | % speed at height z following Large and Pond (1981), J. Phys. Oceanog., 5 | % 11, 324-336. Air density is an optional input, otherwise assumed to 6 | % be constant (1.22 kg/m^3). 7 | % 8 | % INPUT: sp - wind speed [m/s] 9 | % z - measurement height [m] 10 | % rhoa - air_density (optional) [kg/m^3] 11 | % 12 | % OUTPUT: tau - wind stress [N/m^2] 13 | 14 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 15 | % 3/8/97: version 1.0 16 | % 8/26/98: version 1.1 (revised by RP) 17 | % 4/2/99: version 1.2 (optional air density added by AA) 18 | % 8/5/99: version 2.0 19 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 20 | 21 | % get constants 22 | as_consts; 23 | 24 | if nargin == 2 25 | rhoa = rho_air; 26 | end 27 | 28 | [cd,u10]=cdnlp(sp,z); 29 | tau=rhoa.*(cd.*u10.^2); 30 | 31 | -------------------------------------------------------------------------------- /spshftlp.m: -------------------------------------------------------------------------------- 1 | function [sp2,ustar]=spshfttc(sp1,z1,z2) 2 | % SPSHFTTC: adjusts wind speed from z1 to z2 following Large&Pond (1981). 3 | % sp2 = SPSHFTLP(sp1,z1,z2) shifts the wind speed sp1 measured at z1 to 4 | % z2 using the neutral drag coefficient given the wind speed and air 5 | % temperature at height z following Large and Pond (1981), J. Phys. Oceanog., 6 | % 11, 324-336. 7 | % 8 | % INPUT: sp1 - measured wind speed [m/s] 9 | % z1 - measurement height [m] 10 | % z2 - desired height [m] 11 | % 12 | % OUTPUT: sp2 - predicted wind speed [m/s] 13 | % ustar - friction velocity [m/s] 14 | 15 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 | % 3/8/97: version 1.0 17 | % 8/27/98: version 1.1 (revised to use CDNLP efficiently by RP) 18 | % 8/5/99: version 2.0 19 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 20 | 21 | % get constants 22 | as_consts; 23 | 24 | % find cd and ustar 25 | [cd10,sp10]=cdnlp(sp1,z1); 26 | 27 | ustar=sqrt(cd10).*sp10; 28 | 29 | sp2=sp10+ustar.*log(z2./10)/kappa; 30 | 31 | -------------------------------------------------------------------------------- /vapor.m: -------------------------------------------------------------------------------- 1 | function L=vapor(t) 2 | % VAPOR calculates heat of evaporation for pure water 3 | % L=VAPOR(t)computes the heat of evaporation for pure water. This can 4 | % be used to compute the fresh water flux from latent heat flux. 5 | % 6 | % INPUT: t - water temperature [C] 7 | % 8 | % OUTPUT: L - heat of evaporation [J/kg] 9 | 10 | % Range of validity: 0 <= t <= 100 deg C. Check value: at t=100 deg C, 11 | % L = 2.2566 x 10^6 J/kg. Reference: Landolt-Bornstein, Numerical Data 12 | % and Functional Relationships in Science and Technology. New Series, 13 | % Sundermann, J. (editor), vol. 3, subvol. a, Springer-Verlag, p. 256. 14 | % No formulas are known to be available for the change of the heat of 15 | % evaporation as function of salinity. 16 | 17 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 18 | % 1/22/99: version 1.0 (contributed by RO) 19 | % 8/5/99: version 2.0 20 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 21 | 22 | a0=2.50039e6; 23 | a1=-2.3683e3; 24 | a2=4.31e-1; 25 | a3=-1.131e-2; 26 | L=a0+a1*t+a2*t.*t+a3*t.*t.*t; 27 | 28 | -------------------------------------------------------------------------------- /albedo.m: -------------------------------------------------------------------------------- 1 | function alb=albedo(trans,sunalt) 2 | % ALBEDO: computes sea surface albedo following Payne (1972). 3 | % alb=ALBEDO(trans,sunalt) computes the sea surface albedo from the 4 | % atmospheric transmittance and sun altitude by linear interpolation 5 | % using Table 1 in Payne (1972), J. Atm. Sci., 29, 959-970. Assumes 6 | % trans and sunalt both matrices of same size. Table 1 is called 7 | % albedot1.mat. 8 | % 9 | % INPUT: trans - atmospheric transmittance 10 | % sunalt - sun altitude [deg] 11 | % 12 | % OUTPUT: alb - albedo 13 | 14 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 15 | % 3/10/96: version 1.0 16 | % 7/24/98: version 1.1 (rev. to handle out-of-range input values by RP) 17 | % 8/5/99: version 2.0 18 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 19 | 20 | % load table 1 21 | load albedot1 22 | 23 | % create axes 24 | x=[0:2:90]; 25 | y=[0:.05:1.0]'; 26 | 27 | alb=ones(size(trans))+NaN; 28 | k=sunalt>0 & finite(trans) & trans<=1.01; 29 | 30 | % interpolate 31 | alb(k)=interp2(x,y,albedot1,sunalt(k),trans(k)); 32 | 33 | 34 | -------------------------------------------------------------------------------- /omegalmc.m: -------------------------------------------------------------------------------- 1 | function y=omegalmc(x) 2 | % OMEGALMC: estimates wind log profile correction due to surface waves. 3 | % y=OMEGALMC(x) computes the log profile correction function due to wind 4 | % distortion associated with surface waves. Input is x=za/Hw, where za 5 | % is the measurement height and Hw is the dominant surface wave height. 6 | % Functional form is simplified (analytic) version of empirical omega 7 | % curves shown in Fig. 9b of Large, Morzel, and Crawford (1995), J. Phys. 8 | % Oceanog., 25, 2959-2971, with the wave-induced roughness length xr=0.15. 9 | % Assumes x is a vector with all elements greater than zr. 10 | 11 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 12 | % 3/8/97: version 1.0 13 | % 8/5/99: version 2.0 14 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 15 | 16 | xr=0.15; 17 | ylimit=-6; 18 | y=ylimit.*ones(size(x)); 19 | i=find(x<3.2967); 20 | % polynomial fit 21 | a=-2.6; 22 | p1=-0.0199; 23 | p2=0.0144; 24 | p3=0.7660; 25 | p4=0.0654; 26 | x2=x(i).^2;x3=x2.*x(i); 27 | y(i)=a.*log(x(i)./xr)+p1.*x3+p2.*x2+p3.*x(i)+p4; 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /delq.m: -------------------------------------------------------------------------------- 1 | function dq=delq(Ts,Ta,rh) 2 | % DELQ: computes air-sea specific humidity difference. 3 | % dq=DELQ(Ts,Ta,rh) computes the specific humidity (kg/kg) difference 4 | % between the air (as determined by relative humidty rh and air 5 | % temperature Ta measurements) and the sea surface (where q is 6 | % assumed to be at 98% satuation at the sea surface temperature Ts). 7 | % DELQ uses QSAT based on Tetens' formula for saturation vapor 8 | % pressure from Buck (1981), J. App. Meteor., 1527-1532. The 9 | % dependence of QSAT on pressure is small (<0.5%) and has been 10 | % removed using a mean pressure of 1020 mb. 11 | % 12 | % INPUT: Ts - sea surface temperature [C] 13 | % Ta - air temperature [C] 14 | % rh - relative humidity [%] 15 | % 16 | % OUTPUT: dq - air-sea specific humidity difference [kg/kg] 17 | 18 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 19 | % 3/8/97: version 1.0 20 | % 4/10/98: version 1.1 21 | % 8/5/99: version 2.0 22 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 23 | 24 | dq=0.01.*rh.*qsat(Ta) - 0.98.*qsat(Ts); 25 | 26 | 27 | -------------------------------------------------------------------------------- /stresstc.m: -------------------------------------------------------------------------------- 1 | function tau=stresstc(sp,z,Ta,rhoa) 2 | % STRESSTC: computes the neutral wind stress following Smith (1988). 3 | % tau = STRESSTC(sp,z,Ta,rhoa) computes the neutral wind stress given the 4 | % wind speed and air temperature at height z following Smith (1988), 5 | % J. Geophys. Res., 93, 311-326. Air temperature and density are optional 6 | % inputs. 7 | % 8 | % INPUT: sp - wind speed [m/s] 9 | % z - measurement height [m] 10 | % Ta - air temperature (optional) [C] 11 | % rhoa - air density (optional) [kg/m^3] 12 | % 13 | % OUTPUT: tau - wind stress [N/m^2] 14 | 15 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 | % 3/8/97: version 1.0 17 | % 8/26/98: version 1.1 (revised by RP) 18 | % 4/2/99: versin 1.2 (air density option added by AA) 19 | % 8/5/99: version 2.0 20 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 21 | 22 | % load constants 23 | as_consts; 24 | 25 | if nargin == 2, 26 | Ta = Ta_default; 27 | rhoa = rho_air; 28 | elseif nargin == 3 29 | rhoa = rho_air; 30 | end 31 | 32 | [cd,u10] = cdntc(sp,z,Ta); 33 | tau = rhoa*(cd.*u10.^2); 34 | 35 | -------------------------------------------------------------------------------- /spshfttc.m: -------------------------------------------------------------------------------- 1 | function [sp2,ustar]=spshfttc(sp1,z1,z2,Ta) 2 | % SPSHFTTC: adjusts wind speed from z1 to z2 following Smith (1988). 3 | % sp2 = SPSHFTTC(sp1,z1,z2,Ta) shifts the wind speed sp1 measured at z1 to 4 | % z2 using the neutral drag coefficient given the wind speed and air 5 | % temperature at height z following Smith (1988), J. Geophys. Res., 93, 6 | % 311-326. Assumes z1 and z2 scalars. Ta may be a constant. 7 | % 8 | % INPUT: sp1 - measured wind speed [m/s] 9 | % z1 - measurement height [m] 10 | % z2 - desired height [m] 11 | % Ta - air temperature ([C] (optional) 12 | % 13 | % OUTPUT: sp2 - predicted wind speed [m/s] 14 | % ustar - fiction velocity [m/s] 15 | 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % 3/8/97: version 1.0 18 | % 8/27/98: version 1.1 (revised to use CDNTC efficiently by RP) 19 | % 8/5/99: version 2.0 20 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 21 | 22 | % set constants 23 | as_consts; 24 | 25 | if nargin==3, 26 | Ta=Ta_default; 27 | end; 28 | 29 | % find cd and ustar 30 | [cd,sp10]=cdntc(sp1,z1,Ta); 31 | 32 | ustar=sqrt(cd).*sp10; 33 | 34 | sp2=sp10+ustar.*log(z2./10)/kappa; 35 | -------------------------------------------------------------------------------- /cdnlp.m: -------------------------------------------------------------------------------- 1 | function [cd,u10]=cdnlp(sp,z) 2 | % CDNLP: computes neutral drag coefficient following Large&Pond (1981). 3 | % [cd,u10]=CDNLP(sp,z) computes the neutral drag coefficient and wind 4 | % speed at 10m given the wind speed at height z following Large and 5 | % Pond (1981), J. Phys. Oceanog., 11, 324-336. 6 | % 7 | % INPUT: sp - wind speed [m/s] 8 | % z - measurement height [m] 9 | % 10 | % OUTPUT: cd - neutral drag coefficient at 10m 11 | % u10 - wind speed at 10m [m/s] 12 | 13 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 14 | % 3/8/97: version 1.0 15 | % 8/26/98: version 1.1 (vectorized by RP) 16 | % 8/5/99: version 2.0 17 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 18 | 19 | as_consts; % define physical constants 20 | a=log(z./10)/kappa; % log-layer correction factor 21 | tol=.001; % tolerance for iteration [m/s] 22 | 23 | u10o=zeros(size(sp)); 24 | cd=1.15e-3*ones(size(sp)); 25 | u10=sp./(1+a.*sqrt(cd)); 26 | 27 | ii=abs(u10-u10o)>tol; 28 | while any(ii(:)), 29 | u10o=u10; 30 | cd=(4.9e-4+6.5e-5*u10o); % compute cd(u10) 31 | cd(u10o<10.15385)=1.15e-3; 32 | u10=sp./(1+a.*sqrt(cd)); % next iteration 33 | ii=abs(u10-u10o)>tol; % keep going until iteration converges 34 | end; 35 | -------------------------------------------------------------------------------- /yearday.m: -------------------------------------------------------------------------------- 1 | function yd=yearday(mon,day,leapyr) 2 | % YEARDAY: converts calender month and day into yearday. 3 | % yd = YEARDAY(mon,day,leapyr) converts calender month and day into yearday. 4 | % If year is not a leap year, then omit the third input variable. If year 5 | % is a leap year, then enter leapyr=1. 6 | % 7 | % INPUT: mon - month 8 | % day - day 9 | % leapyr - set to 1 if it is a leap year, otherwise omit 10 | % 11 | % OUTPUT: yd - year day 12 | % 13 | % Examples: 15 March 1995 = yearday(3,15) = 74 14 | % 15 March 1996 = yearday(3,15,1) = 75 15 | 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % 8/19/98: version 1.1 18 | % 8/5/99: version 2.0 19 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 20 | 21 | m=mon; 22 | d=day; 23 | 24 | % compute yd for non-leap year 25 | if m==1,y=d;end; 26 | if m==2,y=31+d;end; 27 | if m==3,y=59+d;end; 28 | if m==4,y=90+d;end; 29 | if m==5,y=120+d;end; 30 | if m==6,y=151+d;end; 31 | if m==7,y=181+d;end; 32 | if m==8,y=212+d;end; 33 | if m==9,y=243+d;end; 34 | if m==10,y=273+d;end; 35 | if m==11,y=304+d;end; 36 | if m==12,y=334+d;end; 37 | end 38 | yd=y; 39 | % adjust for leap year 40 | if nargin > 2, 41 | if (leapyr==1 & m>=3) 42 | yd=yd+1; 43 | end 44 | end 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /binave.m: -------------------------------------------------------------------------------- 1 | function bindat = binave(data,r) 2 | % BINAVE: averages vector data in bins of length r. 3 | % bindat=BINAVE(data,r) computes an average vector of the vector 4 | % data in bins of length r. The last bin may be the average of 5 | % less than r elements. Useful for computing daily average time 6 | % series (with r=24 for hourly data). 7 | % 8 | % INPUT: data - data vector 9 | % r - number of elements in bin to be averaged 10 | % 11 | % OUTPUT: bindat - bin-averaged vector 12 | 13 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 14 | % 3/8/97: version 1.0 15 | % 9/19/98: version 1.1 (vectorized by RP) 16 | % 8/5/99: version 2.0 17 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 18 | 19 | % check input 20 | if nargin < 2 21 | error('Not enough input arguments.') 22 | end 23 | if abs(r-fix(r)) > eps 24 | error('Bin size R must be a positive integer.') 25 | end 26 | if fix(r) == 1 27 | bindat = data; 28 | return 29 | end 30 | if r <= 0 31 | error('Bin size R must be a positive integer.') 32 | end 33 | 34 | [N,M]=size(data); 35 | 36 | % compute bin averaged series 37 | l = length(data)/r; 38 | l = fix(l); 39 | bindat = mean(reshape(data(1:l*r),r,l)); 40 | 41 | if length(data)>l*r, 42 | bindat=[bindat,mean(data(l*r+1:end))]; 43 | end; 44 | 45 | if N~=1 46 | bindat=bindat'; 47 | end 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /qsat.m: -------------------------------------------------------------------------------- 1 | function q=qsat(Ta,Pa) 2 | % QSAT: computes specific humidity at saturation. 3 | % q=QSAT(Ta) computes the specific humidity (kg/kg) at satuation at 4 | % air temperature Ta (deg C). Dependence on air pressure, Pa, is small, 5 | % but is included as an optional input. 6 | % 7 | % INPUT: Ta - air temperature [C] 8 | % Pa - (optional) pressure [mb] 9 | % 10 | % OUTPUT: q - saturation specific humidity [kg/kg] 11 | 12 | % Version 1.0 used Tetens' formula for saturation vapor pressure 13 | % from Buck (1981), J. App. Meteor., 1527-1532. This version 14 | % follows the saturation specific humidity computation in the COARE 15 | % Fortran code v2.5b. This results in an increase of ~5% in 16 | % latent heat flux compared to the calculation with version 1.0. 17 | 18 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 19 | % 3/8/97: version 1.0 20 | % 4/7/99: version 1.2 (revised as above by AA) 21 | % 8/5/99: version 2.0 22 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 23 | 24 | if nargin==1, 25 | as_consts; 26 | Pa=P_default; % pressure in mb 27 | end; 28 | 29 | % original code 30 | % a=(1.004.*6.112*0.6220)./Pa; 31 | % q=a.*exp((17.502.*Ta)./(240.97+Ta)) 32 | 33 | % as in Fortran code v2.5b for COARE 34 | ew = 6.1121*(1.0007+3.46e-6*Pa).*exp((17.502*Ta)./(240.97+Ta)); % in mb 35 | q = 0.62197*(ew./(Pa-0.378*ew)); % mb -> kg/kg 36 | -------------------------------------------------------------------------------- /cdntc.m: -------------------------------------------------------------------------------- 1 | function [cd,u10]=cdntc(sp,z,Ta) 2 | % CTDTC: computes the neutral drag coefficient following Smith (1988). 3 | % [cd,u10]=CDNTC(sp,z,Ta) computes the neutral drag coefficient and 4 | % wind speed at 10m given the wind speed and air temperature at height z 5 | % following Smith (1988), J. Geophys. Res., 93, 311-326. 6 | % 7 | % INPUT: sp - wind speed [m/s] 8 | % z - measurement height [m] 9 | % Ta - air temperature (optional) [C] 10 | % 11 | % OUTPUT: cd - neutral drag coefficient at 10m 12 | % u10 - wind speed at 10m [m/s] 13 | 14 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 15 | % 3/8/97: version 1.0 16 | % 8/26/98: version 1.1 (vectorized by RP) 17 | % 8/5/99: version 2.0 18 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 19 | 20 | % get constants 21 | as_consts; 22 | 23 | if nargin==2, 24 | Ta=Ta_default; 25 | end; 26 | 27 | % iteration endpoint 28 | tol=.00001; 29 | 30 | visc=viscair(Ta); 31 | 32 | % remove any sp==0 to prevent division by zero 33 | i=find(sp==0); 34 | sp(i)=.1.*ones(length(i),1); 35 | 36 | % initial guess 37 | ustaro=zeros(size(sp)); 38 | ustarn=.036.*sp; 39 | 40 | % iterate to find z0 and ustar 41 | ii=abs(ustarn-ustaro)>tol; 42 | while any(ii(:)), 43 | ustaro=ustarn; 44 | z0=Charnock_alpha.*ustaro.^2./g + R_roughness*visc./ustaro; 45 | ustarn=sp.*(kappa./log(z./z0)); 46 | ii=abs(ustarn-ustaro)>tol; 47 | end 48 | 49 | sqrcd=kappa./log((10)./z0); 50 | cd=sqrcd.^2; 51 | 52 | u10=ustarn./sqrcd; 53 | -------------------------------------------------------------------------------- /swhf.m: -------------------------------------------------------------------------------- 1 | function [qsw,alb]=swhf(yd,yr,long,lat,dsw) 2 | % SWHF: computes net shortwave heat flux into the ocean and albedo. 3 | % [qsw,alb]=SWHF(yd,yr,long,lat,dsw) computes the net shortwave heat 4 | % flux into the ocean and albedo, using Payne (1972), J. Atm. Sci., 29, 5 | % 959-970, to estimate the instantaneous albedo given the atmospheric 6 | % transmittance (the ratio of measured insolation to the no-atmosphere 7 | % insolation). 8 | % 9 | % INPUT: yd - decimal yearday (e.g., 0000Z Jan 1 is 0.0) 10 | % yr - year (e.g., 1995) 11 | % long - longitude [deg] 12 | % lat - latitude [deg] 13 | % dsw - (measured) insolation [W/m^2] 14 | % 15 | % OUTPUT: qsw - net shortwave heat flux [W/m^2] 16 | % alb - albedo 17 | 18 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 19 | % 3/8/97: version 1.0 20 | % 7/29/99: version 1.1 21 | % 8/5/99: version 2.0 22 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 23 | 24 | % compute sun altitude and no atm solar radiation 25 | [sunalt, sorad]=soradna1(yd,yr,long,lat); 26 | 27 | % compute atm transmittance (note: trans=Inf when sorad=0) 28 | trans=inf.*ones(size(sorad)); 29 | j=find(sorad>0); 30 | trans(j)=dsw(j)./sorad(j); 31 | 32 | % compute albedo (note: alb=NaN when trans>1 or sunalt<0) 33 | alb=albedo(trans, sunalt); 34 | 35 | % compute net shortwave heat flux 36 | % (note: qsw set equal to 0 when alb=NaN) 37 | qsw=(1-alb).*dsw; 38 | ind=find(isnan(qsw)); 39 | qsw(ind)=zeros(size(ind)); 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /cdnve.m: -------------------------------------------------------------------------------- 1 | function [cd,u10]=cdnve(sp,z) 2 | % CDNVE: computes neutral drag coefficient following Vera (1983). 3 | % [cd,u10]=CDNVE(sp,z) computes the neutral drag coefficient and wind 4 | % speed at 10m given the wind speed at height z. Uses the expression 5 | % for friction velocity derived by E. Vera (1983) and published as 6 | % eqn. 8 in Large, Morzel, and Crawford (1995), J. Phys. Oceanog., 25, 7 | % 2959-2971. Range of fit to data is 1 to 25 m/s. 8 | % 9 | % INPUT: sp - wind speed [m/s] 10 | % z - measurement height [m] 11 | % 12 | % OUTPUT: cd - neutral drag coefficient at 10m 13 | % u10 - wind speed at 10m [m/s] 14 | 15 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 | % 3/8/97: version 1.0 17 | % 8/26/98: version 1.1 (modified by RP) 18 | % 8/5/99: version 2.0 19 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 20 | 21 | % constants in fit for drag coefficient 22 | A=2.717e-3; 23 | B=0.142e-3; 24 | C=0.0764e-3; 25 | 26 | as_consts; % other constants 27 | a=log(z./10)/kappa; % log-layer correction factor 28 | tol=.001; % tolerance for iteration (m/s) 29 | 30 | u10o=zeros(size(sp))+.1; % don't start iteration at 0 to prevent blowups. 31 | cd=(A./u10o + B + C*u10o); 32 | 33 | u10=sp./(1+a.*sqrt(cd)); 34 | 35 | ii=abs(u10-u10o)>tol; 36 | while any(ii(:)), 37 | u10o=u10; 38 | cd=(A./u10o + B + C*u10o); 39 | u10=sp./(1+a.*sqrt(cd)); % next iteration 40 | ii=abs(u10-u10o)>tol; % keep going until iteration converges 41 | end; 42 | 43 | 44 | -------------------------------------------------------------------------------- /wavdist1.m: -------------------------------------------------------------------------------- 1 | function Ut=wavdist1(Ua,za,Hw) 2 | % WAVDIST1: estimates wave effects on wind speed measured at za. 3 | % Ut=WAVDIST1(Ua,za,Hw) computes the 'true' wind speed Ut at the 4 | % measurement height za using the wind speed Ua measured at za and 5 | % measured wave height Hw. 6 | % 7 | % INPUT: Ua - wind speed [m/s] 8 | % za - wind measurement height [m] 9 | % Hw - wave height [m] 10 | % 11 | % OUTPUT: Ut - 'true' wind speed [m/s] 12 | 13 | % WAVDIST1 computes Ut from Ua using the neutral log profile corrected 14 | % for the effects of low-level distortion of the wind profile by surface 15 | % waves following Large, Morzel, and Crawford (1995), J. Phys. Oceanog., 16 | % 25, 2959-2971. 17 | 18 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 19 | % 5/5/97: version 1.0 20 | % 7/28/99: version 1.1 21 | % 8/5/99: version 2.0 22 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 23 | 24 | k=0.4; 25 | z10=10; 26 | A=log(z10./za)./k; 27 | 28 | % eliminate any Ua==0 29 | jj=find(Ua==0); 30 | Ua(jj)=0.01.*ones(size(Ua(jj))); 31 | 32 | % compute uncorrected 10m wind speed 33 | u10=Ua; % initial guess 34 | for n=1:10; 35 | ustar=sqrt(cdnve(u10).*u10.^2); 36 | u10=Ua+ustar.*A; 37 | end 38 | 39 | % compute corrected 10m wind speed 40 | Ustar=ustar;U10=u10; % initial guesses 41 | Za=za./Hw;Z10=z10./Hw; 42 | for n=1:10; 43 | Ustar=sqrt(cdnve(U10).*U10.^2); 44 | U10=Ua+Ustar.*(log(z10./za)-omegalmc(Z10)+omegalmc(Za))./k; 45 | end 46 | 47 | % compute 'true' wind speed at za using U10, Ustar 48 | Ut=U10-Ustar.*A; 49 | 50 | -------------------------------------------------------------------------------- /julianmd.m: -------------------------------------------------------------------------------- 1 | function [j]=julianmd(y,m,d,h) 2 | % JULIANMD: converts Gregorian calendar time to decimal Julian day. 3 | % [j]=JULIANMD(y,m,d,h) converts Gregorian calendar dates to corresponding 4 | % Julian day numbers. Although the formal definition holds that Julian 5 | % days start and end at noon, here Julian days start and end at midnight. 6 | % In this convention, Julian day 2440000 began at 0000 UT, May 23, 1968. 7 | % 8 | % INPUT: d - day (1-31) component of Gregorian date 9 | % m - month (1-12) component 10 | % y - year (e.g., 1979) component 11 | % h - decimal hours (assumed 0 if absent) 12 | % 13 | % OUTPUT: j - decimal Julian day number (e.g., 0000 UT Jan 1 is 0.0) 14 | % 15 | % Usage: [j]=julianmd(y,m,d,h) (inputs scalars or matrices) 16 | % or 17 | % [j]=julianmd([y m d hr min sec]) (nx6 matrix input) 18 | 19 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 20 | % 8/28/98: version 1.1 (vectorized by RP) 21 | % 8/5/99: version 2.0 22 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 23 | 24 | if nargin==3, 25 | h=0.; 26 | elseif nargin==1, 27 | h=hms2h(y(:,4),y(:,5),y(:,6)); 28 | d=y(:,3); 29 | m=y(:,2); 30 | y=y(:,1); 31 | end 32 | mo=m+9; 33 | yr=y-1; 34 | i=(m>2); 35 | mo(i)=m(i)-3; 36 | yr(i)=y(i); 37 | c = floor(yr/100); 38 | yr = yr - c*100; 39 | j = floor((146097*c)/4) + floor((1461*yr)/4) + ... 40 | floor((153*mo +2)/5) +d +1721119; 41 | 42 | % if you want Julian days to start and end at noon, 43 | % replace the following line with: 44 | % j=j+(h-12)/24; 45 | 46 | j=j+h/24; 47 | 48 | -------------------------------------------------------------------------------- /greg2.m: -------------------------------------------------------------------------------- 1 | function [gtime]=greg2(yd,yr) 2 | % GREG2: converts decimal yearday to standard Gregorian time. 3 | % [gtime]=GREG2(yd,yr) converts decimal yearday to corresponding 4 | % Gregorian calendar dates. In this convention, Julian day 2440000 5 | % begins at 0000 UT May 23 1968. 6 | % 7 | % INPUT: yd - decimal yearday (e.g., 0000 UT Jan 1 is 0.0) 8 | % yr - year (e.g., 1995) 9 | % 10 | % OUTPUT: gtime is a six component Gregorian time vector 11 | % gtime=[year mo da hr mi sec] 12 | % 13 | % Example: [1995 01 01 12 00 00] = greg2(0.5, 1995) 14 | 15 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 | % 3/10/97: version 1.0 17 | % 4/7/99: version 1.2 (simplified by AA) 18 | % 8/5/99: version 2.0 19 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 20 | 21 | js = julianmd(yr,01,01,00); 22 | julian = js + yd; 23 | julian=julian+5.e-9; % kludge to prevent roundoff error on seconds 24 | 25 | % if you want Julian Days to start at noon... 26 | % h=rem(julian,1)*24+12; 27 | % i=(h >= 24); 28 | % julian(i)=julian(i)+1; 29 | % h(i)=h(i)-24; Otherwise,.... 30 | 31 | secs=rem(julian,1)*24*3600; 32 | 33 | j = floor(julian) - 1721119; 34 | in = 4*j -1; 35 | y = floor(in/146097); 36 | j = in - 146097*y; 37 | in = floor(j/4); 38 | in = 4*in +3; 39 | j = floor(in/1461); 40 | d = floor(((in - 1461*j) +4)/4); 41 | in = 5*d -3; 42 | m = floor(in/153); 43 | d = floor(((in - 153*m) +5)/5); 44 | y = y*100 +j; 45 | mo=m-9; 46 | yr=y+1; 47 | i=(m<10); 48 | mo(i)=m(i)+3; 49 | yr(i)=y(i); 50 | [hour,min,sec]=s2hms(secs); 51 | gtime=[yr(:) mo(:) d(:) hour(:) min(:) sec(:)]; 52 | 53 | 54 | -------------------------------------------------------------------------------- /wavedist.m: -------------------------------------------------------------------------------- 1 | function [U10,delU]=wavedist(Ua,za,Hw) 2 | % WAVEDIST: estimates wind speed distortion due to surface waves. 3 | % [U10,delU]=WAVEDIST(Ua,za,Hw) computes the true 10m wind speed U10 4 | % using the wind speed Ua measured at the height za and measured wave 5 | % height Hw and the neutral log profile corrected for the effects of 6 | % low-level distortion of the wind profile by surface waves following 7 | % Large, Morzel, and Crawford (1995), J. Phys. Ocean., 25, 2959-2971. 8 | % 9 | % INPUT: Ua - wind speed [m/s] 10 | % za - wind measurement height [m] 11 | % Hw - wave height [m] 12 | % 13 | % OUTPUT: U10 - true 10m wind speed [m/s] 14 | % delU - difference between true and uncorrected 15 | % 10m wind speed [m/s] 16 | 17 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 18 | % 8/31/98: version 1.1 19 | % 8/5/99: version 2.0 20 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 21 | 22 | % get constants 23 | as_consts; 24 | 25 | tol=.001; % change in u10 to stop iteration 26 | 27 | zs=10; % reference height 28 | 29 | Xia=za./Hw;Xis=zs./Hw; 30 | 31 | % compute uncorrected 10m wind speed and ustar (as initial guess in iteration) 32 | [cd10,u10]=cdnve(Ua,za); 33 | Ustar=sqrt(cd10).*u10; 34 | 35 | % compute corrected 10m wind speed 36 | U10=u10; 37 | U10o=0; 38 | k=0; 39 | while max(abs(U10-U10o))>tol & k<15, 40 | U10o=U10; 41 | k=k+1; 42 | Ustar=sqrt(cdnve(U10,10).*U10.^2); 43 | U10=Ua+Ustar.*(log(zs./za)-omegalmc(Xis)+omegalmc(Xia))./kappa; 44 | end 45 | 46 | if k==15, 47 | warning('Iteration may not have converged'); 48 | end; 49 | 50 | delU=U10-u10; 51 | 52 | 53 | -------------------------------------------------------------------------------- /relhumid.m: -------------------------------------------------------------------------------- 1 | function rh=relhumid(Td,Tw,P,p_typ) 2 | % RELHUMID: finds relative humidity from wet/dry thermometer readings. 3 | % rh=relhumid(Td,Tw,Pa,type) computes the relative humidity from 4 | % wt and dry-bulb temperature measurements using the psychrometric eqn. 5 | % and constants from Sargent (1980), Meteorol. Mag. 109, 238-246. The 6 | % latter two inputs are optional. 7 | % 8 | % INPUTS : Td - dry bulb thermometer [C] 9 | % Tw - wet thermometer [C] 10 | % Pa - air pressure (optional) [mb] 11 | % type - 'assman' for Assman-type forced ventilation 12 | % 'screen' for standard screen (natural ventilation) 13 | % 14 | % OUTPUT: rh - relative humidity [%] 15 | 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % 8/28/98: version 1.1 (contributed by RP) 18 | % 8/5/99: version 2.0 19 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 20 | 21 | as_consts; 22 | 23 | if nargin==2, 24 | P=P_default; 25 | p_typ=psych_default; 26 | elseif nargin==3, 27 | if isstr(P), 28 | p_typ=P; 29 | P=P_default; 30 | else 31 | p_typ=psych_default; 32 | end; 33 | end; 34 | 35 | % psychrometric coefficient 36 | 37 | switch p_typ, 38 | case 'screen', 39 | A=0.000799; % natural screens 40 | case 'assman', 41 | A = 0.000667; % Assmann-type with forced ventilation 42 | otherwise 43 | error(['unknown psychrometer type: ' p_typ]); 44 | end; 45 | 46 | % compute saturation vapour pressure for both temps. 47 | ed=satvap(Td,P); 48 | ewp=satvap(Tw,P); 49 | 50 | % The psychrometric eqn! 51 | e = ewp - A*P.*(Td-Tw); % ambient vapour pressure 52 | 53 | rh= e./ed * 100; 54 | 55 | -------------------------------------------------------------------------------- /lwhf.m: -------------------------------------------------------------------------------- 1 | function qlw=lwhf(Ts,dlw,dsw) 2 | % LWHF: computes net longwave heat flux following Dickey et al (1994). 3 | % qlw=LWHF(Ts,dlw) computes the net longwave heat flux into the ocean. 4 | % Following Dickey et al (1994), J. Atmos. Oceanic Tech., 11, 1057-1078, 5 | % the incident longwave flux can be corrected for sensor heating due to 6 | % insolation if you are using Epply or Kipp & Zonen CG1 pyrgeometers. 7 | % In this case, use qlw=LWHF(Ts,dlw,dsw). Epply is the default 8 | % pyrgeometer; change code for the Kipp & Zonen instrument. 9 | % 10 | % INPUT: Ts - sea surface temperature [C] 11 | % dlw - (measured) downward longwave flux [W/m^2] 12 | % dsw - (measured) insolation [W/m^2] (needed for Eppley 13 | % or Kipp & Zonen pyrgeometers) 14 | % 15 | % OUTPUT: qlw - net longwave heat flux [W/m^2] 16 | 17 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 18 | % 3/8/97: version 1.0 19 | % 8/19/98: version 1.1 (revised for non-Epply pyrgeometers by RP) 20 | % 4/9/99: version 1.2 (included Kipp & Zonen CG1 pyrgeometers by AA) 21 | % 8/5/99: version 2.0 22 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 23 | 24 | % get constants 25 | as_consts; 26 | 27 | % convert degC to degK 28 | ts=Ts+CtoK; 29 | 30 | % correct dlw for sensor heating by insolation 31 | if nargin==3, 32 | % this line is for Epply pyrgeometers 33 | dlwc=dlw-0.036.*dsw; 34 | 35 | % this line is for Kipp & Zonen CG1 pyrgeometers 36 | % (the offset is specified as 25 W/m^2 at 1000 W/m^2) 37 | % dlwc=dlw-0.025.*dsw; 38 | else 39 | dlwc=dlw; 40 | end; 41 | 42 | % compute upward gray-body longwave flux 43 | lwup=-emiss_lw.*sigmaSB.*(ts.^4); 44 | 45 | % compute net flux 46 | qlw=lwup + emiss_lw.*dlwc; 47 | 48 | -------------------------------------------------------------------------------- /wdnotes.m: -------------------------------------------------------------------------------- 1 | % WDNOTES: notes on estimating wave effects on wind measurements. 2 | % The following set of mfiles can be used to correct the wind speed 3 | % Ua measured at height za for the effects of the wave boundary layer 4 | % following the empirical model presented by Large, Morzel, and 5 | % Crawford (1995), J. Phys. Oceanog., 25, 2959-2971. In particular, 6 | % an analytic expression was found for the omega function (omegalmc.m) 7 | % shown in their Fig. 9b, which allows the 'true' wind speed (Ut10) 8 | % and stress at 10m (assumed above the wave boundary layer height) 9 | % to be computed using wavedist.m and the true wind speed (Uta) at the 10 | % measurement height za using wavedis1.m. The Large et al model assumes 11 | % neutral stability (reasonable for high winds and wave conditions) 12 | % and uses a 10-m neutral drag law (cdnve.m) based on Vera (1983; 13 | % unpublished manuscript). This drag law follows Large and Pond (1982) 14 | % for winds above 10 m/s but increases at lower wind speeds like 15 | % Smith (1987). The wave field is specified by the significant wave 16 | % height Hw. 17 | % 18 | % To compute 'true' wind speed Uta at za given Hw, use 19 | % Uta=wavedis1(Ua,za,Hw). 20 | % 21 | % To compute 'true' wind speed Ut at 10m given Hw, use 22 | % [Ut10,(Ut10-U10)]=wavedist(Ua,za,Hw). 23 | % 24 | % To plot the predicted effects of wave distortion on the wind Ua 25 | % measured at the height za for a range of significant wave heights 26 | % Hw=[0:2:8] in m, use 27 | % y=wavedis2(za). 28 | % 29 | % Subroutines called: 30 | % y=omegalmc(x) 31 | % cd10=cdnve(u10) 32 | 33 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 34 | % 7/28/99: version 1.1 35 | % 8/5/99: version 2.0 36 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 37 | 38 | -------------------------------------------------------------------------------- /t_hfbulktc.m: -------------------------------------------------------------------------------- 1 | % T_HFBULKTC: a program to test hfbulktc.m using COARE test data 2 | % T_HFBULKTC is a program to test hfbulktc.m using COARE test data 3 | % (file test2_5b.dat). NOTE: Make sure that you use the COARE 4 | % parameters located in the files as_consts.m and cool_skin.m when 5 | % conducting the test. 6 | % 7 | % VARIBLES: 8 | % 9 | % ur = wind speed [m/s] measured at height zr [m] 10 | % Ta = air temperature [C] measured at height zt [m] 11 | % rh = relative humidity [%] measured at height zq [m] 12 | % Pa = air pressure [mb] 13 | % Ts = sea surface temperature [C] 14 | % sal = salinity [psu (PSS-78)] 15 | % dlw = downwelling (INTO water) longwave radiation [W/m^2] 16 | % dsw = measured insolation [W/m^2] 17 | % nsw = net shortwave radiation INTO the water [W/m^2] 18 | % rain = rain rate [mm/hr] 19 | 20 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 21 | % 4/7/99: version 1.2 (contributed by AA) 22 | % 8/5/99: version 2.0 23 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 24 | 25 | % change directory to yours 26 | load c:\flux_fsu\test\test2_5b.dat 27 | 28 | % parse data 29 | ur = test2_5b(:,2); 30 | zr = 15; 31 | Ta = test2_5b(:,4); 32 | zt = 15; 33 | Pa = 1008*ones(size(ur)); 34 | q = test2_5b(:,5); 35 | rh = q./qsat(Ta,Pa)/10; 36 | zq = 15; 37 | Ts = test2_5b(:,14); 38 | sal = 30*ones(size(ur)); 39 | dsw = test2_5b(:,9); 40 | nsw = 0.945*dsw; 41 | dlw = test2_5b(:,10); 42 | rain= test2_5b(:,11); 43 | 44 | i=[1:length(ur)]; 45 | % i=[1:10]; 46 | % NO cool-skin; compare to COARE output in file no_skin.out 47 | A1 = hfbulktc(ur(i),zr,Ta(i),zt,rh(i),zq,Pa(i),Ts(i)); 48 | 49 | % YES cool-skin; compare to COARE output file yes_skin.out 50 | A2 = hfbulktc(ur(i),zr,Ta(i),zt,rh(i),zq,Pa(i),Ts(i), ... 51 | sal(i),dlw(i),dsw(i),nsw(i)); 52 | 53 | -------------------------------------------------------------------------------- /sw_visc.m: -------------------------------------------------------------------------------- 1 | function visc = sw_visc(S,T,P) 2 | 3 | % SW_VISC kinematic viscosity 4 | %=========================================================================== 5 | % SW_VISC $Revision: 0.0 $ $Date: 1998/01/19 $ 6 | % Copyright (C) Ayal Anis 1998. 7 | % 8 | % USAGE: visc = sw_visc(S,T,P) 9 | % 10 | % DESCRIPTION: 11 | % Calculates kinematic viscosity of sea-water. 12 | % based on Dan Kelley's fit to Knauss's TABLE II-8 13 | % 14 | % INPUT: (all must have same dimensions) 15 | % S = salinity [psu (PSS-78) ] 16 | % T = temperature [degree C (IPTS-68)] 17 | % P = pressure [db] 18 | % (P may have dims 1x1, mx1, 1xn or mxn for S(mxn) ) 19 | % 20 | % OUTPUT: 21 | % visc = kinematic viscosity of sea-water [m^2/s] 22 | % 23 | % visc(40.,40.,1000.)=8.200167608E-7 24 | % 25 | % DISCLAIMER: 26 | % This software is provided "as is" without warranty of any kind. 27 | %========================================================================= 28 | 29 | % CALLER: general purpose 30 | % CALLEE: sw_dens.m 31 | 32 | %------------- 33 | % CHECK INPUTS 34 | %------------- 35 | if nargin ~= 3 36 | error('sw_visc.m: Must pass 3 parameters ') 37 | end 38 | 39 | % CHECK S,T dimensions and verify consistent 40 | [ms,ns] = size(S); 41 | [mt,nt] = size(T); 42 | 43 | % CHECK THAT S & T HAVE SAME SHAPE 44 | if (ms~=mt) | (ns~=nt) 45 | error('check_stp: S & T must have same dimensions') 46 | end %if 47 | 48 | % LET sw_dens.m DO DIMENSION CHECKING FOR P 49 | 50 | % IF ALL ROW VECTORS ARE PASSED THEN LET US PRESERVE SHAPE ON RETURN. 51 | Transpose = 0; 52 | if ms == 1 % row vector 53 | T = T(:); 54 | S = S(:); 55 | 56 | Transpose = 1; 57 | end %if 58 | 59 | %------ 60 | % BEGIN 61 | %------ 62 | 63 | visc = 1e-4*(17.91-0.5381*T+0.00694*T.^2+0.02305*S)./sw_dens(S,T,P); 64 | 65 | if Transpose 66 | visc = visc'; 67 | end %if 68 | 69 | return 70 | %========================================================================= 71 | 72 | -------------------------------------------------------------------------------- /sunrise.m: -------------------------------------------------------------------------------- 1 | function [rhr,rmin,shr,smin]=sunrise(mon,da,yr,lat,long) 2 | % SUNRISE: computes sunrise and sunset times for specified day and location. 3 | % [rhr,rmin,shr,smin] = SUNRISE(mon,da,yr,lat,long) computes the time 4 | % of sunrise rhr:rmin and sunset shr:smin to the nearest minute in GMT 5 | % for a calendar day(s) and a specified (scalar) position. 6 | % 7 | % INPUT: mon - month (e.g., Jan is 1) 8 | % da - day (e.g., Jan 10th is 10) 9 | % yr - year (e.g., 1995) 10 | % lat - latitude [deg] 11 | % long - longitude (west is positive) [deg] 12 | % 13 | % OUTPUT: rhr,rmin - sunrise in GMT hours and minutes 14 | % shr,smin - sunset in GMT hours and minutes. 15 | 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % 8/28/98: version 1.1 (contributed by RP) 18 | % 8/5/99: version 2.0 19 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 20 | 21 | % convert calender time to julian yd 22 | j=julianmd(yr,mon,da,0); 23 | j0=julianmd(yr,1,1,0); 24 | yd=j(:)-j0(:); 25 | 26 | % compute solar altitude for entire day 27 | dt=1./2880; 28 | 29 | % we don't want abs(long)>180... 30 | if long<-180, long=long+360; end; 31 | if long>180, long=long-360; end; 32 | 33 | time=dt.*[0:2879]'+long/360; % have a whole day, beginning at midnight (near enough) 34 | yday=yd(ones(1,2880),:)+time(:,ones(length(yd),1)); 35 | 36 | if length(yr)>1, 37 | yr=yr(:,ones(1,2880))'; 38 | end; 39 | 40 | [z,sorad]=soradna1(yday(:),yr(:),long,lat); 41 | 42 | z=reshape(z,2880,length(yd)); 43 | sorad=reshape(sorad,2880,length(yd)); 44 | 45 | [ir,jr]=find(sorad(1:2879,:)==0 & sorad(2:2880,:)>0); 46 | [is,js]=find(sorad(2:2880,:)==0 & sorad(1:2879,:)>0); 47 | 48 | srise=zeros(length(yd),1); 49 | sset=any(sorad>0); 50 | 51 | srise(jr)=yday(ir+(jr-1)*2880); 52 | sset(js) =yday(is+(js-1)*2880); 53 | 54 | rhr=fix(rem(srise,1)*24); 55 | rmin=rem(rem(srise,1)*1440,60); 56 | shr=fix(rem(sset,1)*24); 57 | smin=rem(rem(sset,1)*1440,60); 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /slhftc.m: -------------------------------------------------------------------------------- 1 | function [qsen,qlat,tau,theta,A]=slhftc(ua,va,uo,vo,zr,Ta,zt,rh,zq,Pa,Ts) 2 | % SLHFTC: computes sensible and latent heat flux following TOGA/COARE. 3 | % [qsen,qlat,tau,theta,A]=SLHFTC(ua,va,uo,vo,zr,Ta,zt,rh,zq,ap,Ts) computes 4 | % the sensible and latent heat fluxes into the ocean and the surface wind 5 | % stress based on the Fairall et al (1996) COARE code. (see HFBULKTC for 6 | % description). Assumes input series are either column or row vectors; 7 | % zr, zt, and zq are fixed scalars, and rh and/or Pa may be scalars. 8 | % The output variables are column vectors and the column matrix A. NOTE: 9 | % user must decide if cool-skin and Webb corrections are to be included. 10 | % 11 | % INPUT: ua,va - east, north wind components [m/s] 12 | % uo,vo - east, north ocean surface currents [m/s] 13 | % zr - wind measurement height [m] 14 | % Ta - air temperature [C] 15 | % zt - air temperature measurement height [m] 16 | % rh - relative humidity [%] 17 | % zq - rh measurement height [m] 18 | % Ts - sea surface temperature [C] 19 | % Pa - air pressure [mb] 20 | % 21 | % OUTPUT: qsen - sensible heat flux [W/m^2] 22 | % qlat - latent heat flux [W/m^2] 23 | % tau - wind stress magnitude [Pa] 24 | % theta - direction of wind stress [deg CCW from east] 25 | % A - 12 column matrix of auxilary diagnostic outputs 26 | % (see HFBULKTC for details) 27 | 28 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 29 | % 8/28/98: version 1.1 (contributed by RP) 30 | % 8/5/99: version 2.0 31 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 32 | 33 | % compute relative velocity magnitude and direction 34 | du=ua-uo; 35 | dv=va-vo; 36 | spd=sqrt(du.^2+dv.^2); 37 | theta=(180./pi).*atan2(dv,du); 38 | 39 | % change column vector to row vector if necessary 40 | [m n] = size(spd); 41 | if m > n 42 | spd = spd'; 43 | end 44 | % keep theta a column vector 45 | [m n] = size(theta); 46 | if n > m 47 | theta = theta'; 48 | end 49 | 50 | % compute fluxes 51 | A = hfbulktc(spd,zr,Ta,zt,rh,zq,Pa,Ts); qsen=A(:,1); % no cool_skin, Webb correction 52 | qlat=A(:,2); 53 | tau=A(:,4); 54 | 55 | 56 | -------------------------------------------------------------------------------- /clskswr.m: -------------------------------------------------------------------------------- 1 | function sradav = clskswr(yd,lat) 2 | % CLSKSWR: computes clear sky insolation following Seckel&Beaudry (1973). 3 | % sradav = CLSKSWR(yd,lat) computes average clear sky solar insolation 4 | % based on the Seckel and Beaudry (1973) formula presented in Reed (1977), 5 | % J. Phys. Ocean., 7, 482-485. Assumes the year is not a leap year. 6 | % 7 | % INPUT: yd - yearday (e.g., Jan 10th is 10) 8 | % lat - latitude [deg] 9 | % 10 | % OUTPUT: sradav - clear sky mean daily insolation [W/m^2] 11 | 12 | % NOTE: The output appears to be very similar to what you would get by 13 | % averaging soradna.m output over a day and then assuming an 14 | % atmospheric transmission of 0.7 (with differences of order 10% 15 | % for latitudes below 40N, and increasing to 30% in winter at 60N). 16 | % In absolute terms the agreement is to within +/-25 W/m^2. 17 | 18 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 19 | % 3/8/97: version 1.0 20 | % 8/28/98: version 1.1 (vectorized by RP) 21 | % 8/5/99: version 2.0 22 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 23 | 24 | radlat = pi*lat/180; 25 | 26 | if length(lat)==1, 27 | lat=lat+zeros(size(yd)); 28 | end; 29 | 30 | % check if yd is negative 31 | ind=find(yd<0); 32 | yd(ind)=yd(ind)+365; 33 | % truncate to integer yearday for use with formula 34 | yd=fix(yd); 35 | 36 | phi = (yd-21)*360/365; 37 | phi = pi*phi/180; 38 | 39 | sradav=zeros(size(yd))+zeros(size(lat))+NaN; 40 | 41 | ii= lat>=-20 & lat<40; 42 | if any(ii(:)), 43 | a0 = -15.82 + 326.87*cos(radlat(ii)); 44 | a1 = 9.63 + 192.44*cos(radlat(ii)+pi/2); 45 | b1 = -3.27 + 108.70*sin(radlat(ii)); 46 | a2 = -0.64 + 7.80*sin(2*(radlat(ii)-pi/4)); 47 | b2 = -0.50 + 14.42*cos(2*(radlat(ii)-5*pi/180)); 48 | sradav(ii) = a0 + a1.*cos(phi(ii)) + b1.*sin(phi(ii)) + a2.*cos(2*phi(ii)) + b2.*sin(2*phi(ii)); 49 | end 50 | 51 | ii= lat>=40 & lat<=60;; 52 | if any(ii(:)), 53 | l2=lat(ii).^2; 54 | a0 = 342.61 - 1.97*lat(ii) - 0.018*l2; 55 | a1 = 52.08 - 5.86*lat(ii) + 0.043*l2; 56 | b1 = -4.80 + 2.46*lat(ii) -0.017*l2; 57 | a2 = 1.08 - 0.47*lat(ii) + 0.011*l2; 58 | b2 = -38.79 + 2.43*lat(ii) - 0.034*l2; 59 | sradav(ii) = a0 + a1.*cos(phi(ii)) + b1.*sin(phi(ii)) + a2.*cos(2*phi(ii)) + b2.*sin(2*phi(ii)); 60 | end 61 | 62 | if any(lat>60 | lat<-20) 63 | warning('Formula only works for latitudes 20S-60N, see help text for further help') 64 | end 65 | 66 | 67 | -------------------------------------------------------------------------------- /cloudcor.m: -------------------------------------------------------------------------------- 1 | function Fc=cloudcor(C,optns,lat) 2 | % CLOUDCOR: computes cloud correction factor for bulk long-wave flux. 3 | % Fc=CLOUDCOR(C,optns,lat) computes the cloud correction factor F(C) 4 | % as a function of the cloud fraction C for bulk long-wave flux formulae. 5 | % In general, these are functions of the form 6 | % 1 - a_n*C^n 7 | % Since the coefficients and powers depend a lot on the dominant cloud 8 | % type which may vary from region to region and season to season, it is 9 | % not clear which parametrization is best (see Fung et al (1984), 10 | % Rev. of Geophys. and Space Phys., 22, 177-193). 11 | % 12 | % The particular parametrization used here depends on the second input 13 | % variable, for which no default is given to emphasize the fact that you 14 | % really need to understand what you are doing here! 15 | % 16 | % optns = [a1 a2] = use a correction factor of [1-a1*C-a2*C^2]. 17 | % 18 | % There are several "built-in" formulae (from Fung et al) that all have 19 | % a latitude-dependence of some kind. 20 | % 21 | % optns = 'clarke',lat = Clarke (1974) corrections for abs(lat)<50. 22 | % = 'bunker',lat = Bunker (1976) corrections for N Atlantic. 23 | % 24 | % INPUT: C - cloud fraction 25 | % optns - see above for details 26 | % lat - latitude [deg] - required for "built-in" formulae only 27 | % 28 | % OUTPUT: Fc - correction factor used as input to BLWHF 29 | 30 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 31 | % 3/12/98: version 1.1 (contributed by RP) 32 | % 8/5/99: version 2.0 33 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 34 | 35 | if isstr(optns), 36 | 37 | switch optns(1), 38 | case 'c', 39 | a1=0; 40 | if abs(lat)>55, a2=NaN; 41 | elseif abs(lat)>45, a2=0.73; 42 | elseif abs(lat)>35, a2=0.69; 43 | elseif abs(lat)>25, a2=0.64; 44 | elseif abs(lat)>15, a2=0.60; 45 | elseif abs(lat)> 7, a2=0.56; 46 | elseif abs(lat)> 2, a2=0.53; 47 | else a2=0.51; 48 | end; 49 | 50 | case 'b', 51 | a2=0; 52 | if abs(lat)>75, a1=0.84; 53 | elseif abs(lat)>65, a1=0.80; 54 | elseif abs(lat)>55, a1=0.76; 55 | elseif abs(lat)>45, a1=0.72; 56 | elseif abs(lat)>35, a1=0.68; 57 | elseif abs(lat)>25, a1=0.63; 58 | elseif abs(lat)>15, a1=0.59; 59 | elseif abs(lat)>7, a1=0.52; 60 | else a1=0.50; 61 | end; 62 | 63 | otherwise 64 | error('Unrecognized option'); 65 | end; 66 | else 67 | a1=optns(1);a2=optns(2); 68 | end; 69 | 70 | Fc = 1 - a1*C - a2.*C.^2; 71 | -------------------------------------------------------------------------------- /rain_flux.m: -------------------------------------------------------------------------------- 1 | function [tau_rain,heat_rain] = rain_flux(Ta,Pa,rh,rain,Ts,sal,u,zu) 2 | % RAIN_FLUX: computes heat and momentum flux due to rain. 3 | % RAIN_FLUX computes heat flux and momentum flux due to rain. This 4 | % code follows the Fortran program bulk_v25b.f. For more details, 5 | % see Fairall et al. (1996), JGR, 101, 3751-3752. 6 | % 7 | % INPUT: Ta - air temperature [C] 8 | % Pa - air pressure [mb] 9 | % rh - relative humidity [%] 10 | % rain - rain rate [mm/hr] 11 | % Ts - sea surface temperature [C] 12 | % sal - salinity [psu (PSS-78)] 13 | % u - wind speed [m/s] 14 | % zu - wind measurement height [m] 15 | % 16 | % OUTPUT: tau_rain - momentum flux of rainfall [N/m^2] 17 | % heat_rain - heat flux of rainfall (OUT of ocean) [W/m^2] 18 | % 19 | % USAGE: [tau_rain,heat_rain] = RAIN_FLUX(Ta,Pa,rh,rain,Ts,sal,u,zu) 20 | 21 | % NOTE: All input variables should be vectors (either row or column), zu 22 | % may also be a fixed scalar. Output variables are column vectors. 23 | 24 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 25 | % 4/3/99: version 1.2 (contributed by AA) 26 | % 8/5/99: version 2.0 27 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 28 | 29 | % -> column vectors 30 | Ta = Ta(:); Pa = Pa(:); rh = rh(:); rain = rain(:); Ts = Ts(:); 31 | sal = sal(:); u = u(:); zu = zu(:); 32 | 33 | % get constants 34 | as_consts; 35 | cpa = cp; 36 | 37 | 38 | o61 = 1/eps_air - 1; % ~0.61 (moisture correction for temp.) 39 | Qa = 0.01*rh.*qsat(Ta,Pa); % specific humidity of air [kg/kg] 40 | T = Ta + CtoK; % C -> K 41 | Tv = T.*(1 + o61*Qa); % air virtual temperature 42 | rhoa = (100*Pa)./(gas_const_R*Tv); % air density 43 | Le = (2.501-0.00237*Ts)*1e6; % latent heat of vaporization at Ts 44 | Qs = Qsat_coeff*qsat(Ts,Pa); % saturation specific humidity 45 | 46 | 47 | % compute heat flux of rainfall OUT of ocean 48 | dwat = 2.11e-5*(T./CtoK).^1.94; % water vapour diffusivity 49 | dtmp = (1+3.309e-3*Ta-1.44e-6*Ta.^2)*0.02411./(rhoa.*cpa); % heat diffusivity 50 | dqs_dt = Qa.*Le./(gas_const_R*T.^2); % Clausius-Clapeyron 51 | alfac = 1./(1+0.622*(dqs_dt.*Le.*dwat)./(cpa.*dtmp)); % wet bulb factor 52 | cpw = sw_cp(sal,Ts,0); % heat capacity of sea water 53 | 54 | heat_rain = rain.*alfac.*cpw.*((Ts-Ta)+(Qs-Qa).*Le./cpa)/3600; 55 | 56 | % compute momentum flux of rainfall 57 | [cd10,u10] = cdntc(u,zu,Ta);% use Smith's formula to compute wind speed at 10m 58 | tau_rain = rain.*u10/3600; 59 | 60 | -------------------------------------------------------------------------------- /sw_tcond.m: -------------------------------------------------------------------------------- 1 | function tcond = sw_tcond(S,T,P) 2 | 3 | % SW_TCOND thermal conductivity 4 | %=========================================================================== 5 | % SW_TCOND $Revision: 0.0 $ $Date: 1998/01/19 $ 6 | % Copyright (C) Ayal Anis 1998. 7 | % 8 | % USAGE: tcond = sw_tcond(S,T,P) 9 | % 10 | % DESCRIPTION: 11 | % Calculates thermal conductivity of sea-water. 12 | % Two options (Note: one option has to be remarked): 13 | % 1) based on Caldwell's DSR 21:131-137 (1974) EQN. 9 14 | % 2) based on Catelli et al.'s DSR 21:311-3179(1974) EQN. 5 15 | % 16 | % INPUT: (all must have same dimensions) 17 | % S = salinity [psu (PSS-78) ] 18 | % T = temperature [degree C (IPTS-68)] 19 | % P = pressure [db] 20 | % (P may have dims 1x1, mx1, 1xn or mxn for S(mxn) ) 21 | % 22 | % OUTPUT: 23 | % tcond = thermal conductivity of sea-water [W/m/K] 24 | % 25 | % tcond(35,20,0)=0.5972 26 | % 27 | % DISCLAIMER: 28 | % This software is provided "as is" without warranty of any kind. 29 | %========================================================================= 30 | 31 | % CALLER: general purpose 32 | % CALLEE: none 33 | 34 | %---------------------- 35 | % CHECK INPUT ARGUMENTS 36 | %---------------------- 37 | if nargin ~= 3 38 | error('sw_tcond.m: Must pass 3 parameters ') 39 | end 40 | 41 | % CHECK S,T,P dimensions and verify consistent 42 | [ms,ns] = size(S); 43 | [mt,nt] = size(T); 44 | [mp,np] = size(P); 45 | 46 | 47 | % CHECK THAT S & T HAVE SAME SHAPE 48 | if (ms~=mt) | (ns~=nt) 49 | error('check_stp: S & T must have same dimensions') 50 | end %if 51 | 52 | % CHECK OPTIONAL SHAPES FOR P 53 | if mp==1 & np==1 % P is a scalar. Fill to size of S 54 | P = P(1)*ones(ms,ns); 55 | elseif np==ns & mp==1 % P is row vector with same cols as S 56 | P = P( ones(1,ms), : ); % Copy down each column. 57 | elseif mp==ms & np==1 % P is column vector 58 | P = P( :, ones(1,ns) ); % Copy across each row 59 | elseif mp==ms & np==ns % P is a matrix size(S) 60 | % shape ok 61 | else 62 | error('check_stp: P has wrong dimensions') 63 | end %if 64 | [mp,np] = size(P); 65 | 66 | 67 | % IF ALL ROW VECTORS ARE PASSED THEN LET US PRESERVE SHAPE ON RETURN. 68 | Transpose = 0; 69 | if mp == 1 % row vector 70 | P = P(:); 71 | T = T(:); 72 | S = S(:); 73 | 74 | Transpose = 1; 75 | end 76 | 77 | %------ 78 | % BEGIN 79 | %------ 80 | 81 | % 1) Caldwell's option # 2 - simplified formula, accurate to 0.5% (eqn. 9) 82 | tcond1 = 0.001365*(1+0.003*T-1.025e-5*T.^2+0.0653*(1e-4*P)-0.00029*S); % [cal/cm/C/sec] 83 | tcond = tcond1*418.4; % [cal/cm/C/sec] ->[W/m/K] 84 | 85 | % 2) Castelli's option 86 | %tcond2 = 100*(5.5286e-3+3.4025e-8*P+1.8364e-5*T-3.3058e-9*T.^3); % [W/m/K] 87 | %tcond = tcond2 % [W/m/K] 88 | 89 | if Transpose 90 | tcond = tcond'; 91 | end 92 | 93 | return 94 | %========================================================================= 95 | 96 | -------------------------------------------------------------------------------- /contents.m: -------------------------------------------------------------------------------- 1 | % Contents of AIR_SEA TOOLBOX, Version 2.0 2 | % 8/9/99 3 | % 4 | % 5 | % air_dens.m 966 08-09-99 12:14p air_dens.m 6 | % albedo.m 1,009 08-09-99 11:49a albedo.m 7 | % albedot1.mat 7,757 07-21-98 5:59p albedot1.mat 8 | % as_consts.m 3,699 08-09-99 11:54a as_consts.m 9 | % binave.m 1,209 08-09-99 11:50a binave.m 10 | % blwhf.m 2,775 08-05-99 4:54p blwhf.m 11 | % cdnlp.m 1,197 08-05-99 5:13p cdnlp.m 12 | % cdntc.m 1,356 08-05-99 5:18p cdntc.m 13 | % cdnve.m 1,418 08-05-99 5:26p cdnve.m 14 | % cloudcor.m 2,418 08-05-99 5:24p cloudcor.m 15 | % clskswr.m 2,244 08-05-99 5:25p clskswr.m 16 | % cool_skin.m 7,331 08-09-99 11:46a cool_skin.m 17 | % delq.m 1,059 08-09-99 11:34a delq.m 18 | % ep.m 852 08-09-99 12:12p ep.m 19 | % greg2.m 1,511 08-09-99 11:35a greg2.m 20 | % hfbulktc.m 12,232 08-09-99 11:39a hfbulktc.m 21 | % hms2h.m 714 08-09-99 11:39a hms2h.m 22 | % julianmd.m 1,534 08-09-99 11:47a julianmd.m 23 | % lfhf.m 1,626 08-09-99 11:47a lwhf.m 24 | % no_skin_out.txt 13,953 08-05-99 3:41p no_skin_out.txt 25 | % omegalmc.m 1,021 08-09-99 11:40a omegalmc.m 26 | % qsat.m 1,329 08-09-99 11:52a qsat.m 27 | % rain_flux.m 2,569 08-05-99 3:47p rain_flux.m 28 | % readme.m 8,114 08-09-99 2:06p readme.m 29 | % reedcf.m 3,807 08-05-99 3:50p reedcf.m 30 | % relhumid.m 1,519 08-09-99 11:52a relhumid.m 31 | % rhadj.m 707 08-05-99 3:53p rhadj.m 32 | % satvap.m 785 08-09-99 11:42a satvap.m 33 | % s2hms.m 478 08-05-99 3:53p s2hms.m 34 | % slhftc.m 2,031 08-09-99 11:56a slhftc.m 35 | % soradna1.m 4,486 08-09-99 11:42a soradna1.m 36 | % spshftlp.m 993 08-09-99 11:43a spshftlp.m 37 | % spshfttc.m 1,118 08-09-99 11:43a spshfttc.m 38 | % spshftve.m 991 08-09-99 11:43a spshftve.m 39 | % stresstc.m 1,061 08-09-99 11:57a stresstc.m 40 | % stresslp.m 990 08-09-99 11:56a stresslp.m 41 | % stressve.m 974 08-09-99 11:57a stressve.m 42 | % sunrise.m 1,821 08-09-99 11:58a sunrise.m 43 | % swhf.m 1,418 08-05-99 4:19p swhf.m 44 | % t_hfbulktc.m 1,704 08-05-99 4:45p t_hfbulktc.m 45 | % test2_5b.dat 11,699 08-05-99 4:20p test2_5b.dat 46 | % vapor.m 1,019 08-09-99 11:44a vapor.m 47 | % viscair.m 569 08-05-99 4:33p viscair.m 48 | % wavdist2.m 876 08-05-99 4:37p wavdist2.m 49 | % wavdist1.m 1,432 08-05-99 4:35p wavdist1.m 50 | % wavdist.m 1,517 08-05-99 4:39p wavedist.m 51 | % wdnotes.m 1,745 08-05-99 4:42p wdnotes.m 52 | % yearday.m 1,162 08-05-99 4:43p yearday.m 53 | % yes_skin_out.txt 13,958 08-05-99 4:43p yes_skin_out.txt 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /blwhf.m: -------------------------------------------------------------------------------- 1 | function lwest = blwhf(Ts,Ta,rh,Fc,bulk_f) 2 | % BLWHF: estimates net long-wave heat flux using bulk formulas 3 | % lwest = BLWHF(Ts,Ta,rh,Fc,bulk_f) estimates the net longwave 4 | % heat flux into the ocean using one of a number of bulk formulas 5 | % evaluated by Fung et al (1984), Rev. Geophys. Space Physics, 6 | % 22,177-193. 7 | % 8 | % INPUT: Ts - sea surface temperature [C] 9 | % Ta - air temperature [C] 10 | % rh - relative humidity [%] 11 | % Fc - cloudiness correction factor F(C) (=1 for clear sky) 12 | % (see cloudcor.m for more information) 13 | % bulk_f - bulk formulas to be used 14 | % (see Fung et al, 1984) for details). 15 | % Options are: 16 | % 'brunt' 17 | % 'berliand' - probably the best one (default) 18 | % 'clark' 19 | % 'hastenrath' 20 | % 'efimova' 21 | % 'bunker' 22 | % 'anderson' 23 | % 'swinbank' - does not use rh 24 | % 25 | % OUTPUT: lwest - net downward longwave flux [W/m^2] 26 | 27 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 28 | % 8/31/98: version 1.1 (contributed by RP) 29 | % 8/5/99: version 2.0 30 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 31 | 32 | % load constants and defaults 33 | as_consts; 34 | 35 | if nargin<5, 36 | bulk_f=bulkf_default; 37 | end; 38 | 39 | % compute vapour pressure from relative humidity (using formulas 40 | % from Gill, 1982) 41 | ew=satvap(Ta); 42 | rw=eps_air*ew./(P_default-ew); 43 | r=(rh/100).*rw; 44 | e_a=r*P_default./(eps_air+r); 45 | 46 | % convert to K 47 | ta=Ta+CtoK; 48 | ts=Ts+CtoK; 49 | 50 | % signs for flux INTO ocean 51 | switch bulk_f, 52 | case {'brunt',1} 53 | lwest = -emiss_lw*sigmaSB.*ts.^4.*(0.39 - 0.05*sqrt(e_a)).*Fc; 54 | 55 | case {'berliand',2} 56 | lwest = -emiss_lw*sigmaSB.*ta.^4.*(0.39 - 0.05*sqrt(e_a)).*Fc ... 57 | - 4*emiss_lw*sigmaSB.*ta.^3.*(Ts - Ta); 58 | 59 | case {'clark',3} 60 | lwest = -emiss_lw*sigmaSB.*ts.^4.*(0.39 - 0.05*sqrt(e_a)).*Fc ... 61 | - 4*emiss_lw*sigmaSB.*ts.^3.*(Ts - Ta); 62 | 63 | case {'hastenrath',4} 64 | q_a = e_a*eps_air./P_default; 65 | lwest = -emiss_lw*sigmaSB.*ts.^4.*(0.39 - 0.056*sqrt(q_a)).*Fc ... 66 | - 4*emiss_lw*sigmaSB.*ts.^3.*(Ts - Ta); 67 | 68 | case {'efimova',5} 69 | lwest = -emiss_lw*sigmaSB.*ta.^4.*(0.254 - 0.00495*(e_a)).*Fc ; 70 | 71 | case {'bunker',6} 72 | lwest = -0.022*emiss_lw*sigmaSB.*ta.^4.*(11.7 - 0.23*(e_a)).*Fc ... 73 | - 4*emiss_lw*sigmaSB.*ta.^3.*(Ts - Ta); 74 | 75 | case {'anderson',5} 76 | lwest = -emiss_lw*sigmaSB.*(ts.^4 - ta.^4.*(0.74+0.0049*(e_a))).*Fc ; 77 | 78 | case {'swinbank',5} 79 | lwest = -emiss_lw*sigmaSB.*(ts.^4 - 9.36e-6*ta.^6).*Fc ; 80 | 81 | otherwise 82 | error(['Unrecognized bulk formula specified: ' bulk_f]); 83 | end; 84 | 85 | -------------------------------------------------------------------------------- /as_consts.m: -------------------------------------------------------------------------------- 1 | % AS_CONSTS: returns values of many constants used in AIR_SEA TOOLBOX 2 | % AS_CONSTS: returns values of many constants used in the AIR_SEA 3 | % TOOLBOX. At end of this file are values of constants from COARE 4 | % to be used when running the test program t_hfbulktc.m 5 | 6 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7 | % 8/19/98: version 1.1 (contributed by RP) 8 | % 4/7/99: version 1.2 (revised to include COARE test values by AA) 9 | % 8/5/99: version 2.0 10 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 11 | 12 | % ------- physical constants 13 | 14 | g = 9.8; % acceleration due to gravity [m/s^2] 15 | sigmaSB = 5.6697e-8; % Stefan-Boltzmann constant [W/m^2/K^4] 16 | eps_air = 0.62197; % molecular weight ratio (water/air) 17 | gas_const_R = 287.04; % gas constant for dry air [J/kg/K] 18 | CtoK = 273.16; % conversion factor for [C] to [K] 19 | 20 | 21 | % ------- meteorological constants 22 | 23 | kappa = 0.4; % von Karman's constant 24 | Charnock_alpha = 0.011; % Charnock constant (for determining roughness length 25 | % at sea given friction velocity), used in Smith 26 | % formulas for drag coefficient and also in Fairall 27 | % and Edson. use alpha=0.011 for open-ocean and 28 | % alpha=0.018 for fetch-limited (coastal) regions. 29 | R_roughness = 0.11; % limiting roughness Reynolds # for aerodynamically 30 | % smooth flow 31 | 32 | 33 | % ------ defaults suitable for boundary-layer studies 34 | 35 | cp = 1004.7; % heat capacity of air [J/kg/K] 36 | rho_air = 1.22; % air density (when required as constant) [kg/m^2] 37 | Ta_default = 10; % default air temperature [C] 38 | P_default = 1020; % default air pressure for Kinneret [mbars] 39 | psych_default = 'screen'; % default psychmometer type (see relhumid.m) 40 | Qsat_coeff = 0.98; % satur. specific humidity coefficient reduced 41 | % by 2% over salt water 42 | 43 | 44 | % the following are useful in hfbulktc.m 45 | % (and are the default values used in Fairall et al, 1996) 46 | 47 | CVB_depth = 600; % depth of convective boundary layer in atmosphere [m] 48 | min_gustiness = 0.5; % min. "gustiness" (i.e., unresolved fluctuations) [m/s] 49 | % should keep this strictly >0, otherwise bad stuff 50 | % might happen (divide by zero errors) 51 | beta_conv = 1.25;% scaling constant for gustiness 52 | 53 | 54 | % ------ short-wave flux calculations 55 | 56 | Solar_const = 1368.0; % the solar constant [W/m^2] represents a 57 | % mean of satellite measurements made over the 58 | % last sunspot cycle (1979-1995) taken from 59 | % Coffey et al (1995), Earth System Monitor, 6, 6-10. 60 | 61 | 62 | % ------ long-wave flux calculations 63 | 64 | emiss_lw = 0.985; % long-wave emissivity of ocean from Dickey et al 65 | % (1994), J. Atmos. Oceanic Tech., 11, 1057-1076. 66 | 67 | bulkf_default = 'berliand'; % default bulk formula when downward long-wave 68 | % measurements are not made. 69 | 70 | 71 | % ------ constants used for COARE; to use simply delete the % 72 | % g = 9.7803; % acceleration due to gravity [m/s^2] 73 | % sigmaSB = 5.67e-8; % Stefan-Boltzmann constant [m^2/K^4] 74 | % gas_const_R = 287.1; % gas constant for dry air [J/kg/K] 75 | % cp = 1004.67; % heat capacity of air [J/kg/K] 76 | % beta_conv = 1.20; % scaling constant for gustiness 77 | % emiss_lw = 0.97; % long-wave emissivity 78 | -------------------------------------------------------------------------------- /reedcf.m: -------------------------------------------------------------------------------- 1 | function c = reedcf(yd,lat,dsw); 2 | % REEDCF: computes daily mean cloud cover following Reed (1977). 3 | % c = REEDCF(yd,lat,dsw) computes daily averaged cloud cover c from 4 | % yearday, latitude, and measured insolation following Reed (1977), J. Phys. 5 | % Oceanog., 7, 482-485. Assumes hourly input series are either both 6 | % column or both row vectors of equal length. c is output as a boxcar 7 | % function with c constant over a 24 hr period. 8 | % 9 | % INPUT: yd - yearday (e.g., Jan 10 is yd=10) 10 | % lat - latitude [deg] 11 | % dsw - (measured) insolation [W/m^2] 12 | % 13 | % OUTPUT: c - daily averaged cloud cover 14 | 15 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 | % 3/8/97: version 1.0 17 | % 8/5/99: version 2.0 18 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 19 | 20 | % determine if input is either row or column vectors 21 | [m,n] = size(dsw); 22 | 23 | % first daily average swr and yd 24 | davesw = binave(dsw,24); 25 | daveyd = binave(yd,24); 26 | 27 | % estimate daily averaged cloud factor 28 | c=cloudfac(daveyd,lat,davesw); 29 | 30 | % cloudfac always outputs a column vector, if initial input is 31 | % row vector, convert cf to row vector 32 | if m==1 33 | c = c'; 34 | end 35 | 36 | % convert daily averaged cloudfactor to boxcar function 37 | if n== 1 38 | c = c*ones(1,24); 39 | c = reshape(c',prod(size(c)),1); 40 | 41 | elseif m==1 42 | c = ones(24,1)*c; 43 | c = reshape(c,1,prod(size(c))); 44 | end 45 | c(length(dsw)+1:end)=[]; 46 | 47 | 48 | function cf=cloudfac(yd,lat,davesw) 49 | % CLOUDFAC: computes daily mean cloud factor following Reed (1977). 50 | % cf=CLOUDFAC(yd,lat,davesw) computes the daily average cloud factor 51 | % based on Reed (1977), J. Phys. Ocean., 7, 482-485. Assumes year is 52 | % not a leap year. If yd is negative, then yd=yd+365. 53 | % 54 | % INPUT: yd - yearday (e.g., Jan 10th is 10) 55 | % lat - latitude [deg] 56 | % davesw - average measured insolation [W/m^2] 57 | % 58 | % OUTPUT: cf - daily average cloud factor 59 | 60 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 61 | % 3/8/97: version 1.0 62 | % 8/5/99: version 2.0 63 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 64 | 65 | % convert to column vectors 66 | [N,M]=size(davesw); 67 | if N==1 68 | davesw=davesw'; 69 | yd=yd'; 70 | end 71 | 72 | % check if yd is negative 73 | ind=find(yd<0); 74 | yd(ind)=yd(ind)+365; 75 | % truncate to integer yearday for use with formula 76 | yd=fix(yd); 77 | 78 | % determine noon solar altitude 79 | nsa=nsunang(yd,lat); 80 | 81 | % compute ratio of observed to clear sky insolation 82 | cssw=clskswr(yd,lat); 83 | QdQ=davesw./cssw; 84 | 85 | % correct for measurement error 86 | 87 | ind1=find(QdQ>1); 88 | QdQ(ind1)=ones(length(ind1),1); 89 | 90 | % compute cloud factor 91 | cf=(1-QdQ+.0019.*nsa)./.62; 92 | 93 | % truncate limits 94 | 95 | ind2=find(cf>1); 96 | cf(ind2)=ones(length(ind2),1); 97 | ind3=find(cf<0.3); 98 | cf(ind3)=zeros(length(ind3),1); 99 | 100 | % reconvert if necessary 101 | if N==1 102 | cf=cf'; 103 | end 104 | 105 | 106 | function nsa=nsunang(yd,lat) 107 | % NSUNANG: computes noon solar altitude angle. 108 | % nsa=NSUNANG(yd,lat) computes the noonday solar altitude angle as a 109 | % function of yearday and latitude using Smithsonian table (see 110 | % Reed (1976), NOAA Tech Memo., ERL PMEL-8, 20 pp., or Reed (1977), 111 | % J. Phys. Ocean., 7, 482-485). 112 | % 113 | % INPUT: yd - yearday (e.g., Jan 10 is 10) 114 | % lat - latitude [deg] 115 | % 116 | % OUTPUT: nsa - noonday solar altitude [deg] 117 | 118 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 119 | % 3/8/97: version 1.0 120 | % 8/5/99: version 2.0 121 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 122 | 123 | % ensure that yd is positive 124 | ind=find(yd<0); 125 | yd(ind)=yd(ind)+365; 126 | yd=fix(yd); 127 | 128 | % compute noon solar altitude 129 | k=pi./180; 130 | t=2.*pi.*(yd./365); 131 | d=.397+3.630*sin(t)-22.98.*cos(t)+.040.*sin(2.*t)-.388.*cos(2.*t)... 132 | +.075.*sin(3.*t)-.160.*cos(3.*t); 133 | dl=k.*d; 134 | ll=k.*lat; 135 | z=sin(ll).*sin(dl)+cos(ll).*cos(dl); 136 | nsa=asin(z)./k; 137 | -------------------------------------------------------------------------------- /soradna1.m: -------------------------------------------------------------------------------- 1 | function [z,sorad]=soradna1(yd,yr,long,lat) 2 | % SORADNA1: computes no-sky solar radiation and solar altitude. 3 | % [z,sorad]=SORADNA1(yd,yr,long,lat) computes instantaneous values of 4 | % solar radiation and solar altitude from yearday, year, and position 5 | % data. It is put together from expressions taken from Appendix E in the 6 | % 1978 edition of Almanac for Computers, Nautical Almanac Office, U.S. 7 | % Naval Observatory. They are reduced accuracy expressions valid for the 8 | % years 1800-2100. Solar declination computed from these expressions is 9 | % accurate to at least 1'. The solar constant (1368.0 W/m^2) represents a 10 | % mean of satellite measurements made over the last sunspot cycle (1979-1995) 11 | % taken from Coffey et al (1995), Earth System Monitor, 6, 6-10. Assumes 12 | % yd is either a column or row vector, the other input variables are scalars, 13 | % OR yd is a scalar, the other inputs matrices. 14 | % 15 | % INPUT: yd - decimal yearday (e.g., 0000Z Jan 1 is 0.0) 16 | % yr - year (e.g., 1995) 17 | % long - longitude (west is positive!) [deg] 18 | % lat - latitude [deg] 19 | % 20 | % OUTPUT: z - solar altitude [deg] 21 | % sorad- no atmosphere solar radiation [W/m^2] 22 | 23 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 24 | % 3/8/97: version 1.0 25 | % 8/28/98: version 1.1 (vectorized by RP) 26 | % 8/5/99: version 2.0 27 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 28 | 29 | % get constants 30 | as_consts; 31 | 32 | % convert yd to column vector if necessary 33 | [n,m]=size(yd); 34 | if m > n 35 | yd=yd'; 36 | end 37 | 38 | % convert yearday to calender time 39 | gtime=greg2(yd,yr); 40 | 41 | SC=gtime(:,6); 42 | MN=fix(gtime(:,5)); 43 | HR=fix(gtime(:,4)); 44 | D=fix(gtime(:,3)); 45 | M=fix(gtime(:,2)); 46 | Y=fix(gtime(:,1)); 47 | 48 | % convert to new variables 49 | LONG=long; 50 | LAT=lat; 51 | 52 | % two options - either long/lat are vectors, time is a scalar 53 | 54 | if length(LONG)==1 & length(LAT)>1, 55 | LONG=LONG(ones(size(LAT))); 56 | elseif length(LONG)>1 & length(LAT)==1, 57 | LAT=LAT(ones(size(LAT))); 58 | end; 59 | 60 | if length(SC)==1, 61 | osiz=ones(size(LONG)); 62 | SC=SC(osiz); 63 | MN=MN(osiz); 64 | HR=HR(osiz); 65 | D=D(osiz); 66 | M=M(osiz); 67 | Y=Y(osiz); 68 | elseif length(LONG)==1, 69 | LONG=LONG(ones(size(SC))); 70 | LAT=LAT(ones(size(SC))); 71 | end; 72 | 73 | % constants 74 | DTR=3.14159265/180; 75 | RTD=1./DTR; 76 | 77 | % compute Universal Time in hours 78 | UT = HR+(MN+SC./60.)./60; 79 | 80 | % compute Julian ephemeris date in days (Day 1 is 1 Jan 4713 B.C.=-4712 Jan 1) 81 | JED=367.*Y-fix(7.*(Y+fix((M+9)./12))./4)+fix(275.*M./9)+D+1721013 + UT./24; 82 | 83 | % compute interval in Julian centuries since 1900 84 | T=(JED-2415020.0)./36525; 85 | 86 | % compute mean anomaly of the sun 87 | G=358.475833+35999.049750.*T-.000150.*T.^2; 88 | NG=fix(G./360); 89 | G=(G-NG.*360).*DTR; 90 | 91 | % compute mean longitude of sun 92 | L=279.696678+36000.768920.*T+.000303.*T.^2; 93 | NL=fix(L./360); 94 | L=(L-NL.*360).*DTR; 95 | 96 | % compute mean anomaly of Jupiter 97 | JUP=225.444651+2880.0.*T+154.906654.*T; 98 | NJUP=fix(JUP/360); 99 | JUP=(JUP-NJUP.*360).*DTR; 100 | 101 | % compute longitude of the ascending node of the moon's orbit 102 | NM=259.183275-1800.*T-134.142008.*T+.002078.*T.^2; 103 | NNM=fix(NM./360); 104 | NM=(NM-NNM.*360+360).*DTR; 105 | 106 | % compute mean anomaly of Venus 107 | V=212.603219+58320.*T+197.803875.*T+.001286.*T.^2; 108 | NV=fix(V/360); 109 | V=(V-NV.*360.).*DTR; 110 | 111 | % compute sun theta 112 | THETA=.397930.*sin(L)+.009999.*sin(G-L)+.003334.*sin(G+L)... 113 | -.000208.*T.*sin(L)+.000042.*sin(2.*G+L)-.000040.*cos(L)... 114 | -.000039.*sin(NM-L)-.000030.*T.*sin(G-L)-.000014.*sin(2.*G-L)... 115 | -.000010.*cos(G-L-JUP)-.000010.*T.*sin(G+L); 116 | 117 | % compute sun rho 118 | RHO=1.000421-.033503.*cos(G)-.000140.*cos(2*G)... 119 | +.000084.*T.*cos(G)-.000033.*sin(G-JUP)+.000027.*sin(2.*G-2.*V); 120 | 121 | % compute declination 122 | DECL=asin(THETA./sqrt(RHO)); 123 | 124 | % compute equation of time (in seconds of time) (L in degrees) 125 | L = 276.697+0.98564734.*(JED-2415020.0); 126 | L = (L - 360.*fix(L./360.)).*DTR; 127 | EQT = -97.8.*sin(L)-431.3.*cos(L)+596.6.*sin(2.*L)-1.9.*cos(2.*L)... 128 | +4.0.*sin(3.*L)+19.3.*cos(3.*L)-12.7.*sin(4.*L); 129 | EQT = EQT./60; 130 | L = L.*RTD; 131 | 132 | % compute local hour angle 133 | GHA = 15.*(UT-12.) + 15.*EQT./60; 134 | LHA = GHA - LONG; 135 | 136 | % compute radius vector 137 | RV=sqrt(RHO); 138 | 139 | % compute solar altitude 140 | SZ=sin(DTR.*LAT).*sin(DECL)+cos(DTR.*LAT).*cos(DECL).*cos(DTR.*LHA); 141 | z=RTD.*asin(SZ); 142 | 143 | % compute solar radiation outside atmosphere 144 | [n,m]=size(z); 145 | sorad=zeros(n,m); 146 | ii=z>0; 147 | sorad(ii)=(Solar_const./RV(ii).^2).*sin(DTR.*z(ii)); 148 | 149 | -------------------------------------------------------------------------------- /cool_skin.m: -------------------------------------------------------------------------------- 1 | function [delta,Dter,Dqer] = cool_skin(sal,Tw,rhoa,cpa,Pa, ... 2 | U_star,T_star,Q_star, ... 3 | dlw,dsw,nsw,delta,g,Rgas, ... 4 | CtoK,Qsat_coeff) 5 | % COOL_SKIN: compute the cool-skin parameters. 6 | % COOL_SKIN computes the cool-skin parameters. This code follows 7 | % the fortran program bulk_v25b.f. For more details, see the cool-skin 8 | % and warm layer paper by Fairall et al (1996), JGR, 101, 1295-1308. 9 | % All input variables should be vectors (either row or column), except 10 | % Rgas, CtoK, Qsat_coeff, and g, which can be scalars. Uses some 11 | % functions from CSIRO SEAWATER TOOLBOX. 12 | % 13 | % INPUT: sal - salinity [psu (PSS-78)] 14 | % Tw - water surface temperature [C] 15 | % rhoa - air density [kg/m^3] 16 | % cpa - specific heat capacity of air [J/kg/C] 17 | % Pa - air pressure [mb] 18 | % U_star - friction velocity including gustiness [m/s] 19 | % T_star - temperature scale [C] 20 | % Q_star - humidity scale [kg/kg] 21 | % dlw - downwelling (INTO water) longwave radiation [W/m^2] 22 | % dsw - measured insolation [W/m^2] 23 | % nsw - net shortwave radiation INTO water [W/m^2] 24 | % delta - cool-skin layer thickness [m] 25 | % g - gravitational constant [m/s^2] 26 | % Rgas - gas constant for dry air [J/kg/K] 27 | % CtoK - conversion factor for deg C to K 28 | % Qsat_coeff - saturation specific humidity coefficient 29 | % 30 | % OUTPUT: delta - cool-skin layer thickness [m] 31 | % Dter - cool-skin temperature difference [C]; positive if 32 | % surface is cooler than bulk (presently no warm skin 33 | % permitted by model) 34 | % Dqer - cool-skin specific humidity difference [kg/kg] 35 | % 36 | % USAGE: [delta,Dter,Dqer] = cool_skin(sal,Tw,rhoa,cpa,Pa, ... 37 | % U_star,T_star,Q_star, ... 38 | % dlw,dsw,nsw,delta,g,Rgas, ... 39 | % CtoK,Qsat_coeff) 40 | 41 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 42 | % 4/9/99: version 1.2 (contributed by AA) 43 | % 8/5/99: version 2.0 44 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 45 | 46 | % -> column vectors 47 | sal = sal(:); Tw = Tw(:); rhoa = rhoa(:); cpa = cpa(:); Pa = Pa(:); 48 | U_star = U_star(:); T_star = T_star(:); Q_star = Q_star(:); 49 | dlw = dlw(:); nsw = nsw(:); delta = delta(:); Rgas = Rgas(:); 50 | CtoK = CtoK(:); Qsat_coeff = Qsat_coeff(:); g = g(:); 51 | 52 | 53 | size_data = size(Tw); 54 | 55 | alpha = sw_alpha(sal,Tw,0); % thermal expansion coeff [1/C] 56 | beta_sal = sw_beta(sal,Tw,0); % saline contraction coeff [1/psu] 57 | cpw = sw_cp(sal,Tw,0); % specific heat capacity [J/kg/C] 58 | rhow = sw_dens0(sal,Tw); % density at atmospheric press [kg/m^3] 59 | viscw = sw_visc(sal,Tw,0); % kinematic viscosity of sea-water [m^2/s] 60 | tcondw = sw_tcond(sal,Tw,0); % thermal conductivity of sea-water [W/m/K] 61 | 62 | % the following are values used for COARE 63 | % alpha = 2.1e-5*(Tw+3.2).^0.79;% as used for COARE data 64 | % beta_sal = 0.026./sal; % as used for COARE data 65 | % cpw = 4000*ones(size(Tw)); % as used for COARE data 66 | % rhow = 1022*ones(size(Tw)); % as used for COARE data 67 | % viscw = 1e-6*ones(size(Tw)); % as used for COARE data 68 | % tcondw = 0.6*ones(size(Tw)); % as used for COARE data 69 | 70 | % latent heat of water 71 | Le = (2.501-0.00237*Tw)*10^6; 72 | 73 | % saturation specific humidity; 74 | Qs = Qsat_coeff.*qsat(Tw,Pa); 75 | 76 | % a big constant 77 | bigc = (16.*g.*cpw.*(rhow.*viscw).^3)./(tcondw.^2.*rhoa.^2); 78 | 79 | % constant for correction of dq; slope of sat. vap. 80 | wetc = 0.622.*Le.*Qs./(Rgas.*(Tw+CtoK).^2); 81 | 82 | % compute fluxes out of the ocean (i.e., up = positive) 83 | hsb = - rhoa.*cpa.*U_star.*T_star; 84 | hlb = - rhoa.*Le.*U_star.*Q_star; 85 | 86 | % net longwave (positive up) 87 | nlw = - lwhf(Tw,dlw,dsw); 88 | 89 | % total heat flux out of the water surface 90 | qout = nlw + hsb + hlb; 91 | 92 | % compute deltaSc = fc*Sns, see sec. 2.4 (p. 1297-1298) in cool-skin paper 93 | % 3 choices; comment out those that are not used! 94 | deltaSc = zeros(size_data); 95 | ipos_nsw = find(nsw > 0); 96 | deltaSc(ipos_nsw) = f_c(delta(ipos_nsw),1).*nsw(ipos_nsw); % Paulson and Simpson (1981) 97 | % deltaSc(ipos_nsw) = f_c(delta(ipos_nsw),2).*nsw(ipos_nsw); % COARE approx. to Paulson 98 | % deltaSc(ipos_nsw) = f_c(delta(ipos_nsw),3).*nsw(ipos_nsw); % Hasse (1971) 99 | 100 | qcol = qout - deltaSc; 101 | 102 | % initialize 103 | alphaQb = zeros(size_data); 104 | lamda = zeros(size_data); 105 | Dter = zeros(size_data); 106 | 107 | ipos_qcol = find(qcol > 0); 108 | 109 | % eqn. 17 in cool-skin paper 110 | alphaQb(ipos_qcol) = alpha(ipos_qcol).*qcol(ipos_qcol) + ... 111 | sal(ipos_qcol).*beta_sal(ipos_qcol) ... 112 | .*hlb(ipos_qcol).*cpw(ipos_qcol)./Le(ipos_qcol); 113 | 114 | % eqn. 14 in cool-skin paper 115 | lamda(ipos_qcol) = 6./(1+(bigc(ipos_qcol).*alphaQb(ipos_qcol) ... 116 | ./U_star(ipos_qcol).^4).^0.75).^(1/3); 117 | 118 | % eqn. 12 in cool-skin paper 119 | delta(ipos_qcol) = lamda(ipos_qcol).*viscw(ipos_qcol) ... 120 | ./(sqrt(rhoa(ipos_qcol)./rhow(ipos_qcol)) ... 121 | .*U_star(ipos_qcol)); 122 | 123 | % eqn. 13 in cool-skin paper 124 | Dter(ipos_qcol) = qcol(ipos_qcol).*delta(ipos_qcol)./tcondw(ipos_qcol); 125 | 126 | Dqer = wetc.*Dter; 127 | 128 | 129 | 130 | 131 | function fc = f_c(delta,option) 132 | % F_C: computes the absorption coefficient fc. 133 | % fc=F_C(delta,option) computes the absorption coefficient fc. 134 | % 135 | % INPUT: delta - thickness of cool-skin layer [m] 136 | % option - 1 use Paulson and Simpson (1981) data for seawater; 137 | % See also p. 1298 of Fairall et al (1996) JGR, 101, 138 | % cool-skin and warm-layer paper. 139 | % 140 | % 2 use approximation to Paulson as given in 141 | % p. 1298 of Fairall et al (1996) JGR, 101, cool-skin 142 | % and warm-layer paper. 143 | % 144 | % 3 use fc = const. = 0.19, as suggested by Hasse (1971). 145 | 146 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 147 | % 8/5/99: version 1.2 (contributed by AA) 148 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 149 | 150 | if option == 1 151 | % Use Paulson and Simpson data 152 | 153 | % Wavelength bands for the coefficients [um] 154 | % 1) 0.2-0.6 155 | % 2) 0.6-0.9 156 | % 3) 0.9-1.2 157 | % 4) 1.2-1.5 158 | % 5) 1.5-1.8 159 | % 6) 1.8-2.1 160 | % 7) 2.1-2.4 161 | % 8) 2.4-2.7 162 | % 9) 2.7-3.0 163 | 164 | % F_i is the amplitude 165 | F_i = [0.237 0.360 0.179 0.087 0.080 0.0246 0.025 0.007 0.0004]; 166 | F_i1 = repmat(F_i,length(delta),1); 167 | 168 | % Gam_i is the absorption length [m] 169 | Gam_i = [34.8 2.27 3.15e-2 5.48e-3 8.32e-4 1.26e-4 3.13e-4 7.82e-5 1.44e-5]; 170 | Gam_i1 = repmat(Gam_i,length(delta),1); 171 | 172 | delta1 = repmat(delta,1,length(Gam_i)); 173 | 174 | % fc is the absorption in the cool-skin layer of thickness delta 175 | fc = sum(F_i1.*(1-(Gam_i1./delta1).*(1-exp(-delta1./Gam_i1))), 2); 176 | 177 | elseif option == 2 178 | % use COARE approximation to Paulson and Simpson data 179 | 180 | fc = 0.137+11.*delta-(6.6e-5./delta).*(1-exp(-delta/8e-4)); 181 | 182 | elseif option == 3 183 | % use Hasse simple approximation 184 | 185 | fc = 0.19; 186 | 187 | end 188 | -------------------------------------------------------------------------------- /readme.m: -------------------------------------------------------------------------------- 1 | % AIR_SEA: Introduction to the AIR_SEA TOOLBOX 2 | 3 | % AIR_SEA TOOLBOX (version 2.0: 8/9/99) 4 | % 5 | % 1) Introduction: Welcome to the AIR_SEA toolbox, a collection of MATLAB 6 | % programs (m-files) which can be used to compute surface wind stress and 7 | % heat flux components from buoy and shipboard atmospheric and near-surface 8 | % oceanographic time series measurements. All m-files include a header 9 | % which describes the mfile's function, input and output variables, and 10 | % key references when important. They have been written for use with 11 | % MATLAB 5. 12 | % 13 | % 2) Conventions: While not required for many m-files, it is generally 14 | % assumed that the input time series of measured variables are hourly 15 | % averaged column or row vectors and the other input variables are scalars, 16 | % all expressed in MKS units. Two time conventions are used: a) decimal 17 | % Julian yearday where 0000 UT Jan 1 equals 0.0, and b) calender yearday 18 | % where Jan 1 equals 1. The choice of which convention is used is 19 | % internally consistent between m-files. 20 | % 21 | % 3) Programs used to compute heat flux components: 22 | % 23 | % Shortwave flux: 24 | % 25 | % SWHF: computes net sw flux into ocean and albedo. Uses 26 | % SORADNA1 and ALBEDO to compute solar altitude, no-sky 27 | % insolation and albedo. 28 | % 29 | % SORADNA1: computes no-sky insolation and solar altitude at 30 | % a given time and location. 31 | % 32 | % ALBEDO: computes ocean albedo following Payne (1972). 33 | % 34 | % Longwave flux: 35 | % 36 | % LWHF: computes net lw flux into ocean when downward 37 | % lw radiation is measured, using Dickey et al (1994). 38 | % 39 | % BLWHF: computes net lw flux into the ocean when downward 40 | % lw radiation is NOT measured. Uses SATVAP. Requires 41 | % as input a cloudiness correction factor from CLOUDCOR. 42 | % 43 | % CLOUDCOR: cloudiness correction factor used in bulk formulae, 44 | % based on estimated Cloud Fraction, which is either observed 45 | % directly or estimated, using, e.g., REEDCF. 46 | % 47 | % REEDCF: computes daily average Cloud Fraction using formula of 48 | % Reed (1977), who relates daily average cloudiness to the observed 49 | % reduction in solar insolation from clear-sky values. 50 | % 51 | % Sensible and latent fluxes: 52 | % 53 | % HFBULKTC: uses a simplified version of Fairall et al (1996) 54 | % TOGA/COARE code to compute sensible and latent heat 55 | % fluxes into ocean. Present version includes a) Rogers' 56 | % weighting factor for unstable conditions, b) the effects 57 | % of gustiness, c) a constant marine boundary layer height, 58 | % d) a limit of zr/L <=3.0 to ensure that the code converges 59 | % to nonzero stress and heat flux values for strongly stable 60 | % conditions, e) cool-skin effect, and f) Webb correction for 61 | % latent heat flux. NOTE: both cool-skin and Webb correction 62 | % are optional, and user must decide if they want these used, 63 | % e.g., in SLHFTC. Warm layer effects are not included in this 64 | % version. Uses VISCAIR and QSAT to compute air viscosity 65 | % and saturation specific humidity, CDNTC the neutral drag 66 | % coefficient, and PSIUTC and PSITTC to adjust the different 67 | % transfer coefficients to the measurement heights for a 68 | % given stability. Also returns related variables. 69 | % 70 | % SLHFTC: includes ocean surface current and HFBULKTC to comput 71 | % sensible and latent heat fluxes into ocean. 72 | % 73 | % RAIN_FLUX: computes heat flux and momentum flux due to rain. 74 | % 75 | % 4) Programs relating wind speed, height, and surface stress. 76 | % 77 | % Neutral conditions: 78 | % 79 | % CDNLP: computes neutral Cd, 10m wind following Large and Pond (1981). 80 | % CDNTC: computes neutral Cd, 10m wind following Smith (1988). 81 | % CDNVE: computes neutral Cd, 10m wind following Vera (1983). 82 | % 83 | % STRESSLP: computes the neutral wind stress using Large and Pond. 84 | % STRESSTC: computes the neutral wind stress following Smith. 85 | % STRESSVE: computes the neutral wind stress using Vera. 86 | % 87 | % SPSHFTLP: computes winds at another height using Large&Pond drag. 88 | % SPSHFTTC: computes winds at another height using Smith drag. 89 | % SPSHFTVE: computes winds at another height using Vera drag. 90 | % 91 | % Non-neutral conditions: 92 | % 93 | % HFBULKTC: uses simplified version of Fairall et al (1996) 94 | % TOGA/COARE code to compute surface wind stress amplitude, 95 | % (Uses Monin-Obukov similarity theory with surface rougness using 96 | % Charnock approach, like Smith (1988)). 97 | % 98 | % SLHFTC: includes ocean surface current and HFBULKTC to 99 | % compute surface wind stress vector as well as scalar parameters. 100 | % 101 | % 5) Programs used to estimate wave effects on the measured wind speed: 102 | % 103 | % WAVEDIST: estimate true wind speed at 10-m height. 104 | % WAVEDIS1: estimate true wind speed at measurement height. 105 | % WAVEDIS2: plots wave effects at measurement height vs. wave height. 106 | % OMEGALMC: estimates wave effect on wind log profile. 107 | % CDNVE: computes neutral drag coefficient following Vera (1983). 108 | % 109 | % See WDNOTES for additional information. 110 | % 111 | % 6) Other useful programs: 112 | % 113 | % AS_CONSTS: contains various constants used in the toolbox. 114 | % 115 | % DAVEALB: computes daily mean albedo. 116 | % SUNRISE: computes GMT time of sunrise and sunset (uses SORADNA1). 117 | % 118 | % GREG2: converts decimal yearday into Julian calendar day. 119 | % JULIANMD: converts Gregorian calendar dates to decimal Julian day 120 | % for days beginning at midnight UT 121 | % YEARDAY: converts calender month and day into yearday. 122 | % 123 | % DELQ: air-sea specific humidity difference. 124 | % EP: net precipitation and evaporation accumulation. 125 | % QSAT: saturation specific humidity. 126 | % RELHUMID: relative humidity from wet/dry bulb thermometers. 127 | % RHADJ: adjusts RH for values above 100. 128 | % SATVAP: saturation vapour pressure. 129 | % VAPOR: heat of evaporation. 130 | % VISCAIR: viscosity of air at a given temperature. 131 | % COOL_SKIN: computes cool-skin parameters. 132 | % T_HFBULKTC: tests HFBULKTC with COARE data. 133 | % 134 | % 7) See CONTENTS for listing of all m-files in this toolbox. 135 | % 136 | % 8) History: 137 | % 138 | % Version 1.0: 139 | % 140 | % The initial assembly of this toolbox was a collaborative effort 141 | % by Bob Beardsley (WHOI), Ed Dever (SIO), Steve Lentz (WHOI), Jim 142 | % Edson (WHOI), and Dick Payne (WHOI), with additional input from 143 | % Steve Anderson (WHOI), Jay Austin (WHOI), Chris Fairall (NOAA), 144 | % Carl Friehe (UCI), Bill Large (NCAR), Dave Rogers (SIO), Rich 145 | % Signell (USGS), and Bob Weller (WHOI). Their input was very useful. 146 | % 147 | % Version 1.1: 148 | % 149 | % Rich Pawlowicz (UBC) then converted the original version 1.0 150 | % (written for MATLAB 4) into a much improved version 1.1 (optimized 151 | % for MATLAB 5) which included major coding improvements, the addition 152 | % of some new m-files, and some corrections of existing m-files. 153 | % 154 | % Version 1.2: 155 | % 156 | % Ayal Anis (U. Dalhousie) then modified HFBULKTC to include the 157 | % Fairall et al (1996) cool-skin effect and Webb correction to the 158 | % latent heat flux, plus added files to test the code with COARE 159 | % data. Ayal and R. Onken (NATO) also contributed several other files. 160 | % 161 | % Version 2.0: 162 | % 163 | % Bob Beardsley has added several m-files and made simple changes 164 | % to the various m-files to standardize the format and documentation. 165 | % 166 | % 9) Comments, Suggestions, and Improvements 167 | % 168 | % Please contact Bob Beardsley at rbeardsley@whoi.edu with questions 169 | % and comments, especially concerning bugs (and their possible fixes), 170 | % ideas for additional m-files, plus any m-files which you want to 171 | % contribute to this toolbox. Your help in improving this toolbox will 172 | % be greatly appreciated. 173 | % 174 | % As new or/or improved m-files are developed for this toolbox, they 175 | % will be added to the AIR_SEA toolbox folder located at the SEA-MAT 176 | % Web site (crusty.usgs.gov/sea-mat/). SEA-MAT is a collection of 177 | % MATLAB mfiles for the display and analysis of oceanographic data. 178 | % 179 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 180 | 181 | -------------------------------------------------------------------------------- /test2_5b.dat: -------------------------------------------------------------------------------- 1 | % datime GMT u tsea tair qair hsb hlb taub Rs Rl rain lat long MSP 2 | 921125132100 4.7 29 27.7 17.6 6 111 0.030 0 428 0 -1.727 156.065 29.15 3 | 921125141200 4.1 29 27.7 17.7 5 96 0.023 0 429 0 -1.727 156.062 29.15 4 | 921125150300 4.3 29 27.8 17.8 5 98 0.024 0 422 0 -1.729 156.057 29.151 5 | 921125155500 4.7 29 27.8 17.6 5 110 0.029 0 412 0 -1.728 156.046 29.149 6 | 921125164600 3.7 29 27.7 17.3 4 92 0.019 0 413 0 -1.728 156.035 29.161 7 | 921125173800 5.1 29 27.3 17.6 9 123 0.036 0 419 0 -1.727 156.022 29.161 8 | 921125182900 2.5 29 27.5 17.9 4 61 0.009 0 425 0 -1.725 156.014 29.161 9 | 921125192000 3.8 29 27.9 17.7 4 89 0.019 50 427 0 -1.727 156.001 29.145 10 | 921125201200 4.8 29 28 17.6 4 113 0.030 249 428 0 -1.728 155.995 29.136 11 | 921125210500 3.9 29 27.8 18.3 5 84 0.021 386 422 0 -1.729 155.992 29.126 12 | 921125221900 4.6 29.1 27.9 17.6 5 113 0.028 633 413 0 -1.728 155.987 29.143 13 | 921125232700 5.2 29.2 28 18 6 124 0.036 881 409 0 -1.729 155.987 29.143 14 | 921126001900 4.4 29.3 28.1 18.1 6 106 0.026 883 414 0 -1.731 155.983 29.199 15 | 921126011000 4 29.3 28.1 18.6 5 90 0.022 853 420 0 -1.73 155.974 29.269 16 | 921126022200 4.8 29.5 28.5 17.9 4 123 0.030 842 417 0 -1.728 155.969 29.258 17 | 921126031300 4.8 29.5 28.4 18.1 5 119 0.030 779 411 0 -1.724 155.966 29.423 18 | 921126041600 4.3 29.6 28.5 18.4 4 104 0.025 513 423 0 -1.721 155.96 29.586 19 | 921126050700 4.4 29.5 28.6 18.9 3 94 0.025 362 422 0 -1.72 155.96 29.586 20 | 921126055900 4.4 29.3 28.5 18.8 2 90 0.024 171 415 0 -1.721 155.959 29.5 21 | 921126065500 4.1 29.3 28.5 17.9 2 96 0.022 26 410 0 -1.721 155.958 29.374 22 | 921126074700 3.9 29.2 28.5 17.6 1 93 0.020 0 410 0 -1.721 155.954 29.374 23 | 921126083800 3.2 29.3 28.5 17.8 1 78 0.014 0 410 0 -1.721 155.949 29.35 24 | 921126093000 2.2 29.3 28.6 18 1 56 0.007 0 426 0 -1.721 155.945 29.387 25 | 921126102100 1.9 29.3 28.5 18 1 50 0.006 0 414 0 -1.719 155.942 29.446 26 | 921126111200 1.9 29.3 28.4 18 1 51 0.006 0 425 0 -1.717 155.939 29.418 27 | 921126120800 2.5 29.2 28.4 18 1 60 0.009 0 417 0 -1.719 155.937 29.418 28 | 921126130000 3 29.3 28.3 18.1 2 71 0.012 0 408 0 -1.719 155.938 29.352 29 | 921126145300 2.7 29.2 28 18.7 3 58 0.011 0 412 0 -1.714 155.999 29.409 30 | 921126154500 3 29.2 27.9 18.6 4 65 0.012 0 409 0 -1.715 156.024 29.309 31 | 921126163600 3.1 29.2 27.9 18.5 4 68 0.013 0 413 0 -1.718 156.048 29.288 32 | 921126172700 2.5 29.1 28 18.3 2 57 0.009 0 414 0 -1.721 156.068 29.274 33 | 921126181900 1.9 29.1 28 18.2 2 47 0.006 0 409 0 -1.72 156.062 29.26 34 | 921126191000 1.1 29.2 27.9 18.2 2 36 0.003 25 411 0 -1.719 156.055 29.274 35 | 921126200100 0.8 29.2 28 18.4 1 30 0.002 110 414 0 -1.72 156.043 29.274 36 | 921126213400 0.7 29.3 28.1 18.2 2 31 0.002 123 436 0 -1.722 156.017 29.293 37 | 921126222600 2.1 29.2 27.3 18.4 5 55 0.007 116 445 0 -1.723 156.005 29.377 38 | 921126231700 7.9 29.2 25.4 18.2 39 182 0.093 247 436 4.8 -1.724 156.001 29.31 39 | 921127000900 6.6 29.3 25.9 17.7 30 175 0.064 635 418 0 -1.725 156.024 29.328 40 | 921127010000 5.8 29.3 26.7 17.4 19 160 0.048 486 422 0 -1.725 156.056 29.33 41 | 921127015100 4.8 29.3 26.9 17.5 14 129 0.032 356 429 0 -1.721 156.06 29.33 42 | 921127024300 4.5 29.2 27 17.5 12 118 0.029 421 422 0 -1.721 156.048 29.361 43 | 921127033400 5.2 29.2 26.8 17.9 15 129 0.037 191 434 0 -1.722 156.038 29.246 44 | 921127042500 6.9 29.1 25.3 18.2 35 161 0.070 50 437 9.4 -1.723 156.036 29.225 45 | 921127051700 5.7 29.1 25.1 17.5 32 154 0.048 72 434 1.6 -1.717 156.025 29.225 46 | 921127060800 9.9 29.1 24.7 17.7 54 227 0.154 18 432 1.5 -1.718 156.012 29.237 47 | 921127070000 5.2 29.1 25 17.6 29 137 0.040 6 429 0 -1.721 156.005 29.217 48 | 921127075100 4.3 29.1 26.1 16.9 16 121 0.027 0 415 0 -1.716 155.992 29.217 49 | 921127084200 3.7 29.1 26.7 16.3 10 112 0.020 0 414 0 -1.717 155.983 29.162 50 | 921127093400 3.3 29.1 27.2 16.1 7 102 0.016 0 410 0 -1.716 155.977 29.154 51 | 921127102500 3.9 29 27.5 16.2 6 113 0.021 0 410 0 -1.715 155.969 29.136 52 | 921127113200 5 29 27.5 16.9 7 132 0.034 0 414 0 -1.716 155.96 29.136 53 | 921127122600 5.9 29 27.6 17.3 8 147 0.048 0 415 0 -1.715 155.952 29.12 54 | 921127134800 4.9 29 27.5 18.2 7 105 0.033 0 405 0 -1.717 155.946 29.108 55 | 921127143900 5.2 29 27.6 18.3 7 110 0.036 0 406 0 -1.715 155.965 29.103 56 | 921127160400 5.4 29 27.7 17.7 7 126 0.039 0 413 0 -1.717 156.008 29.125 57 | 921127170000 4.4 29 27.7 17.7 5 102 0.026 0 416 0 -1.723 156.001 29.141 58 | 921127175200 3.8 29 27.7 17.7 4 89 0.020 0 413 0 -1.73 155.995 29.124 59 | 921127184300 3.1 29 27.7 17.6 4 75 0.013 2 406 0 -1.734 155.984 29.124 60 | 921127193500 2.9 29 27.9 17.7 3 69 0.012 88 410 0 -1.72 155.998 29.123 61 | 921127202600 2.1 29 27.9 17.8 2 54 0.007 276 410 0 -1.72 155.996 29.119 62 | 921127211700 1.9 29.1 27.8 17.8 3 54 0.006 487 406 0 -1.724 155.988 29.119 63 | 921127220900 1.6 29.2 27.7 17.7 3 52 0.005 670 407 0 -1.733 155.979 29.134 64 | 921127230000 1.4 29.5 27.4 17.9 5 53 0.004 810 416 0 -1.738 155.98 29.138 65 | 921127235200 1.1 30.1 27.4 17.8 7 56 0.003 917 410 0 -1.72 156.006 29.163 66 | 921128004300 1.1 30.6 27.4 17.8 8 63 0.003 960 412 0 -1.718 155.999 29.136 67 | 921128022100 1.5 30.8 27.7 17.9 9 74 0.005 939 413 0 -1.723 155.986 29.174 68 | 921128042600 1.2 31 28.4 17.8 6 66 0.004 665 411 0 -1.716 156.001 29.271 69 | 921128043600 1.3 31 28.7 17.5 5 69 0.004 493 410 0 -1.716 155.999 29.469 70 | 921128052800 0.8 30.7 28.9 17.5 3 51 0.002 301 410 0 -1.72 155.993 29.234 71 | 921128061900 0.6 30.6 28.9 17.6 2 44 0.002 125 411 0 -1.725 155.987 29.44 72 | 921128075200 1.2 30.2 28.7 17.9 2 50 0.003 0 416 0 -1.717 155.999 29.273 73 | 921128084300 1 30.1 28.7 17.9 2 45 0.003 0 417 0 -1.721 155.993 29.302 74 | 921128093500 2.6 29.8 28.4 18.2 4 71 0.010 0 413 0 -1.721 155.991 29.302 75 | 921128102600 1.8 29.5 28.5 17.5 2 56 0.005 0 420 0 -1.722 155.991 29.351 76 | 921128111800 1 29.6 28.6 17.4 1 42 0.002 0 417 0 -1.721 155.991 29.242 77 | 921128120900 2.8 29.3 28 18.8 3 61 0.011 0 411 0 -1.72 155.988 29.304 78 | 921128130100 2.2 29.5 28 18.5 3 56 0.008 0 409 0 -1.719 155.984 29.559 79 | 921128135200 1.6 29.4 28.1 18.1 2 47 0.004 0 407 0 -1.72 155.978 29.559 80 | 921128144400 1.4 29.4 28.1 18 2 44 0.004 0 407 0 -1.721 155.969 29.288 81 | 921128153500 1.9 29.2 28.1 17.8 2 52 0.006 0 407 0 -1.721 155.961 29.262 82 | 921128162600 2.2 29.1 28 17.7 2 57 0.007 0 407 0 -1.721 155.952 29.262 83 | 921128171800 2.3 29.1 28 18 2 56 0.008 0 406 0 -1.72 155.944 29.193 84 | 921128180900 1.9 29 28 18 2 48 0.006 0 410 0 -1.72 155.936 29.134 85 | 921128190100 2.3 29.1 28 17.8 2 58 0.008 14 407 0 -1.72 155.944 29.184 86 | 921128195200 2.2 29.1 28.1 17.9 2 55 0.007 80 408 0 -1.717 155.968 29.169 87 | 921128204400 1.6 29.2 28.1 17.5 2 49 0.005 109 414 0 -1.716 155.993 29.169 88 | 921128213500 1.9 29.4 28.1 17.6 3 59 0.006 278 430 0 -1.713 156.017 29.399 89 | 921128222600 1.2 29.6 27.2 18.5 6 46 0.003 614 425 0 -1.712 156.039 29.519 90 | 921128231800 1.1 29.9 27.3 18.6 6 48 0.003 719 426 0 -1.713 156.049 29.519 91 | 921129000900 0.5 30.4 27.1 18.4 7 47 0.002 930 415 0 -1.713 156.044 29.584 92 | 921129010100 2.6 30.5 27.8 18.3 10 90 0.011 629 435 0 -1.708 156.038 29.492 93 | 921129015200 2.5 30.1 27.7 17.9 9 84 0.011 838 418 0 -1.709 156.033 29.406 94 | 921129024400 1.7 30.5 28.2 18 6 69 0.006 522 432 0 -1.711 156.025 29.406 95 | 921129033500 2.1 30.3 28.5 17.7 5 77 0.008 745 413 0 -1.713 156.016 29.372 96 | 921129042600 2.4 30.3 28.8 17.6 4 83 0.009 565 411 0 -1.714 156.005 29.23 97 | 921129051800 2.1 30.1 28.8 17.8 3 70 0.007 209 430 0 -1.714 155.995 29.23 98 | 921129060900 1.6 29.9 28.1 18.3 4 54 0.005 24 448 0 -1.717 155.982 29.315 99 | 921129070100 3.7 30 26.6 17.9 17 112 0.021 1 445 6.5 -1.718 155.974 29.256 100 | 921129075200 2.1 29.5 25.6 17.1 13 75 0.009 0 441 6.6 -1.717 155.966 29.459 101 | 921129091700 2.2 29.8 27.3 17.1 7 76 0.008 0 410 0 -1.719 155.953 29.343 102 | 921129100800 3.6 29.7 28.1 18.1 6 93 0.018 0 408 0 -1.719 155.947 29.331 103 | 921129110000 3.2 29.4 28.2 18.4 3 74 0.014 0 409 0 -1.719 155.936 29.231 104 | 921129115500 2.5 29.3 28.2 18.3 2 60 0.009 0 409 0 -1.718 155.945 29.231 105 | 921129124700 2.6 29.2 28.1 18.3 2 60 0.010 0 407 0 -1.718 155.97 29.183 106 | 921129133800 2.1 29.3 28 18.2 3 54 0.007 0 406 0 -1.717 155.995 29.402 107 | 921129142900 2.1 29.5 28 18.2 3 57 0.007 0 405 0 -1.715 156.019 29.402 108 | 921129153100 2.4 29.7 28 18.2 4 66 0.009 0 407 0 -1.715 156.046 29.627 109 | 921129163800 3 29.6 28 18 5 79 0.013 0 411 0 -1.714 156.074 29.571 110 | 921129173000 3.4 29.5 27.9 18.2 5 84 0.016 0 414 0 -1.716 156.064 29.494 111 | 921129182100 3.1 29.4 28 18 4 77 0.014 0 417 0 -1.716 156.051 29.421 112 | 921129191300 2.9 29.3 28 18 3 71 0.012 44 415 0 -1.715 156.038 29.421 113 | 921129200400 3.2 29.3 27.8 18.1 5 78 0.014 213 418 0 -1.717 156.027 29.353 114 | 921129205500 2.9 29.3 28.1 17.9 3 73 0.012 340 407 0 -1.717 156.018 29.352 115 | 921129214700 2.4 29.4 28 17.9 4 67 0.009 597 405 0 -1.717 156.008 29.352 116 | 921129223800 2.4 29.6 27.9 17.9 5 71 0.009 766 407 0 -1.717 155.999 29.369 117 | 921129233000 2.4 29.8 27.8 17.8 7 77 0.009 900 411 0 -1.716 155.995 29.305 118 | -------------------------------------------------------------------------------- /hfbulktc.m: -------------------------------------------------------------------------------- 1 | function A=hfbulktc(ur,zr,Ta,zt,rh,zq,Pa,Ts,sal,dlw,dsw,nsw) 2 | % HFBULKTC: computes sensible and latent heat fluxes and other variables. 3 | % A=HFBULKTC(ur,zr,Ta,zt,rh,zq,Pa,Ts,sal,dlw,dsw,nsw) computes the following: 4 | % 5 | % Hs = sensible heat flux INTO ocean [W/m^2] 6 | % Hl = latent heat flux INTO ocean [W/m^2] 7 | % Hl_webb = Webb correction to latent heat flux INTO ocean [W/m^2] 8 | % stress = wind stress [N/m^2] 9 | % U_star = velocity friction scale [m/s] 10 | % T_star = temperature scale [deg C] 11 | % Q_star = humidity scale [kg/kg] 12 | % L = Monin-Obukhov length [m] 13 | % zetu = zr/L 14 | % CD = drag coefficient 15 | % CT = temperature transfer coefficient (Stanton number) 16 | % CQ = moisture transfer coefficient (Dalton number) 17 | % RI = bulk Richardson number 18 | % Dter = cool-skin temperature difference (optional output) [C]; 19 | % positive if surface is cooler than bulk (presently no 20 | % warm skin permitted by model) 21 | % 22 | % Based on the following buoy input data: 23 | % 24 | % ur = wind speed [m/s] measured at height zr [m] 25 | % Ta = air temperature [C] measured at height zt [m] 26 | % rh = relative humidity [%] measured at height zq [m] 27 | % Pa = air pressure [mb] 28 | % Ts = sea surface temperature [C] 29 | % sal = salinity [psu (PSS-78)] 30 | % (optional - only needed for cool-skin) 31 | % dlw = downwelling (INTO water) longwave radiation [W/m^2] 32 | % (optional - only needed for cool-skin) 33 | % dsw = measured insolation [W/m^2] 34 | % (optional - only needed for cool-skin) 35 | % nsw = net shortwave radiation INTO the water [W/m^2] 36 | % (optional - only needed for cool-skin) 37 | % 38 | % where ur, Ta, rh, Pa, Ts, zr, zt, and zq (and optional sal, dlw, 39 | % dsw, and nsw) may be either row or column vectors; and rh, Pa, 40 | % zr, zt, and zq (and optional sal) may also be fixed scalars. 41 | % 42 | % Output variables are given as column vectors in A: 43 | % 44 | % 1) without cool-skin correction: 45 | % 46 | % A=[Hs Hl Hl_webb stress U_star T_star Q_star L zetu CD CT CQ RI] 47 | % 48 | % 2) with cool-skin correction: 49 | % 50 | % A=[Hs Hl Hl_webb stress U_star T_star Q_star L zetu CD CT CQ RI Dter]; 51 | 52 | % Code follows Edson and Fairall TOGA COARE code (version 2.0), modified 53 | % to include Rogers' weighting factor for unstable conditions. Code does 54 | % include gustiness, and assumes that the marine boundary layer height is 55 | % known and constant over time for simiplicity. zr/L is limited to 56 | % be <=3.0 to ensure that the code converges to nonzero stress and heat 57 | % flux values for strongly stable conditions. The bulk Richardson number 58 | % is computed between the sea surface and zr as a diagnostic about whether 59 | % turbulent boundary layer theory is applicable. Code does not include 60 | % warm layer effects to modify Ts. See Fairall et al (1996), J. Geophys. 61 | % Res., 101, 3747-3764, for description of full TOGA COARE code and 62 | % comparison with data. 63 | 64 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 65 | % 8/19/98: version 1.1 (rewritten by RP to remove inconsistencies in 66 | % virtual and real temperatures, improve loop structure, 67 | % correct gustiness component of stress computation) 68 | % 4/9/99: version 1.2 (rewritten by AA to clarify some variable names 69 | % and include cool-skin effect and Webb correction to latent 70 | % heat flux added to output matrix) 71 | % 8/5/99: version 2.0 72 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 73 | 74 | M=length(ur); 75 | 76 | % change to column vectors 77 | ur = ur(:); 78 | Ta = Ta(:); 79 | rh = rh(:); 80 | Ts = Ts(:); 81 | Pa = Pa(:); 82 | zr = zr(:); 83 | zt = zt(:); 84 | zq = zq(:); 85 | 86 | % create vectors for rh, Pa, zr, zt, and zq, if scalars are input 87 | if length(rh)==1 & M>1 88 | rh=rh*ones(M,1); 89 | end 90 | if length(Pa)==1 & M>1 91 | Pa=Pa*ones(M,1); 92 | end 93 | if length(zr)==1 & M>1 94 | zr=zr*ones(M,1); 95 | end 96 | if length(zt)==1 & M>1 97 | zt=zt*ones(M,1); 98 | end 99 | if length(zq)==1 & M>1 100 | zq=zq*ones(M,1); 101 | end 102 | 103 | if nargin > 8 104 | % optional cool-skin stuff 105 | sal = sal(:); 106 | dlw = dlw(:); 107 | dsw = dsw(:); 108 | nsw = nsw(:); 109 | % create vector for sal if scalar is input 110 | if length(sal)==1 & M>1 111 | sal=sal*ones(M,1); 112 | end 113 | end 114 | 115 | % initialize various constants 116 | as_consts; 117 | 118 | tol=.001; % tolerance on Re changes to make sure soln has converged. 119 | 120 | onethird=1./3; 121 | o61=1/eps_air-1; % 0.61 (moisture correction for temperature) 122 | 123 | visc=viscair(Ta); % viscosity 124 | Qsats=Qsat_coeff*qsat(Ts,Pa); % saturation specific humidity; the Qsat_coeff 125 | % value is set in routine as_consts.m 126 | Q=(0.01.*rh).*qsat(Ta,Pa); % specific humidity of air [kg/kg] 127 | T =Ta+CtoK; % convert to K 128 | Tv=T.*(1 + o61*Q); % air virtual temperature 129 | rho=(100*Pa)./(gas_const_R*Tv); % air density 130 | Dt=(Ta+0.0098.*zt)-Ts; % adiabatic temperature difference 131 | Dq=Q-Qsats; % humidity difference 132 | 133 | % compute initial neutral scaling coefficients 134 | S=sqrt(ur.^2 + min_gustiness.^2); 135 | cdnhf=sqrt(cdntc(S,zr,Ta)); % Smith's neutral cd as first guess 136 | 137 | z0t=7.5*10^(-5); 138 | ctnhf=kappa./log(zt./z0t); 139 | 140 | z0q=z0t; 141 | cqnhf=kappa./log(zq./z0q); 142 | 143 | U_star = cdnhf.*S; % (includes gustiness) 144 | T_star = ctnhf.*Dt; % 145 | Q_star = cqnhf.*Dq; % 146 | 147 | Dter = 0; 148 | Dqer = 0; 149 | if nargin > 8 150 | % initial cool-skin thickness guess 151 | delta = 0.001*ones(size(Ts)); 152 | end 153 | 154 | Reu=0;Ret=0;Req=0; 155 | % begin iteration loop to compute best U_star, T_star, and Q_star 156 | for iter1=1:80; 157 | 158 | ReuO=Reu; RetO=Ret; ReqO=Req; % Save old values 159 | 160 | % Compute Monin-Obukov length (NB - definition given as eqn (7) 161 | % of Fairall et al (1996) probably wrong, following, e.g. 162 | % Godfrey and Bellars (1991), JGR, 96, 22043-22048 and original code) 163 | bs=g*(T_star.*(1 + o61*Q) + o61*T.*Q_star)./Tv; 164 | L=(U_star.^2)./(kappa*bs); 165 | % set upper limit on zr/L = 3.0 to force convergence under 166 | % very stable conditions. Assume that zr, zt and zq comparable. 167 | index_limit = (L0); 168 | L(index_limit)=zr(index_limit)/3; 169 | 170 | zetu=zr./L; % nondimensionalized heights 171 | zett=zt./L; 172 | zetq=zq./L; 173 | 174 | % surface roughness 175 | z0=(Charnock_alpha/g).*U_star.^2 + R_roughness.*visc./U_star; 176 | 177 | % compute U_star correction for non-neutral conditions 178 | cdnhf=kappa./(log(zr./z0)-psiutc(zetu)); 179 | U_star=cdnhf.*S; 180 | 181 | Reu=z0.*U_star./visc; % roughness Reynolds # 182 | [Ret,Req]=LKB(Reu); % compute other roughness Reynolds #s 183 | 184 | % compute t and q roughness scales from roughness R#s 185 | z0t=visc.*Ret./U_star; 186 | z0q=visc.*Req./U_star; 187 | 188 | % compute new transfer coefficients at measurement heights 189 | cthf=kappa./(log(zt./z0t)-psittc(zett)); 190 | cqhf=kappa./(log(zq./z0q)-psittc(zetq)); 191 | 192 | % compute new values of T_star, Q_star 193 | T_star=cthf.*(Dt + Dter); 194 | Q_star=cqhf.*(Dq + Dqer); 195 | 196 | % estimate new gustiness 197 | Ws=U_star.*(-CVB_depth./(kappa*L)).^onethird; 198 | wg=min_gustiness*ones(M,1); 199 | j=find(zetu<0); % convection in unstable conditions only 200 | wg(j)=max(min_gustiness,beta_conv.*Ws(j)); % set minimum gustiness 201 | S=sqrt(ur.^2 + wg.^2); 202 | 203 | if nargin > 8 204 | % compute cool-skin parameters 205 | [delta,Dter,Dqer] = cool_skin(sal,Ts-Dter,rho,cp,Pa, ... 206 | U_star,T_star,Q_star, ... 207 | dlw,dsw,nsw,delta,g,gas_const_R, ... 208 | CtoK,Qsat_coeff); 209 | end 210 | 211 | end % end of iteration loop 212 | 213 | ii= abs(Reu-ReuO)>tol | abs(Ret-RetO)>tol | abs(Req-ReqO)>tol; 214 | if any(ii), 215 | disp(['Algorithm did not converge for ' int2str(sum(ii)) ' values. Indices are:']); 216 | disp(find(ii)'); 217 | warning('Not converged!'); 218 | end; 219 | 220 | 221 | % compute latent heat 222 | Le=(2.501-0.00237*(Ts-Dter))*10^6; 223 | 224 | % compute fluxes into ocean 225 | Hs=rho.*cp.*U_star.*T_star; 226 | Hl=rho.*Le.*U_star.*Q_star; 227 | 228 | % compute transfer coefficients at measurement heights 229 | CD=(U_star./S).^2; 230 | CT=U_star.*T_star./(S.*(Dt + Dter)); % Stanton number 231 | CQ=U_star.*Q_star./(S.*(Dq + Dqer)); % Dalton number 232 | 233 | % to compute mean stress, we don't want to include the effects 234 | % of gustiness which average out (in a vector sense). 235 | stress=rho.*CD.*S.*ur; 236 | 237 | % compute bulk Richardson number (as a diagnostic) - the "T" 238 | % is probably not quite right - assumes T \ approx. Ts (good enough though) 239 | RI=g.*zr.*((Dt + Dter) + o61*T.*(Dq + Dqer))./(Tv.*S.^2); 240 | 241 | % compute Webb correction to latent heat flux into ocean 242 | W = 1.61.*U_star.*Q_star + (1 + 1.61.*Q).*U_star.*T_star./T; % eqn. 21 243 | Hl_webb = rho.*Le.*W.*Q; % eqn. 22, Fairall et al. (1996), JGR, 101, p3751. 244 | 245 | % output array 246 | if nargin > 8 247 | % output additional cool-skin parameters 248 | A=[Hs Hl Hl_webb stress U_star T_star Q_star L zetu CD CT CQ RI Dter]; 249 | else 250 | % otherwise 251 | A=[Hs Hl Hl_webb stress U_star T_star Q_star L zetu CD CT CQ RI]; 252 | end 253 | 254 | 255 | 256 | function y=psiutc(zet) 257 | % PSIUTC: computes velocity profile function following TOGA/COARE. 258 | % y=PSIUTC(zet) computes the turbulent velocity profile function given 259 | % zet = (z/L), L the Monin-Obukoff length scale, following Edson and 260 | % Fairall TOGA COARE code (version 2.0) as modified to include Rogers' 261 | % weighting factor to combine the Dyer and free convection forms for 262 | % unstable conditions. 263 | 264 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 265 | % 8/28/98: version 1.1 266 | % 8/5/99: version 1.2 267 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 268 | 269 | c13=1.0./3.0; 270 | sq3=sqrt(3.0); 271 | 272 | % stable conditions 273 | y=-4.7*zet; 274 | 275 | % unstable conditions 276 | j=find(zet<0); 277 | zneg=zet(j); 278 | 279 | % nearly stable (standard functions) 280 | x=(1-16.0.*zneg).^0.25; 281 | y1=2.0.*log((1+x)./2) + log((1+x.^2)./2) -2.*atan(x) + pi/2; 282 | 283 | % free convective limit 284 | x=(1-12.87*zneg).^c13; 285 | y2=1.5*log((x.^2+x+1)./3) - sq3*atan((2.*x+1)/sq3) + pi/sq3; 286 | 287 | % weighted sum of the two 288 | F=1.0./(1+zneg.^2); 289 | y(j)=F.*y1+(1-F).*y2; 290 | 291 | 292 | 293 | 294 | function y=psittc(zet) 295 | % PSITTC: computes potential temperature profile following TOGA/COARE. 296 | % y=PSITTC(zet) computes the turbulent potential temperature profile 297 | % function given zet = (z/L), L the Monin-Obukoff length scale, following 298 | % Edson and Fairall TOGA COARE code (version 2.0), as modified to use 299 | % Rogers' weighting factor to combine the Dyer and free convective 300 | % forms for unstable conditions. 301 | 302 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 303 | % 8/28/98: version 1.1 304 | % 8/5/99: version 1.2 305 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 306 | 307 | c13=1.0./3.0; 308 | sq3=sqrt(3.0); 309 | 310 | % stable conditions 311 | y=-4.7.*zet; 312 | 313 | % unstable conditions 314 | j=find(zet<0); 315 | zneg=zet(j); 316 | 317 | % nearly stable (standard functions) 318 | x=(1-16.0.*zneg).^0.25; 319 | y1=2.0*log((1+x.^2)./2); 320 | 321 | % free convective limit 322 | x=(1-12.87*zneg).^c13; 323 | y2=1.5.*log((x.^2+x+1)./3.0) - sq3.*atan((2.*x+1)./sq3) + pi./sq3; 324 | 325 | % weighted sum of the two 326 | F=1.0./(1+zneg.^2); 327 | y(j)=F.*y1 + (1-F).*y2; 328 | 329 | 330 | 331 | 332 | 333 | function [Ret,Req]=LKB(Reu); 334 | % LKB: computes rougness Reynolds numbers for temperature and humidity 335 | % [Ret,Req]=LKB(Reu) computes the roughness Reynolds for temperature 336 | % and humidity following Liu, Katsaros and Businger (1979), J. Atmos. 337 | % Sci., 36, 1722-1735. 338 | 339 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 340 | % 8/28/98: version 1.1 341 | % 8/5/99: version 1.2 342 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 343 | 344 | Ret=.177*ones(size(Reu)); 345 | Req=.292*ones(size(Reu)); 346 | j=find(Reu>.11 & Reu<=.825); 347 | Ret(j)=1.376.*Reu(j).^0.929; 348 | Req(j)=1.808.*Reu(j).^0.826; 349 | j=find(Reu>.825 & Reu<=3); 350 | Ret(j)=1.026./Reu(j).^0.599; 351 | Req(j)=1.393./Reu(j).^0.528; 352 | j=find(Reu>3 & Reu<=10); 353 | Ret(j)=1.625./Reu(j).^1.018; 354 | Req(j)=1.956./Reu(j).^0.870; 355 | j=find(Reu>10 & Reu<=30); 356 | Ret(j)=4.661./Reu(j).^1.475; 357 | Req(j)=4.994./Reu(j).^1.297; 358 | j=find(Reu>30); 359 | Ret(j)=34.904./Reu(j).^2.067; 360 | Req(j)=30.790./Reu(j).^1.845; 361 | -------------------------------------------------------------------------------- /no_skin_out.txt: -------------------------------------------------------------------------------- 1 | % Output from Fortran program bulk_v25b.f, with both cool-skin and warm-layer 2 | % turned OFF, and using input file test2_5b.dat with COARE data 3 | % index xtime hsb hlb tub ts HF EF TAU T0 Webb RainF rain dt_cool dt_warm tk_pwp 4 | 1 921125132100. 6. 111. .030 29.15 9. 125. .030 29.15 5. 0. .0 .00 .00 19.00 5 | 2 921125141200. 5. 96. .023 29.15 8. 108. .023 29.15 4. 0. .0 .00 .00 19.00 6 | 3 921125150300. 5. 98. .024 29.15 7. 110. .025 29.15 4. 0. .0 .00 .00 19.00 7 | 4 921125155500. 5. 110. .029 29.15 8. 124. .029 29.15 5. 0. .0 .00 .00 19.00 8 | 5 921125164600. 4. 92. .019 29.16 7. 104. .019 29.16 4. 0. .0 .00 .00 19.00 9 | 6 921125173800. 9. 123. .036 29.16 13. 138. .035 29.16 6. 0. .0 .00 .00 19.00 10 | 7 921125182900. 4. 61. .009 29.16 6. 70. .009 29.16 3. 0. .0 .00 .00 19.00 11 | 8 921125192000. 4. 89. .019 29.15 6. 99. .019 29.15 4. 0. .0 .00 .00 19.00 12 | 9 921125201200. 4. 113. .030 29.14 7. 125. .030 29.14 5. 0. .0 .00 .00 19.00 13 | 10 921125210500. 5. 84. .021 29.13 7. 93. .020 29.13 4. 0. .0 .00 .00 19.00 14 | 11 921125221900. 5. 113. .028 29.14 7. 121. .028 29.14 4. 0. .0 .00 .00 19.00 15 | 12 921125232700. 6. 124. .036 29.14 7. 128. .036 29.14 5. 0. .0 .00 .00 19.00 16 | 13 921126001900. 6. 106. .026 29.20 6. 108. .025 29.20 4. 0. .0 .00 .00 19.00 17 | 14 921126011000. 5. 90. .022 29.27 6. 93. .021 29.27 4. 0. .0 .00 .00 19.00 18 | 15 921126022200. 4. 123. .030 29.26 4. 121. .030 29.26 4. 0. .0 .00 .00 19.00 19 | 16 921126031300. 5. 119. .030 29.42 6. 123. .030 29.42 4. 0. .0 .00 .00 19.00 20 | 17 921126041600. 4. 104. .025 29.59 6. 110. .024 29.59 4. 0. .0 .00 .00 19.00 21 | 18 921126050700. 3. 94. .025 29.59 5. 103. .025 29.59 4. 0. .0 .00 .00 19.00 22 | 19 921126055900. 2. 90. .024 29.50 5. 103. .025 29.50 4. 0. .0 .00 .00 19.00 23 | 20 921126065500. 2. 96. .022 29.37 4. 107. .022 29.37 4. 0. .0 .00 .00 19.00 24 | 21 921126074700. 1. 93. .020 29.37 4. 106. .020 29.37 4. 0. .0 .00 .00 19.00 25 | 22 921126083800. 1. 78. .014 29.35 3. 86. .014 29.35 3. 0. .0 .00 .00 19.00 26 | 23 921126093000. 1. 56. .007 29.39 2. 63. .007 29.39 2. 0. .0 .00 .00 19.00 27 | 24 921126102100. 1. 50. .006 29.45 3. 58. .006 29.45 2. 0. .0 .00 .00 19.00 28 | 25 921126111200. 1. 51. .006 29.42 3. 58. .006 29.42 2. 0. .0 .00 .00 19.00 29 | 26 921126120800. 1. 60. .009 29.42 3. 70. .009 29.42 3. 0. .0 .00 .00 19.00 30 | 27 921126130000. 2. 71. .012 29.35 4. 79. .012 29.35 3. 0. .0 .00 .00 19.00 31 | 28 921126145300. 3. 58. .011 29.41 5. 68. .010 29.41 3. 0. .0 .00 .00 19.00 32 | 29 921126154500. 4. 65. .012 29.31 6. 74. .013 29.31 3. 0. .0 .00 .00 19.00 33 | 30 921126163600. 4. 68. .013 29.29 6. 76. .013 29.29 3. 0. .0 .00 .00 19.00 34 | 31 921126172700. 2. 57. .009 29.27 4. 66. .009 29.27 3. 0. .0 .00 .00 19.00 35 | 32 921126181900. 2. 47. .006 29.26 4. 55. .006 29.26 2. 0. .0 .00 .00 19.00 36 | 33 921126191000. 2. 36. .003 29.27 3. 41. .002 29.27 2. 0. .0 .00 .00 19.00 37 | 34 921126200100. 1. 30. .002 29.27 2. 35. .002 29.27 1. 0. .0 .00 .00 19.00 38 | 35 921126213400. 2. 31. .002 29.29 2. 34. .001 29.29 1. 0. .0 .00 .00 19.00 39 | 36 921126222600. 5. 55. .007 29.38 7. 61. .007 29.38 3. 0. .0 .00 .00 19.00 40 | 37 921126231700. 39. 182. .093 29.31 43. 198. .093 29.31 12. 26. 4.8 .00 .00 19.00 41 | 38 921127000900. 30. 175. .064 29.33 33. 186. .063 29.33 10. 0. .0 .00 .00 19.00 42 | 39 921127010000. 19. 160. .048 29.33 22. 171. .048 29.33 8. 0. .0 .00 .00 19.00 43 | 40 921127015100. 14. 129. .032 29.33 16. 138. .032 29.33 6. 0. .0 .00 .00 19.00 44 | 41 921127024300. 12. 118. .029 29.36 15. 130. .028 29.36 6. 0. .0 .00 .00 19.00 45 | 42 921127033400. 15. 129. .037 29.25 18. 140. .038 29.25 7. 0. .0 .00 .00 19.00 46 | 43 921127042500. 35. 161. .070 29.23 39. 177. .070 29.23 11. 50. 9.4 .00 .00 19.00 47 | 44 921127051700. 32. 154. .048 29.23 36. 169. .048 29.23 10. 9. 1.6 .00 .00 19.00 48 | 45 921127060800. 54. 227. .154 29.24 60. 248. .155 29.24 16. 9. 1.5 .00 .00 19.00 49 | 46 921127070000. 29. 137. .040 29.22 33. 152. .040 29.22 9. 0. .0 .00 .00 19.00 50 | 47 921127075100. 16. 121. .027 29.22 20. 135. .027 29.22 6. 0. .0 .00 .00 19.00 51 | 48 921127084200. 10. 112. .020 29.16 13. 123. .020 29.16 5. 0. .0 .00 .00 19.00 52 | 49 921127093400. 7. 102. .016 29.15 9. 112. .016 29.15 4. 0. .0 .00 .00 19.00 53 | 50 921127102500. 6. 113. .021 29.14 9. 126. .021 29.14 4. 0. .0 .00 .00 19.00 54 | 51 921127113200. 7. 132. .034 29.14 11. 147. .034 29.14 6. 0. .0 .00 .00 19.00 55 | 52 921127122600. 8. 147. .048 29.12 12. 163. .047 29.12 6. 0. .0 .00 .00 19.00 56 | 53 921127134800. 7. 105. .033 29.11 10. 118. .032 29.11 5. 0. .0 .00 .00 19.00 57 | 54 921127143900. 7. 110. .036 29.10 10. 123. .036 29.10 5. 0. .0 .00 .00 19.00 58 | 55 921127160400. 7. 126. .039 29.13 10. 140. .039 29.13 5. 0. .0 .00 .00 19.00 59 | 56 921127170000. 5. 102. .026 29.14 8. 115. .026 29.14 4. 0. .0 .00 .00 19.00 60 | 57 921127175200. 4. 89. .020 29.12 7. 100. .020 29.12 4. 0. .0 .00 .00 19.00 61 | 58 921127184300. 4. 75. .013 29.12 6. 85. .013 29.12 3. 0. .0 .00 .00 19.00 62 | 59 921127193500. 3. 69. .012 29.12 5. 78. .012 29.12 3. 0. .0 .00 .00 19.00 63 | 60 921127202600. 2. 54. .007 29.12 4. 61. .007 29.12 2. 0. .0 .00 .00 19.00 64 | 61 921127211700. 3. 54. .006 29.12 4. 57. .006 29.12 2. 0. .0 .00 .00 19.00 65 | 62 921127220900. 3. 52. .005 29.13 4. 53. .004 29.13 2. 0. .0 .00 .00 19.00 66 | 63 921127230000. 5. 53. .004 29.14 4. 49. .004 29.14 2. 0. .0 .00 .00 19.00 67 | 64 921127235200. 7. 56. .003 29.16 4. 44. .003 29.16 2. 0. .0 .00 .00 19.00 68 | 65 921128004300. 8. 63. .003 29.14 4. 44. .003 29.14 2. 0. .0 .00 .00 19.00 69 | 66 921128022100. 9. 74. .005 29.17 4. 50. .004 29.17 2. 0. .0 .00 .00 19.00 70 | 67 921128042600. 6. 66. .004 29.27 2. 44. .003 29.27 2. 0. .0 .00 .00 19.00 71 | 68 921128043600. 5. 69. .004 29.47 2. 50. .003 29.47 2. 0. .0 .00 .00 19.00 72 | 69 921128052800. 3. 51. .002 29.23 0. 36. .001 29.23 1. 0. .0 .00 .00 19.00 73 | 70 921128061900. 2. 44. .002 29.44 1. 34. .001 29.44 1. 0. .0 .00 .00 19.00 74 | 71 921128075200. 2. 50. .003 29.27 1. 42. .003 29.27 1. 0. .0 .00 .00 19.00 75 | 72 921128084300. 2. 45. .003 29.30 1. 39. .002 29.30 1. 0. .0 .00 .00 19.00 76 | 73 921128093500. 4. 71. .010 29.30 3. 68. .009 29.30 2. 0. .0 .00 .00 19.00 77 | 74 921128102600. 2. 56. .005 29.35 2. 59. .005 29.35 2. 0. .0 .00 .00 19.00 78 | 75 921128111800. 1. 42. .002 29.24 1. 42. .002 29.24 1. 0. .0 .00 .00 19.00 79 | 76 921128120900. 3. 61. .011 29.30 5. 67. .011 29.30 3. 0. .0 .00 .00 19.00 80 | 77 921128130100. 3. 56. .008 29.56 5. 63. .007 29.56 3. 0. .0 .00 .00 19.00 81 | 78 921128135200. 2. 47. .004 29.56 4. 55. .004 29.56 2. 0. .0 .00 .00 19.00 82 | 79 921128144400. 2. 44. .004 29.29 3. 48. .004 29.29 2. 0. .0 .00 .00 19.00 83 | 80 921128153500. 2. 52. .006 29.26 3. 58. .006 29.26 2. 0. .0 .00 .00 19.00 84 | 81 921128162600. 2. 57. .007 29.26 4. 66. .007 29.26 2. 0. .0 .00 .00 19.00 85 | 82 921128171800. 2. 56. .008 29.19 4. 64. .008 29.19 2. 0. .0 .00 .00 19.00 86 | 83 921128180900. 2. 48. .006 29.13 3. 55. .006 29.13 2. 0. .0 .00 .00 19.00 87 | 84 921128190100. 2. 58. .008 29.18 4. 65. .008 29.18 2. 0. .0 .00 .00 19.00 88 | 85 921128195200. 2. 55. .007 29.17 3. 62. .007 29.17 2. 0. .0 .00 .00 19.00 89 | 86 921128204400. 2. 49. .005 29.17 3. 54. .004 29.17 2. 0. .0 .00 .00 19.00 90 | 87 921128213500. 3. 59. .006 29.40 4. 62. .006 29.40 2. 0. .0 .00 .00 19.00 91 | 88 921128222600. 6. 46. .003 29.52 6. 46. .003 29.52 2. 0. .0 .00 .00 19.00 92 | 89 921128231800. 6. 48. .003 29.52 5. 44. .003 29.52 2. 0. .0 .00 .00 19.00 93 | 90 921129000900. 7. 47. .002 29.58 5. 36. .001 29.58 2. 0. .0 .00 .00 19.00 94 | 91 921129010100. 10. 90. .011 29.49 6. 73. .010 29.49 3. 0. .0 .00 .00 19.00 95 | 92 921129015200. 9. 84. .011 29.41 6. 74. .009 29.41 3. 0. .0 .00 .00 19.00 96 | 93 921129024400. 6. 69. .006 29.41 3. 55. .005 29.41 2. 0. .0 .00 .00 19.00 97 | 94 921129033500. 5. 77. .008 29.37 2. 64. .007 29.37 2. 0. .0 .00 .00 19.00 98 | 95 921129042600. 4. 83. .009 29.23 1. 67. .008 29.23 2. 0. .0 .00 .00 19.00 99 | 96 921129051800. 3. 70. .007 29.23 1. 59. .006 29.23 2. 0. .0 .00 .00 19.00 100 | 97 921129060900. 4. 54. .005 29.32 3. 50. .004 29.32 2. 0. .0 .00 .00 19.00 101 | 98 921129070100. 17. 112. .021 29.26 14. 102. .020 29.26 5. 32. 6.5 .00 .00 19.00 102 | 99 921129075200. 13. 75. .009 29.46 14. 80. .008 29.46 4. 41. 6.6 .00 .00 19.00 103 | 100 921129091700. 7. 76. .008 29.34 7. 76. .008 29.34 3. 0. .0 .00 .00 19.00 104 | 101 921129100800. 6. 93. .018 29.33 6. 93. .017 29.33 4. 0. .0 .00 .00 19.00 105 | 102 921129110000. 3. 74. .014 29.23 4. 77. .014 29.23 3. 0. .0 .00 .00 19.00 106 | 103 921129115500. 2. 60. .009 29.23 3. 65. .009 29.23 2. 0. .0 .00 .00 19.00 107 | 104 921129124700. 2. 60. .010 29.18 4. 66. .010 29.18 2. 0. .0 .00 .00 19.00 108 | 105 921129133800. 3. 54. .007 29.40 4. 61. .007 29.40 2. 0. .0 .00 .00 19.00 109 | 106 921129142900. 3. 57. .007 29.40 4. 61. .007 29.40 2. 0. .0 .00 .00 19.00 110 | 107 921129153100. 4. 66. .009 29.63 6. 72. .009 29.63 3. 0. .0 .00 .00 19.00 111 | 108 921129163800. 5. 79. .013 29.57 6. 86. .013 29.57 3. 0. .0 .00 .00 19.00 112 | 109 921129173000. 5. 84. .016 29.49 7. 91. .016 29.49 4. 0. .0 .00 .00 19.00 113 | 110 921129182100. 4. 77. .014 29.42 6. 85. .013 29.42 3. 0. .0 .00 .00 19.00 114 | 111 921129191300. 3. 71. .012 29.42 6. 81. .012 29.42 3. 0. .0 .00 .00 19.00 115 | 112 921129200400. 5. 78. .014 29.35 7. 85. .014 29.35 3. 0. .0 .00 .00 19.00 116 | 113 921129205500. 3. 73. .012 29.35 5. 80. .012 29.35 3. 0. .0 .00 .00 19.00 117 | 114 921129214700. 4. 67. .009 29.35 5. 70. .009 29.35 3. 0. .0 .00 .00 19.00 118 | 115 921129223800. 5. 71. .009 29.37 5. 70. .009 29.37 3. 0. .0 .00 .00 19.00 119 | 116 921129233000. 7. 77. .009 29.31 5. 70. .009 29.31 3. 0. .0 .00 .00 19.00 120 | -------------------------------------------------------------------------------- /yes_skin_out.txt: -------------------------------------------------------------------------------- 1 | % Output from Fortran program bulk_v25b.f, with cool-skin turned ON and warm-layer 2 | % turned OFF, and using input file test2_5b.dat with COARE data 3 | % index xtime hsb hlb tub ts HF EF TAU T0 Webb RainF rain dt_cool dt_warm tk_pwp 4 | 1 921125132100. 6. 111. .030 29.15 7. 116. .029 28.86 4. 0. .0 .29 .00 19.00 5 | 2 921125141200. 5. 96. .023 29.15 6. 100. .022 28.86 4. 0. .0 .29 .00 19.00 6 | 3 921125150300. 5. 98. .024 29.15 6. 102. .024 28.85 4. 0. .0 .30 .00 19.00 7 | 4 921125155500. 5. 110. .029 29.15 6. 114. .029 28.83 4. 0. .0 .31 .00 19.00 8 | 5 921125164600. 4. 92. .019 29.16 5. 96. .018 28.83 3. 0. .0 .33 .00 19.00 9 | 6 921125173800. 9. 123. .036 29.16 10. 128. .035 28.85 5. 0. .0 .31 .00 19.00 10 | 7 921125182900. 4. 61. .009 29.16 5. 64. .009 28.85 3. 0. .0 .31 .00 19.00 11 | 8 921125192000. 4. 89. .019 29.15 4. 92. .019 28.86 3. 0. .0 .28 .00 19.00 12 | 9 921125201200. 4. 113. .030 29.14 5. 117. .030 28.89 4. 0. .0 .25 .00 19.00 13 | 10 921125210500. 5. 84. .021 29.13 5. 87. .020 28.91 3. 0. .0 .21 .00 19.00 14 | 11 921125221900. 5. 113. .028 29.14 6. 114. .028 28.93 4. 0. .0 .21 .00 19.00 15 | 12 921125232700. 6. 124. .036 29.14 6. 122. .035 28.97 4. 0. .0 .17 .00 19.00 16 | 13 921126001900. 6. 106. .026 29.20 5. 104. .025 29.05 4. 0. .0 .15 .00 19.00 17 | 14 921126011000. 5. 90. .022 29.27 5. 90. .021 29.15 3. 0. .0 .12 .00 19.00 18 | 15 921126022200. 4. 123. .030 29.26 3. 115. .030 29.10 4. 0. .0 .16 .00 19.00 19 | 16 921126031300. 5. 119. .030 29.42 5. 117. .030 29.23 4. 0. .0 .19 .00 19.00 20 | 17 921126041600. 4. 104. .025 29.59 4. 104. .024 29.38 4. 0. .0 .21 .00 19.00 21 | 18 921126050700. 3. 94. .025 29.59 4. 97. .025 29.36 4. 0. .0 .22 .00 19.00 22 | 19 921126055900. 2. 90. .024 29.50 4. 95. .025 29.24 3. 0. .0 .26 .00 19.00 23 | 20 921126065500. 2. 96. .022 29.37 2. 98. .022 29.06 3. 0. .0 .32 .00 19.00 24 | 21 921126074700. 1. 93. .020 29.37 2. 98. .020 29.04 3. 0. .0 .33 .00 19.00 25 | 22 921126083800. 1. 78. .014 29.35 2. 79. .013 29.01 3. 0. .0 .34 .00 19.00 26 | 23 921126093000. 1. 56. .007 29.39 1. 58. .007 29.08 2. 0. .0 .31 .00 19.00 27 | 24 921126102100. 1. 50. .006 29.45 1. 53. .005 29.11 2. 0. .0 .34 .00 19.00 28 | 25 921126111200. 1. 51. .006 29.42 2. 53. .005 29.10 2. 0. .0 .31 .00 19.00 29 | 26 921126120800. 1. 60. .009 29.42 2. 64. .009 29.09 2. 0. .0 .33 .00 19.00 30 | 27 921126130000. 2. 71. .012 29.35 2. 72. .012 29.01 2. 0. .0 .34 .00 19.00 31 | 28 921126145300. 3. 58. .011 29.41 4. 62. .010 29.08 2. 0. .0 .33 .00 19.00 32 | 29 921126154500. 4. 65. .012 29.31 4. 67. .012 28.98 3. 0. .0 .33 .00 19.00 33 | 30 921126163600. 4. 68. .013 29.29 4. 70. .013 28.97 3. 0. .0 .32 .00 19.00 34 | 31 921126172700. 2. 57. .009 29.27 3. 60. .009 28.95 2. 0. .0 .33 .00 19.00 35 | 32 921126181900. 2. 47. .006 29.26 2. 50. .006 28.92 2. 0. .0 .34 .00 19.00 36 | 33 921126191000. 2. 36. .003 29.27 2. 37. .002 28.94 1. 0. .0 .33 .00 19.00 37 | 34 921126200100. 1. 30. .002 29.27 2. 31. .001 28.99 1. 0. .0 .28 .00 19.00 38 | 35 921126213400. 2. 31. .002 29.29 2. 32. .001 29.08 1. 0. .0 .22 .00 19.00 39 | 36 921126222600. 5. 55. .007 29.38 6. 57. .007 29.14 3. 0. .0 .23 .00 19.00 40 | 37 921126231700. 39. 182. .093 29.31 40. 187. .093 29.06 12. 26. 4.8 .25 .00 19.00 41 | 38 921127000900. 30. 175. .064 29.33 30. 176. .063 29.07 9. 0. .0 .25 .00 19.00 42 | 39 921127010000. 19. 160. .048 29.33 19. 161. .047 29.06 7. 0. .0 .27 .00 19.00 43 | 40 921127015100. 14. 129. .032 29.33 14. 130. .032 29.07 6. 0. .0 .26 .00 19.00 44 | 41 921127024300. 12. 118. .029 29.36 13. 123. .028 29.10 5. 0. .0 .26 .00 19.00 45 | 42 921127033400. 15. 129. .037 29.25 16. 131. .037 28.98 6. 0. .0 .26 .00 19.00 46 | 43 921127042500. 35. 161. .070 29.23 36. 166. .070 28.95 10. 50. 9.4 .27 .00 19.00 47 | 44 921127051700. 32. 154. .048 29.23 33. 158. .047 28.91 9. 9. 1.6 .31 .00 19.00 48 | 45 921127060800. 54. 227. .154 29.24 56. 234. .154 28.97 15. 9. 1.5 .26 .00 19.00 49 | 46 921127070000. 29. 137. .040 29.22 31. 141. .039 28.89 8. 0. .0 .33 .00 19.00 50 | 47 921127075100. 16. 121. .027 29.22 17. 124. .026 28.86 6. 0. .0 .36 .00 19.00 51 | 48 921127084200. 10. 112. .020 29.16 11. 113. .019 28.79 4. 0. .0 .37 .00 19.00 52 | 49 921127093400. 7. 102. .016 29.15 7. 103. .015 28.78 4. 0. .0 .38 .00 19.00 53 | 50 921127102500. 6. 113. .021 29.14 6. 116. .021 28.77 4. 0. .0 .37 .00 19.00 54 | 51 921127113200. 7. 132. .034 29.14 8. 136. .033 28.81 5. 0. .0 .33 .00 19.00 55 | 52 921127122600. 8. 147. .048 29.12 9. 152. .047 28.81 6. 0. .0 .31 .00 19.00 56 | 53 921127134800. 7. 105. .033 29.11 8. 109. .032 28.80 4. 0. .0 .31 .00 19.00 57 | 54 921127143900. 7. 110. .036 29.10 8. 113. .036 28.81 5. 0. .0 .30 .00 19.00 58 | 55 921127160400. 7. 126. .039 29.13 8. 130. .039 28.82 5. 0. .0 .30 .00 19.00 59 | 56 921127170000. 5. 102. .026 29.14 6. 106. .025 28.83 4. 0. .0 .31 .00 19.00 60 | 57 921127175200. 4. 89. .020 29.12 5. 92. .019 28.80 3. 0. .0 .32 .00 19.00 61 | 58 921127184300. 4. 75. .013 29.12 4. 77. .013 28.78 3. 0. .0 .35 .00 19.00 62 | 59 921127193500. 3. 69. .012 29.12 3. 72. .012 28.81 3. 0. .0 .32 .00 19.00 63 | 60 921127202600. 2. 54. .007 29.12 3. 56. .007 28.86 2. 0. .0 .26 .00 19.00 64 | 61 921127211700. 3. 54. .006 29.12 3. 54. .006 28.91 2. 0. .0 .21 .00 19.00 65 | 62 921127220900. 3. 52. .005 29.13 3. 51. .004 29.01 2. 0. .0 .13 .00 19.00 66 | 63 921127230000. 5. 53. .004 29.14 4. 49. .004 29.14 2. 0. .0 .00 .00 19.00 67 | 64 921127235200. 7. 56. .003 29.16 4. 44. .003 29.16 2. 0. .0 .00 .00 19.00 68 | 65 921128004300. 8. 63. .003 29.14 4. 44. .003 29.14 2. 0. .0 .00 .00 19.00 69 | 66 921128022100. 9. 74. .005 29.17 4. 50. .004 29.17 2. 0. .0 .00 .00 19.00 70 | 67 921128042600. 6. 66. .004 29.27 2. 43. .003 29.20 1. 0. .0 .07 .00 19.00 71 | 68 921128043600. 5. 69. .004 29.47 1. 47. .003 29.28 1. 0. .0 .18 .00 19.00 72 | 69 921128052800. 3. 51. .002 29.23 0. 33. .001 29.01 1. 0. .0 .22 .00 19.00 73 | 70 921128061900. 2. 44. .002 29.44 0. 31. .001 29.15 1. 0. .0 .29 .00 19.00 74 | 71 921128075200. 2. 50. .003 29.27 0. 38. .003 28.95 1. 0. .0 .32 .00 19.00 75 | 72 921128084300. 2. 45. .003 29.30 0. 35. .002 28.98 1. 0. .0 .32 .00 19.00 76 | 73 921128093500. 4. 71. .010 29.30 2. 62. .009 28.98 2. 0. .0 .33 .00 19.00 77 | 74 921128102600. 2. 56. .005 29.35 1. 54. .005 29.02 2. 0. .0 .33 .00 19.00 78 | 75 921128111800. 1. 42. .002 29.24 0. 38. .002 28.92 1. 0. .0 .32 .00 19.00 79 | 76 921128120900. 3. 61. .011 29.30 3. 61. .011 28.99 2. 0. .0 .32 .00 19.00 80 | 77 921128130100. 3. 56. .008 29.56 4. 57. .007 29.21 2. 0. .0 .35 .00 19.00 81 | 78 921128135200. 2. 47. .004 29.56 3. 49. .004 29.19 2. 0. .0 .37 .00 19.00 82 | 79 921128144400. 2. 44. .004 29.29 2. 43. .003 28.93 2. 0. .0 .35 .00 19.00 83 | 80 921128153500. 2. 52. .006 29.26 2. 53. .006 28.91 2. 0. .0 .36 .00 19.00 84 | 81 921128162600. 2. 57. .007 29.26 3. 60. .007 28.91 2. 0. .0 .36 .00 19.00 85 | 82 921128171800. 2. 56. .008 29.19 2. 58. .008 28.85 2. 0. .0 .35 .00 19.00 86 | 83 921128180900. 2. 48. .006 29.13 2. 50. .006 28.79 2. 0. .0 .34 .00 19.00 87 | 84 921128190100. 2. 58. .008 29.18 2. 59. .008 28.84 2. 0. .0 .35 .00 19.00 88 | 85 921128195200. 2. 55. .007 29.17 2. 56. .007 28.85 2. 0. .0 .32 .00 19.00 89 | 86 921128204400. 2. 49. .005 29.17 2. 49. .004 28.86 2. 0. .0 .31 .00 19.00 90 | 87 921128213500. 3. 59. .006 29.40 3. 59. .006 29.17 2. 0. .0 .23 .00 19.00 91 | 88 921128222600. 6. 46. .003 29.52 5. 45. .003 29.44 2. 0. .0 .08 .00 19.00 92 | 89 921128231800. 6. 48. .003 29.52 5. 44. .003 29.52 2. 0. .0 .00 .00 19.00 93 | 90 921129000900. 7. 47. .002 29.58 5. 36. .001 29.58 2. 0. .0 .00 .00 19.00 94 | 91 921129010100. 10. 90. .011 29.49 6. 70. .010 29.37 3. 0. .0 .12 .00 19.00 95 | 92 921129015200. 9. 84. .011 29.41 6. 72. .009 29.30 3. 0. .0 .10 .00 19.00 96 | 93 921129024400. 6. 69. .006 29.41 3. 53. .005 29.29 2. 0. .0 .12 .00 19.00 97 | 94 921129033500. 5. 77. .008 29.37 2. 62. .007 29.26 2. 0. .0 .11 .00 19.00 98 | 95 921129042600. 4. 83. .009 29.23 0. 64. .008 29.05 2. 0. .0 .18 .00 19.00 99 | 96 921129051800. 3. 70. .007 29.23 0. 55. .006 29.00 2. 0. .0 .23 .00 19.00 100 | 97 921129060900. 4. 54. .005 29.32 2. 46. .004 29.08 2. 0. .0 .24 .00 19.00 101 | 98 921129070100. 17. 112. .021 29.26 12. 95. .019 28.98 5. 32. 6.5 .28 .00 19.00 102 | 99 921129075200. 13. 75. .009 29.46 13. 75. .008 29.13 4. 41. 6.6 .33 .00 19.00 103 | 100 921129091700. 7. 76. .008 29.34 5. 69. .008 28.97 3. 0. .0 .37 .00 19.00 104 | 101 921129100800. 6. 93. .018 29.33 4. 85. .017 29.00 3. 0. .0 .33 .00 19.00 105 | 102 921129110000. 3. 74. .014 29.23 3. 71. .013 28.91 2. 0. .0 .32 .00 19.00 106 | 103 921129115500. 2. 60. .009 29.23 2. 59. .009 28.90 2. 0. .0 .33 .00 19.00 107 | 104 921129124700. 2. 60. .010 29.18 2. 60. .009 28.85 2. 0. .0 .33 .00 19.00 108 | 105 921129133800. 3. 54. .007 29.40 3. 56. .007 29.05 2. 0. .0 .36 .00 19.00 109 | 106 921129142900. 3. 57. .007 29.40 3. 56. .007 29.04 2. 0. .0 .36 .00 19.00 110 | 107 921129153100. 4. 66. .009 29.63 4. 65. .008 29.26 3. 0. .0 .36 .00 19.00 111 | 108 921129163800. 5. 79. .013 29.57 5. 79. .012 29.22 3. 0. .0 .35 .00 19.00 112 | 109 921129173000. 5. 84. .016 29.49 6. 84. .016 29.16 3. 0. .0 .33 .00 19.00 113 | 110 921129182100. 4. 77. .014 29.42 4. 78. .013 29.09 3. 0. .0 .33 .00 19.00 114 | 111 921129191300. 3. 71. .012 29.42 4. 74. .012 29.10 3. 0. .0 .32 .00 19.00 115 | 112 921129200400. 5. 78. .014 29.35 5. 79. .014 29.08 3. 0. .0 .27 .00 19.00 116 | 113 921129205500. 3. 73. .012 29.35 4. 74. .012 29.08 3. 0. .0 .27 .00 19.00 117 | 114 921129214700. 4. 67. .009 29.35 4. 66. .008 29.15 2. 0. .0 .20 .00 19.00 118 | 115 921129223800. 5. 71. .009 29.37 4. 68. .009 29.23 3. 0. .0 .14 .00 19.00 119 | 116 921129233000. 7. 77. .009 29.31 5. 69. .009 29.22 3. 0. .0 .09 .00 19.00 120 | --------------------------------------------------------------------------------