function [atteno,attenq, Iatten,rhoa] = attenCalc(z,t,q,p,f)
%z height    (m)
%t temperature (C)
%q g/kg
%p  Press (mb)
%f  radar freq  (GHz)
rp=p/1013;
rl=288./(288+t);
Rgas=287.1;tdk=273.15;
rhoa = p*100./(Rgas*(t+tdk).*(1+0.61*q*1e-3));
Q=q.*rhoa;%g/m^3


Ao=2e-4*rl.^1.5*(1-1.2e-5*f.^1.5)+4./((f-63).^2+1.5*rp.^2.*rl.^5)+0.28*rl.^2./((f-118.75).^2+2.48*rp.^2.*rl.^2);
Ao=Ao.*f.^2.*rl.^2.*rp.^2*1e-3;
atteno=Ao;

%Aq=3.27e-2.*rl+1.67e-3*Q.*rl.^7./rp.^2+7.7e-4*f.^.5+3.39./((f-22.235).^2+9.81*rp.^2.*rl+11.73.*rl./((f-183.31).^2+11.85*rp.^2.*rl);
 Aq=3.27e-2.*rl+1.67e-3*Q.*rl.^7./rp+7.7e-4*f.^.5+3.39./((f-22.235).^2+9.81*rp.^2.*rl);
Aq=Aq+11.73.*rl./((f-183.31).^2+11.85*rp.^2.*rl)+4.01*rl./((f-325.123).^2+10.44*rp.^2.*rl);

Aq=Aq.*f.^2.*Q.*rp.*rl*1e-4;
attenq=Aq;
Iatten=atteno+attenq;



