; ; Plot the average cloud fraction vs height ; pro plot_average_cfrac_height;,site,searchdate,avg_int site='sgp' searchdate='200004' avg_int='1hr' ; ; common containing the monthly averaged data ; common monthly_averaged_data, base_time,time_offset,height,reflectivity,$ reflectp, reflectc, cbase, ctop, velocity, clutter,maxclutter,spectrum,$ lwp,vceil,numtimes,numheights,allclutter,goodclutter,temp,press,$ vap,dir,dsol,sfpres,numlayers,twsflux,zenith,solarratio,sfcalbedo,$ column_cfrac ; ; common containing the monthly averaged data ; common monthly_averaged_data_rad, base_time_rad,time_offset_rad,height_rad,$ numtimes_rad,numheights_rad,$ IWC_best_estimate,re_ice_best_estimate,ice_micro_error_estimate, $ iwc_source,ice_effective_radius_source,ice_tau_solar, $ ice_omega_solar,ice_g_solar,ice_tau_IR,ice_omega_IR,ice_g_IR, $ ice_RadiationParameterization_source_solar,ice_RadiationParameterization_source_ir, $ lwc_best_estimate,re_liquid_best_estimate,liquid_micro_error_estimate, $ lwc_source,liquid_effective_radius_source,liquid_tau_solar,liquid_omega_solar, $ liquid_g_solar,liquid_tau_IR,liquid_omega_IR,liquid_g_IR, $ liquid_RadiationParameterization_source_solar,$ liquid_RadiationParameterization_source_ir,$ ice_fraction_CCM3,solar_flux_down_clear,solar_flux_up_clear, $ IR_flux_up_clear,IR_flux_down_clear,downwelling_solar_diffuse_clear, $ downwelling_solar_direct_clear,TOA_solar_up_clear,TOA_solar_down_clear, $ TOA_IR_up_clear,solar_flux_down,solar_flux_up,IR_flux_up,IR_flux_down, $ downwelling_solar_diffuse,downwelling_solar_direct,TOA_solar_up,TOA_solar_down, $ TOA_IR_up ; ; Read in the monthly averaged data ; get_average_data,site,searchdate,avg_int get_average_data_rad,site,searchdate,avg_int ; ; Convert heights to km ; height=height/1000.0 ;********************************************************************** ; Average cloud fraction vs. height ;********************************************************************** ; ; Strings ; dataname='Average Cloud Fraction vs. Height' datatag='avg_cfrac_height' ;************************** ; Calculate cloud fraction ;************************** ; ; First if statement for twp,nsa ; if site eq 'nsa' or site eq 'twpc1' or site eq 'twpc2' then begin ; Percentage of points that are cloudy cfrac=float(reflectc)/float(reflectp)*100. ; Where possible points is 0, there is missing data. ; Where possible points is -8888, there is missing data ; Give these points the missing data value,-8888,gray result=where(reflectp le 0.0 or reflectp eq -8888,count) print,'reflectp is 0 for ',count,' points' if count ne 0 then cfrac[result]=-8888 ; ; Second if statement for sgp ; endif else if site eq 'sgp' or site eq 'crystal' then begin ; Percentage of points that are cloudy cfrac=float(goodclutter)/float(allclutter)*100. ; Where possible points is 0, there is missing data. ; Where possible points is -8888, there is missing data. ; Give these points the missing data value,-8888,gray result=where(allclutter eq 0.0 or allclutter eq -8888,count) print,'allclutter is 0 for ',count,' points' if count ne 0 then cfrac[result]=-8888 endif ;************************** ; End of cloud fraction ;************************** ; ; Calculate the average cfrac vs height profile ; avg_cfrac=make_array(numheights,/float) for i=0,numheights-1 do begin level_cfrac=cfrac[*,i] result=where(level_cfrac gt -8888,count) avg_cfrac[i]=total(level_cfrac[result])/count endfor ;****************** ; Set up the plot ;****************** window,0,xsize=400,ysize=600,/pixmap loadct,39 !p.background=!d.n_colors-1 !p.charsize=1.5 !p.multi=[1,1,1] !x.style=1 !y.style=1 !x.ticklen=-0.02 !y.ticklen=-0.02 pos_vect=[0.15,0.15,0.85,0.85] ; ; Plot the profile ; plot,avg_cfrac,height,$ color=0,xstyle=1,ystyle=1,position=pos_vect,$ xtitle='Average Cloud Fraction (%)',$ ytitle='Height (km)' ; ; Add a title ; smonth=strmid(searchdate,4,2) syear=strmid(searchdate,0,4) sday='01' if smonth eq 1 then smon='Jan' if smonth eq 2 then smon='Feb' if smonth eq 3 then smon='Mar' if smonth eq 4 then smon='Apr' if smonth eq 5 then smon='May' if smonth eq 6 then smon='Jun' if smonth eq 7 then smon='Jul' if smonth eq 8 then smon='Aug' if smonth eq 9 then smon='Sep' if smonth eq 10 then smon='Oct' if smonth eq 11 then smon='Nov' if smonth eq 12 then smon='Dec' if site eq 'sgp' then begin capsite='SGP' datastream='average.'+avg_int endif else if site eq 'nsa' then begin capsite='NSA' datastream='average.'+avg_int endif else if site eq 'twpc1' then begin capsite='TWP Manus' datastream='average.'+avg_int endif else if site eq 'twpc2' then begin capsite='TWP Nauru' datastream='average.'+avg_int endif syr=strcompress(string(syear),/remove_all) xyouts,0.5,0.95,align=0.5,charsize=1.7,/normal,color=0,$ 'Hourly Averages!C'+ $ capsite+' - '+smon+' '+syr + '!C' + dataname ; ; Create the gif file ; strmon=string(smonth) if smonth lt 10 then strmon='0'+strmon strday=string(sday) if sday lt 10 then strday='0'+strday curdate=strcompress(syr+strmon+strday,/remove_all) image_dir='/data/mace4/arm_data/temp_image/' image_name=site+'.'+datastream+'.'+curdate+'.'+ $ datatag print,image_dir+image_name write_gif,image_dir+image_name+'.gif',tvrd( ) ; ; Remove the .png file ; unix_command='rm '+image_dir+image_name+'.png' spawn,unix_command end