; ; Plot a monthly summary ; pro plot_regrid_average_monthly ; ; common containing the monthly averaged data ; common monthly_averaged_data, base_time,time_offset,height, $ reflectivity, reflectp, reflectc, cbase, ctop, velocity, $ spectrum, lwp, cloud1, vceil, numtimes, numheights ; ; Read in the monthly averaged data ; fname='nsa.average.4hr.20000701.000000.cdf' get_regrid_average_monthly,fname ; ; Convert time_offset to be seconds since 1970 by adding base_time ; time_offset=long(time_offset)+long(base_time) ; ; Select which data to plot ; dataname=strarr(3) dataname=['Radar Reflectivity','Velocity','Spectrum Width'] datatag=strarr(3) datatag=['reflectivity','velocity','spectrum'] cb_title=strarr(3) cb_title=['DbZe','m/s','m/s'] ; ; Loop through the variables in the file ; for datanum=0,2 do begin ;loop through the different variables ;for datanum=0,0 do begin if datanum eq 0 then data=reflectivity if datanum eq 1 then data=velocity if datanum eq 2 then data=spectrum ; ; Transpose the data ; data=transpose(data) ; ; Manipulate the data if it is Reflectivity ; if datanum eq 0 then begin data=float(data) result=where(data ne -9999, count) if count ne 0 then data[result]=data[result]/100. endif ; ; Find the max and min data values ; dmax=max(data) result=where(data eq -9999, count) if count ne 0 then data[result]=1e6 dmin=min(data) if count ne 0 then data[result]=dmax ;dmin=-4 ;dmax=3 print, 'dmax',dmax,'dmin',dmin ; ; Calculate the file starting and ending date and time ; standard_date_time,time_offset(0),syear,smonth,sday,shour,smin,ssec print,'file start',syear,smonth,sday,shour,smin,ssec standard_date_time,time_offset(numtimes-1),eyear,emonth,eday,ehour,emin,esec print,'file end',eyear,emonth,eday,ehour,emin,esec ; ; Set up the plot ; loadct,5 ;load the color table !y.omargin=[2,5] ;set aside some room at the top of the page for the title !x.margin=[8,15] ;change to accomodate the colorbar !y.margin=[2,2] ;change to move the images closer together !p.multi=[0,1,5] ;put 5 plots on a page !p.charsize=2 ;increase the character size !p.background=!d.n_colors-1 ;make the background white xwin=800 ;xsize of the plot window ywin=800 ;ysize of the plot window window,0,xsize=xwin,ysize=ywin,title='ecmwf';,/pixmap ; ; Plot 1 ; plot1='yes' if plot1 eq 'yes' then begin ;week1=num_sec_ep(1999,07,1,0,0,0) week1=num_sec_ep(syear,smonth,sday,shour,smin,ssec) result=where(time_offset eq week1,count) if count eq 1 then week1=result[0] else stop ;start_date=julday(07,1,1999) start_date=julday(smonth,sday,syear) ;start_time=0 start_time=shour/24. ;end_time=(julday(07,7,1999)-start_date)+23.9/24. end_time=(julday(smonth,sday+6,syear)-start_date)+(shour+23.9/24.) ;week2=num_sec_ep(1999,07,8,0,0,0) week2=num_sec_ep(syear,smonth,sday+7,shour,smin,ssec) result=where(time_offset eq week2,count) if count eq 1 then week2=result[0] else stop result=label_date(date_format=' %D %M !C %H:%I ',offset=start_date) week=data[week1:week2-1,*] weektime=time_offset[week1:week2-1,*] contour,week,weektime,height,xstyle=1,ystyle=1,/nodata px=!x.window*!d.x_vsize py=!y.window*!d.y_vsize sx=px[1]-px[0]+1 sy=py[1]-py[0]+1 image=congrid(week,sx,sy) image=bytscl(image,max=dmax,min=dmin) tv,image,px[0],py[0] axis,time_offset[week1],height[0],xaxis=0,color=0,xstyle=1,xtickformat='label_date',xrange=[start_time,end_time] axis,time_offset[week1],height[numheights-1],xaxis=1,color=0,xstyle=1,xrange=[start_time,end_time],xtickformat='(A1)' axis,time_offset[week1],height[0],yaxis=0,color=0,ystyle=1,yrange=[height[0],height[numheights-1]],$ ytitle='Height (km)' axis,time_offset[week2-1],height[0],yaxis=1,color=0,ystyle=1,yrange=[height[0],height[numheights-1]],$ ytickformat='(A1)' colorbar,dataname[datanum],image,dmax,dmin,cb_title[datanum],px,py,sx,sy endif ; ; Plot 2 ; plot2='yes' if plot2 eq 'yes' then begin ;week1=num_sec_ep(1999,07,8,0,0,0) week1=num_sec_ep(syear,smonth,sday+7,shour,smin,ssec) result=where(time_offset eq week1,count) if count eq 1 then week1=result[0] else stop ;start_date=julday(07,8,1999) start_date=julday(smonth,sday+7,syear) ;start_time=0 start_time=shour/24. ;end_time=(julday(07,14,1999)-start_date)+23.9/24. end_time=(julday(smonth,sday+13,syear)-start_date)+(shour+23.9/24.) ;week2=num_sec_ep(1999,07,15,0,0,0) week2=num_sec_ep(syear,smonth,sday+14,shour,smin,ssec) result=where(time_offset eq week2,count) week2=result[0] result=label_date(date_format=' %D %M !C %H:%I ',offset=start_date) week=data[week1:week2-1,*] weektime=time_offset[week1:week2-1,*] contour,week,weektime,height,xstyle=1,ystyle=1,/nodata px=!x.window*!d.x_vsize py=!y.window*!d.y_vsize sx=px[1]-px[0]+1 sy=py[1]-py[0]+1 image=bytscl(week,max=dmax,min=dmin) tv,congrid(image,sx,sy),px[0],py[0] axis,time_offset[week1],height[0],xaxis=0,color=0,xstyle=1,xtickformat='label_date',xrange=[start_time,end_time] axis,time_offset[week1],height[numheights-1],xaxis=1,color=0,xstyle=1,xrange=[start_time,end_time],xtickformat='(A1)' axis,time_offset[week1],height[0],yaxis=0,color=0,ystyle=1,yrange=[height[0],height[numheights-1]],$ ytitle='Height (km)' axis,time_offset[week2-1],height[0],yaxis=1,color=0,ystyle=1,yrange=[height[0],height[numheights-1]],$ ytickformat='(A1)' colorbar,dataname[datanum],image,dmax,dmin,cb_title[datanum],px,py,sx,sy endif ; ; Plot 3 ; plot3='yes' if plot3 eq 'yes' then begin ;week1=num_sec_ep(1999,07,15,0,0,0) week1=num_sec_ep(syear,smonth,sday+14,shour,smin,ssec) result=where(time_offset eq week1,count) if count eq 1 then week1=result[0] else stop ;start_date=julday(07,15,1999) start_date=julday(smonth,sday+14,syear) ;start_time=0 start_time=shour/24. ;end_time=(julday(07,21,1999)-start_date)+23.9/24. end_time=(julday(smonth,sday+20,syear)-start_date)+23.9/24. ;week2=num_sec_ep(1999,07,22,0,0,0) week2=num_sec_ep(syear,smonth,sday+21,shour,smin,ssec) result=where(time_offset eq week2,count) if count eq 1 then week2=result[0] else stop result=label_date(date_format=' %D %M !C %H:%I ',offset=start_date) week=data[week1:week2-1,*] weektime=time_offset[week1:week2-1,*] contour,week,weektime,height,xstyle=1,ystyle=1,/nodata px=!x.window*!d.x_vsize py=!y.window*!d.y_vsize sx=px[1]-px[0]+1 sy=py[1]-py[0]+1 image=bytscl(week,max=dmax,min=dmin) tv,congrid(image,sx,sy),px[0],py[0] axis,time_offset[week1],height[0],xaxis=0,color=0,xstyle=1,xtickformat='label_date',xrange=[start_time,end_time] axis,time_offset[week1],height[numheights-1],xaxis=1,color=0,xstyle=1,xrange=[start_time,end_time],xtickformat='(A1)' axis,time_offset[week1],height[0],yaxis=0,color=0,ystyle=1,yrange=[height[0],height[numheights-1]],$ ytitle='Height (km)' axis,time_offset[week2-1],height[0],yaxis=1,color=0,ystyle=1,yrange=[height[0],height[numheights-1]],$ ytickformat='(A1)' colorbar,dataname[datanum],image,dmax,dmin,cb_title[datanum],px,py,sx,sy endif ; ; Plot 4 ; plot4='yes' if plot4 eq 'yes' then begin ;week1=num_sec_ep(1999,07,22,0,0,0) week1=num_sec_ep(syear,smonth,sday+21,shour,smin,ssec) result=where(time_offset eq week1,count) if count eq 1 then week1=result[0] else stop ;start_date=julday(07,22,1999) start_date=julday(smonth,sday+21,syear) ;start_time=0 start_time=shour/24. ;end_time=(julday(07,28,1999)-start_date)+23.9/24. end_time=(julday(smonth,sday+27,syear)-start_date)+23.9/24. ;week2=num_sec_ep(1999,07,29,0,0,0) week2=num_sec_ep(syear,smonth,sday+28,shour,smin,ssec) result=where(time_offset eq week2,count) if count eq 1 then begin week2=result[0] endif else begin week2=numtimes-1 ;for February endelse result=label_date(date_format=' %D %M !C %H:%I ',offset=start_date) week=data[week1:week2-1,*] weektime=time_offset[week1:week2-1,*] contour,week,weektime,height,xstyle=1,ystyle=1,/nodata px=!x.window*!d.x_vsize py=!y.window*!d.y_vsize sx=px[1]-px[0]+1 sy=py[1]-py[0]+1 image=congrid(week,sx,sy) image=bytscl(image,max=dmax,min=dmin) tv,image,px[0],py[0] axis,time_offset[week1],height[0],xaxis=0,color=0,xstyle=1,xtickformat='label_date',xrange=[start_time,end_time] axis,time_offset[week1],height[numheights-1],xaxis=1,color=0,xstyle=1,xrange=[start_time,end_time],xtickformat='(A1)' axis,time_offset[week1],height[0],yaxis=0,color=0,ystyle=1,yrange=[height[0],height[numheights-1]],$ ytitle='Height (km)' axis,time_offset[week2-1],height[0],yaxis=1,color=0,ystyle=1,yrange=[height[0],height[numheights-1]],$ ytickformat='(A1)' colorbar,dataname[datanum],image,dmax,dmin,cb_title[datanum],px,py,sx,sy endif ; ; Plot 5 ; plot5='yes' if plot5 eq 'yes' and smonth ne 2 then begin ;don't plot this last bit for February ;week1=num_sec_ep(1999,07,29,0,0,0) week1=num_sec_ep(syear,smonth,sday+28,shour,smin,ssec) result=where(time_offset eq week1,count) if count eq 1 then week1=result[0] else stop ;start_date=julday(07,29,1999) start_date=julday(smonth,sday+28,syear) ;start_time=0 start_time=shour/24. ;end_time=(julday(07,31,1999)-start_date)+23.99/24. end_time=(julday(smonth,eday,syear)-start_date)+23.99/24. ;week2=num_sec_ep(1999,07,31,23,0,0) week2=num_sec_ep(syear,smonth,eday,ehour,emin,esec) result=where(time_offset eq week2,count) if count eq 1 then week2=result[0] else stop result=label_date(date_format=' %D %M !C %H:%I ',offset=start_date) week=data[week1:week2-1,*] weektime=time_offset[week1:week2-1,*] contour,week,weektime,height,xstyle=1,ystyle=1,/nodata px=!x.window*!d.x_vsize py=!y.window*!d.y_vsize sx=px[1]-px[0]+1 sy=py[1]-py[0]+1 if (eday-sday-28) eq 2 then begin ;determine if 30 or 31 days adjust=3./7. ;31 days numticks=3 endif else begin adjust=2./7. ;30 days numticks=2 endelse image=congrid(bytscl(week,max=dmax,min=dmin),sx*adjust,sy) tv,image,px[0],py[0] sz=size(image) contour,week,weektime,height,xstyle=1,ystyle=1,/nodata,/noerase,$ position=[px[0],py[0],px[0]+sz[1]-1,py[0]+sz[2]-1],/device tv,image,px[0],py[0] axis,time_offset[week1],height[0],xaxis=0,color=0,xstyle=1,xtickformat='label_date',xrange=[start_time,end_time],$ xticks=numticks,xminor=10 axis,time_offset[week1],height[numheights-1],xaxis=1,color=0,xstyle=1,xrange=[start_time,end_time],$ xtickformat='(A1)',xticks=numticks axis,time_offset[week1],height[0],yaxis=0,color=0,ystyle=1,yrange=[height[0],height[numheights-1]],$ ytitle='Height (km)' axis,time_offset[week2-1],height[0],yaxis=1,color=0,ystyle=1,yrange=[height[0],height[numheights-1]],$ ytickformat='(A1)' colorbar,dataname[datanum],image,dmax,dmin,cb_title[datanum],px,py,sx,sy endif ; ; 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' syr=strcompress(string(syear),/remove_all) xyouts,0.5,0.95,align=0.5,charsize=2.0,/normal,color=0,$ 'Monthly Summary for '+dataname[datanum]+'!CNSA - '+smon+' '+syr ; ; Create 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) ;giffile='twpecmwfnauvarX1.c1.'+curdate+'.'+datatag[datanum]+'.gif' giffile=strmid(fname,0,32)+datatag[datanum]+'.gif' write_gif,giffile,tvrd( ) endfor ;end loop through variables end