# #Script to compute the effect of a single-layer cloud on OLR and #on albedo # # #Data on section of text which this script is associated with Chapter = '5.**' Figure = '**' # #ToDo: This uses ccmradFunctions from Chapter4Scripts. #You will need to put Chapter4Scripts in your Pythonpath, #or put a copy of ccmradFunctions in some directory that is #already in the Python search path. (or just put a copy #in the same directory as this script is in. #That needs to be be replaced by something better. # from ClimateUtilities import * import phys import ccmradFunctions as ccm #Get the pressure and temperature used in the OLR function. psAir = 1.e5 co2 = 300. rh = .5 Ts = 300. ps,p,T,q = ccm.getMoistProfile(psAir,Ts,rh,co2) #Set the cloud temperature Tcloud = 240. #Now find the level for that temperature, and put a cloud there clwp = Numeric.zeros(ccm.r.nlev,Numeric.Float) kCloud = Numeric.searchsorted(T,Tcloud) #Cloud level. clwL = [2*i for i in range(100)] OLRList = [] albList = [] for clw in clwL: clwp[kCloud] = clw olr,alb,abs = ccm.AllRad(psAir,Ts,rh,co2,cloudWater=clwp,r_ice = 10.*numpy.ones(ccm.r.nlev)) OLRList.append(olr) albList.append(alb) Tbar = .5*(T[kCloud]+T[kCloud-1]) OLRinf = phys.sigma*Tbar**4 c = Curve() c.addCurve(clwL,'clw','Cloud Condensed Water Path') c.addCurve(OLRList,'olr') c.addCurve([OLRinf for x in clwL],'OLRinf') c.PlotTitle = 'OLR,pCloud = %f,TCloud = %f'%(p[kCloud],Tbar) c.Xlabel = 'Cloud water path (g/m**2)' plot(c) c1 = Curve() c1.addCurve(clwL,'clw','Cloud Condensed Water Path') c1.addCurve(albList,'albedo') c1.PlotTitle = 'albedo,pCloud = %f,TCloud = %f'%(p[kCloud],Tbar) c1.Xlabel = 'Cloud water path (g/m**2)' plot(c1)