; ; This program plots a daily summary of the 1d arm variables ; pro plot_average_daily_1d_arm,site,date,avg_int,ret_type ;************************************* ;************************************* ; INPUTS ;************************************* ;************************************* ; Site is the following 'sgp','nsa','twpc1','twpc2','twpc3' site='iphex' ; Date in the form yyyymmdd ;date='20010511' ;sgp date='20140518' ;iphex ; Averaging interval avg_int='5min';'5min';'1hr' ; Retrieval version ;ret_type='ciret4' ;ciret4,mine ret_type='mine' ;************************************** ; Commons ;************************************** ; Color common common colors,r_orig,g_orig,b_orig,r_curr,g_curr,b_curr ;***************************************** ; Constants ;***************************************** ; Indicate which files you want to use, the monthly or daily files. m_or_d='day' ;day,month ; Missing data value missing=-8888 ; Seconds in a day sec_per_day=double(24L*60L*60L) ; Get IDL julian day of day 1 day1=julday(1,1,1970,0,0,0) ; Arm data directory arm_dir='/uufs/chpc.utah.edu/common/home/mace_grp/data/arm/'+site+'/' ;***************************************** ; Read in the monthly averaged data ;***************************************** ; Make sure date is a string date=strcompress(date,/remove_all) ; Set the fill flag - 1d data doesn't need to be filled fill_flag='no' ; List of variables to read in varname=['base_time','time_offset','precip_rate','sfc_temp',$ 'sfc_pressure','liq','vap','CloudBaseBestEstimate',$ 'RadarFirstTop','first_cbh','skin_temp',$ 'gswfluxdn_clearskyfit','solar_cos_z','number_of_layers',$ 'up_short','down_short','up_long','precip_flag'] if site eq 'iphex' then varname=[varname,['avg_sfc_temp','avg_sfc_pressure',$ 'base_height_layer_1','top_height_layer_1']] ; Get the variables in the list from the file if site eq 'iphex' then begin get_average_data_list_iphex,varname,data,$ site,date,avg_int,ret_type,m_or_d,fill_flag endif else begin get_average_data_list,varname,data,$ site,date,avg_int,ret_type,m_or_d,fill_flag endelse ; Pull out the individual data arrays for v=0,n_elements(varname)-1 do begin xstr=varname[v]+'=data.'+varname[v] result=execute(xstr) endfor if site eq 'iphex' then begin sfc_temp=avg_sfc_temp sfc_pressure=avg_sfc_pressure cloudbasebestestimate=base_height_layer_1 radarfirsttop=top_height_layer_1 endif ; Get the size of the arrays numtimes=n_elements(time_offset) ;******************************************* ; Convert time to julian day for plotting ;******************************************* ; Calculate julian_day julian_day=double(day1+((base_time+time_offset)/sec_per_day)) ; Calculate the standard date arrays caldat,julian_day,mm,dd,yy,hh,mi,ss ; File start and end time syear=yy[0] smonth=mm[0] sday=dd[0] shour=hh[0] smin=mi[0] ssec=ss[0] ;print,'file start',syear,smonth,sday,shour,smin,ssec eyear=yy[numtimes-1] emonth=mm[numtimes-1] eday=dd[numtimes-1] ehour=hh[numtimes-1] emin=mi[numtimes-1] esec=ss[numtimes-1] ;print,'file end',eyear,emonth,eday,ehour,emin,esec ;******************************** ; Set up the plot device ;******************************** ; Set up the device set_plot,'z' ; xsize of the plot window xwin=800 ; ysize of the plot window ywin=800 ; Size the window device,set_resolution=[xwin,ywin] ;******************************** ; Set up the colors ; 0-253 rainbow ; 254 gray ; 255 white ;******************************** ; Load the color table loadct,39 ; Make the background white !p.background=!d.n_colors-1 ; Make gray for missing data in color 253 r_curr[254]=200 g_curr[254]=200 b_curr[254]=200 ;******************************** ; Set up the plot ;******************************** ; Date label format dummy=label_date(date_format=['%H:%I']) ; Xticks point out from plot !x.ticklen=-0.02 !x.style=1 !y.style=1 ;******************************** ; Position plots ;******************************** ; Position the plot windows xl=0.05 & xr=0.99 yb=0.05 & yt=0.97 sx=0.05 sy=0.03 ;0.05 numplots_x=2 numplots_y=6 position_plots,xl,xr,yb,yt,sx,sy,numplots_x,numplots_y,pos ; String positioning dr=0.09 ;string offset from the right xcoor dl=0.025 ;string offset from the left xcoor dt=0.025 ;string offset from the top ycoor ;********************************************* ; Plot 0 - precip_rate ;********************************************* ; Plot location pnum=0 do_plot0='yes' if do_plot0 eq 'yes' then begin alldata=[precip_rate] result=where(alldata gt missing and alldata lt 1e36,count) if count gt 0 then begin dmin=min(alldata[where(alldata gt missing and alldata lt 1e36)]) dmax=1.20*max(alldata[where(alldata gt missing and alldata lt 1e36)]) plot,julian_day,precip_rate,color=0,$ yrange=[dmin,dmax],position=pos[pnum,*],$ xtickunits='time',xtickformat='label_date',psym=10 endif xyouts,pos[pnum,0],pos[pnum,3]+0.01,'precip_rate',$ color=0,/normal,charsize=1.2 endif ;end of do_plot0 ;********************************************* ; Plot 1 - sfc_temp ;********************************************* ; Plot location pnum=1 do_plot1='yes' if do_plot1 eq 'yes' then begin alldata=[sfc_temp,skin_temp] result=where(alldata gt missing and alldata lt 1e36,count) if count gt 0 then begin dmin=min(alldata[where(alldata gt missing and alldata lt 1e36)]) dmax=max(alldata[where(alldata gt missing and alldata lt 1e36)]) plot,julian_day,sfc_temp,color=0,/noerase,$ yrange=[dmin,dmax],position=pos[pnum,*],$ xtickunits='time',xtickformat='label_date' oplot,julian_day,skin_temp,color=250 endif xyouts,pos[pnum,0],pos[pnum,3]+0.01,'sfc_temp',$ color=0,/normal,charsize=1.2 xyouts,pos[pnum,0]+0.1,pos[pnum,3]+0.01,'skin_temp',$ color=250,/normal,charsize=1.2 endif ;end of do_plot1 ;********************************** ; Plot 2 - sfpres ;********************************** ; Plot location pnum=2 do_plot2='yes' if do_plot2 eq 'yes' then begin result=where(sfc_pressure gt missing,count) if count gt 0 then sfc_pressure[result]=sfc_pressure[result]/100.0 alldata=[sfc_pressure] result=where(alldata gt missing and alldata lt 1e36,count) if count gt 0 then begin dmin=min(alldata[where(alldata gt missing and alldata lt 1e36)]) dmax=max(alldata[where(alldata gt missing and alldata lt 1e36)]) plot,julian_day,sfc_pressure,color=0,/noerase,$ yrange=[dmin,dmax],position=pos[pnum,*],$ xtickunits='time',xtickformat='(A1)' endif xyouts,pos[pnum,0],pos[pnum,3]+0.01,'sfc_press',$ color=0,/normal,charsize=1.2 endif ;end of do_plot2 ;********************************** ; Plot 3 - lwp ;********************************** ; Plot location pnum=3 do_plot3='yes' if do_plot3 eq 'yes' then begin alldata=[liq] result=where(alldata gt missing and alldata lt 1e36,count) if count gt 0 then begin dmin=min(alldata[where(alldata gt missing and alldata lt 1e36)]) dmax=max(alldata[where(alldata gt missing and alldata lt 1e36)]) plot,julian_day,liq,color=0,/noerase,$ yrange=[dmin,dmax],position=pos[pnum,*],$ xtickunits='time',xtickformat='(A1)' xyouts,pos[pnum,0],pos[pnum,3]+0.01,'lwp',$ color=0,/normal,charsize=1.2 endif endif ;end of do_plot3 ;********************************************** ; Plot 4 - vap ;********************************************** ; Plot location pnum=4 do_plot4='yes' if do_plot4 eq 'yes' then begin alldata=[vap] result=where(alldata gt missing and alldata lt 1e36,count) if count gt 0 then begin dmin=min(alldata[where(alldata gt missing and alldata lt 1e36)]) dmax=max(alldata[where(alldata gt missing and alldata lt 1e36)]) plot,julian_day,vap,color=0,/noerase,$ yrange=[dmin,dmax],position=pos[pnum,*],$ xtickunits='time',xtickformat='(A1)' endif xyouts,pos[pnum,0],pos[pnum,3]+0.01,'vap',$ color=0,/normal,charsize=1.2 endif ;end of do_plot4 ;********************************************* ; Plot 5 - CloudBaseBestEstimate,RadarFirstTop ;********************************************* ; Plot location pnum=5 do_plot5='yes' if do_plot5 eq 'yes' then begin ;stop ;first_cbh=first_cbh/1000.0 alldata=[CloudBaseBestEstimate,RadarFirstTop] result=where(alldata gt missing and alldata lt 1e36,count) if count gt 0 then begin dmin=min(alldata[where(alldata gt missing and alldata lt 1e36)]) dmax=max(alldata[where(alldata gt missing and alldata lt 1e36)]) plot,julian_day,CloudBaseBestEstimate,color=0,/noerase,$ yrange=[dmin,dmax],position=pos[pnum,*],$ xtickunits='time',xtickformat='(A1)',psym=4,symsize=0.8 oplot,julian_day,RadarFirstTop,color=250,psym=4,symsize=0.7 oplot,julian_day,first_cbh,color=150,psym=4,symsize=0.4 endif xyouts,pos[pnum,0],pos[pnum,3]+0.01,'cbase',$ color=0,/normal,charsize=1.2 xyouts,pos[pnum,0]+0.1,pos[pnum,3]+0.01,$ 'ctop',color=250,/normal,charsize=1.2 xyouts,pos[pnum,0]+0.2,pos[pnum,3]+0.01,$ 'vceil',color=150,/normal,charsize=1.2 endif ;end of do_plot5 ;********************************************* ; Plot 6 ;********************************************* ; Plot location pnum=6 do_plot6='yes' if do_plot6 eq 'yes' then begin alldata=[gswfluxdn_clearskyfit,down_short] result=where(alldata gt missing and alldata lt 1e36,count) if count gt 0 then begin dmin=min(alldata[where(alldata gt missing and alldata lt 1e36)]) dmax=max(alldata[where(alldata gt missing and alldata lt 1e36)]) plot,julian_day,gswfluxdn_clearskyfit,color=0,/noerase,$ yrange=[dmin,dmax],position=pos[pnum,*],$ xtickunits='time',xtickformat='(A1)' oplot,julian_day,down_short,color=250 endif xyouts,pos[pnum,0],pos[pnum,3]+0.01,'gswfluxdn_clearskyfit',$ color=0,/normal,charsize=1.2 xyouts,pos[pnum,0]+(pos[pnum,2]-pos[pnum,0])/2.0,pos[pnum,3]+0.01,$ 'down_short_sirs',color=250,/normal,charsize=1.2 endif ;end of do_plot6 ;********************************************* ; Plot 7 ;********************************************* ; Plot location pnum=7 do_plot7='yes' if do_plot7 eq 'yes' then begin alldata=[solar_cos_z] result=where(alldata gt missing and alldata lt 1e36,count) if count gt 0 then begin dmin=min(alldata[result]) dmax=max(alldata[result]) plot,julian_day,solar_cos_z,color=0,/noerase,$ yrange=[dmin,dmax],position=pos[pnum,*],$ xtickunits='time',xtickformat='(A1)' endif xyouts,pos[pnum,0],pos[pnum,3]+0.01,'solar zenith angle',$ color=0,/normal,charsize=1.2 endif ;end of do_plot7 ;********************************************* ; Plot 8 ;********************************************* ; Plot location pnum=8 do_plot8='yes' if do_plot8 eq 'yes' then begin alldata=[precip_flag] result=where(alldata gt missing and alldata lt 1e36,count) if count gt 0 then begin dmin=min(alldata[result]) dmax=max(alldata[result]) plot,julian_day,precip_flag,color=0,/noerase,$ yrange=[-0.05,1.05],position=pos[pnum,*],$ xtickunits='time',xtickformat='(A1)' endif xyouts,pos[pnum,0],pos[pnum,3]+0.01,'precip_flag',$ color=0,/normal,charsize=1.2 endif ;end of do_plot7 ;********************************************* ; Plot 9 ;********************************************* ; Plot location pnum=9 do_plot9='yes' if do_plot9 eq 'yes' then begin alldata=[number_of_layers] result=where(alldata gt missing and alldata lt 1e36,count) if count gt 0 then begin dmin=min(alldata[result]) dmax=max(alldata[result]) plot,julian_day,number_of_layers,color=0,/noerase,$ yrange=[-0.1,dmax+1],position=pos[pnum,*],$ xtickunits='time',xtickformat='(A1)' endif xyouts,pos[pnum,0],pos[pnum,3]+0.01,'number_of_layers',$ color=0,/normal,charsize=1.2 endif ;end of do_plot9 ;************************************ ; Plot title ;************************************ ; Add a title 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' endif else if site eq 'nsa' then begin capsite='NSA' endif else if site eq 'twpc1' then begin capsite='TWPC1' endif else if site eq 'twpc2' then begin capsite='TWPC2' endif else if site eq 'twpc3' then begin capsite='TWPC3' endif else if site eq 'iphex' then begin capsite='IPHEX' endif str_year=string(syear,format='(I4)') str_month=string(smonth,format='(I02)') str_day=string(sday,format='(I02)') title_str=capsite+' '+avg_int+' '+ret_type+$ '!C'+str_day+' '+smon+' '+str_year xyouts,0.90,0.97,align=0.5,charsize=1.7,/normal,color=0,$ title_str ;********************************** ; Create gif file ;********************************** if site eq 'iphex' then begin imagedir='' endif else if avg_int eq '1hr' or avg_int eq '6hr' then begin imagedir=arm_dir+site+'.average.'+avg_int+'.'+ret_type+'/images_daily/'+str_year+'/' endif else if avg_int eq '5min' and ret_type eq 'mine' then begin imagedir=arm_dir+site+'.average.5min/images_daily/'+str_year+'/' endif else if avg_int eq '5min' and ret_type ne 'mine' then begin imagedir=arm_dir+site+'.average.5min.'+ret_type+'/images_daily/'+str_year+'/' endif else begin imagedir='' endelse if ret_type eq 'mine' then begin imagename=site+'.average.'+avg_int+'.'+date+'.1d_arm' endif else begin imagename=site+'.average.'+avg_int+'.'+ret_type+'.'+date+'.1d_arm' endelse print,imagedir+imagename write_gif,imagedir+imagename+'.gif',tvrd( ) end