pro plot_clouds_generic,input_flag ; ; Common to hold data ; common clouds_data, base_time, time_offset, height,$ clutter,cbase,ctop,reflect,velocity,spectrum,$ artifact ; ; find date and site depending on input flag ; input_flag=strcompress(input_flag,/remove_all) if input_flag eq 'one' then begin site=' ' read,site,prompt='Enter ARM site (nsa,sgp,twpc1,twpc2): ' site=strcompress(site,/remove_all) curdate=' ' read,curdate,prompt='Enter date (yyyymmdd): ' curdate=strcompress(curdate,/remove_all) endif ; ; Format the date to process ; print,'date ',curdate,'site',site curdate=strcompress(string(curdate),/remove_all) date_string_fm_adtg, curdate,date_string ; ; Get the data ; get_clouds2,curdate,site,datastream,input_flag reflect=transpose(reflect) num_heights=n_elements(height) num_times=n_elements(time_offset) ;****************************************** ; Look for data gaps and fill them in ;****************************************** ; ; Make arrays to hold the new expanded data ; newreflect=make_array(86400,num_heights,/int,value=-9999) ;new reflectivity array newcbase=make_array(86400,/int,value=-9999) newctop=make_array(86400,/int,value=-9999) spacing=fltarr(num_times) ;delta t between two successive time measurements newtime=fltarr(86400) ;new time array ; ; find the missing time intervals and replace with missing data values ; j=0 ;index for new time array for i=0,num_times-2 do begin spacing[i+1]=time_offset[i+1]-time_offset[i] print,'********',time_offset[i],time_offset[i+1],spacing[i+1] if spacing[i+1] ge 75 then begin print, 'found a hole',time_offset[i],time_offset[i+1],spacing[i+1] x=fix(spacing[i+1]/36.0) if x*36.0+time_offset[i] eq time_offset[i+1] then x=x-1.0 for k=1.0,x do begin j=j+1 newtime[j]=time_offset[i]+k*36.0 newreflect[j,*]=-8888 newcbase[j]=-8888 newctop[j]=-8888 print,j,newtime[j],newreflect[j,0] endfor j=j+1 newtime[j]=time_offset[i+1] newreflect[j,*]=reflect[i+1,*] newcbase[j]=cbase[i+1] newctop[j]=ctop[i+1] print,j,newtime[j],newreflect[j,0] print, 'filled in hole' endif else begin j=j+1 newtime[j]=time_offset[i+1] newreflect[j,*]=reflect[i+1,*] newcbase[j]=cbase[i+1] newctop[j]=ctop[i+1] print,j,newtime[j],newreflect[j,0] endelse endfor ; ; cut the arrays down to their size ; newtime[0]=time_offset[0] time_offset=newtime[0:j] reflect=newreflect[0:j,*] cbase=newcbase[0:j] ctop=newctop[0:j] ; ; Calculate fractional hour and Julian day ; ijday_ihrfrac_fm_numsec,base_time,time_offset,hrfrac,jday,yy,mm,dd,hh,mi,ss ; ; Calculate IDL Julian day for plotting ; julian_day=make_array(n_elements(jday),/double,value=-9999) julian_day=julday(mm,dd,yy,hh,mi,ss) ; ; Change the format of reflectivity ; if n_elements(reflect) gt 0 then begin reflect=float(reflect) result=where(reflect gt -8888,count) if count ne 0 then reflect[result]=reflect[result]/100. endif ; ; Convert height to km ; height=height/1000. if n_elements(cbase) gt 0 then cbase=cbase/1000. if n_elements(ctop) gt 0 then ctop=ctop/1000. ; ; Determine the subsetting indicies ; ;*************************** ; Enter start time below ;*************************** stime=0 closetime=hrfrac-stime closest=min(abs(closetime),indst) stime=hrfrac[indst] ;*************************** ; Enter end time below ;************************** etime=12 closetime=hrfrac-etime closest=min(abs(closetime),indet) etime=hrfrac[indet] ;*************************** ; Enter start height below ;*************************** sheight=0 closeheight=height-sheight closest=min(abs(closeheight),indsh) sheight=height[indsh] ;*************************** ; Enter end height below ;************************** eheight=15 closeheight=height-eheight closest=min(abs(closeheight),indeh) eheight=height[indeh] reflect=reflect[indst:indet,indsh:indeh] julian_day=julian_day[indst:indet] height=height[indsh:indeh] cbase=cbase[indst:indet] ctop=ctop[indst:indet] ; ; Set up the plot ; !p.background=!d.n_colors-1 loadct,39 !p.charsize=1.3 window, 0, xsize=900, ysize=600, TITLE='clouds';/pixmap !p.multi = [0,1,1] !y.margin=[6,9] !x.margin=[8,16] ;end_day=julday(03,27,2000,16,00,00) !x.range=[julian_day[0],julian_day[n_elements(julian_day)-1]] ;!x.range=[julian_day[0],end_day] !x.style=1 !y.style=1 if input_flag eq 'eos' then $ dummy=label_date(date_format=['%N/%D/%Z!C%H:%I:%S']) $ else $ dummy=label_date(date_format=['%H:%I']) ; ; Set up the colors ; 0=black 130=green 25=purple 50=blue 250=red ; color1=0 ;black color2=250 ;red ; ; Plot 1 - Reflectivity ; ; ; Find the data max and min ; dmax=max(reflect)+100 result=where(reflect eq -9999,count) if count ne 0 then reflect[result]=1e6 dmin=min(reflect) result=where(reflect eq -8888,count) if count gt 0 then reflect[result]=-20 ; ; Set up the plot coordinates ; contour,reflect,julian_day,height,/nodata,xstyle=4,ystyle=4 px=!x.window*!d.x_vsize py=!y.window*!d.y_vsize sx=px[1]-px[0]+1 sy=py[1]-py[0]+1 ; ; Scale and create the image ; ;image=bytscl(reflect,max=dmax,min=dmin) image=bytscl(reflect,max=25.0,min=-65.0) tv,congrid(image,sx,sy),px[0],py[0] ; ; Set up the axes ; contour,reflect,julian_day,height,/noerase,/nodata,$ xtickformat='label_date',xtickunits='time',$ color=color1,xminor=6,xticklen=-0.02,$ yrange=[height[0],height[n_elements(height)-1]],$ ytitle='Height (km)' ; ; Add a color bar ; colorbar,image,25.0,-65.0,'DbZe',px,py,sx,sy ;colorbar,image,dmax,dmin,'DbZe',px,py,sx,sy ; ; Overplot the cloud base and cloud top ; if n_elements(cbase) gt 0 then oplot,julian_day,cbase,color=color1,psym=4,symsize=0.3 if n_elements(ctop) gt 0 then oplot,julian_day,ctop,color=color2,psym=4,symsize=0.3 ; ; Add a key ; xmax=julian_day[n_elements(julian_day)-1] xmin=julian_day[0] dx=(xmax-xmin)/100. ymax=height[n_elements(height)-1] ymin=height[0] dy=(ymax-ymin)/100. xyouts,xmin+26*dx,ymax+3*dy,alignment=0.0,'cloud base best estimate',$ /data,color=color1,charsize=1.4 xyouts,xmin+61*dx,ymax+3*dy,alignment=0.0,'radar first top',$ /data,color=color2,charsize=1.4 xyouts,0.5,0.04,alignment=0.5,'Time (UTC)',/normal,color=color1 ; ; Add title to plot page ; if site eq 'twpc1' then capsite='TWP C1' if site eq 'twpc2' then capsite='TWP C2' if site eq 'nsa' then capsite='NSA' if site eq 'sgp' then capsite='SGP' a_string=capsite+' Merged Moments, '+date_string xyouts, 0.5, 0.93, alignment=0.5,a_string, /normal, color=0, charsize=2.2 xyouts, 0.5, 0.88, alignment=0.5,datastream, /normal, color=0, charsize=1.9 ; ; Create the gif file ; if input_flag eq 'eos' then begin gif_file='/home/meteor/y/mace/homepages/research/eos/images/'+$ site+'/'+datastream+'.'+curdate write_gif,gif_file+'.gif',tvrd() unix_command='rm '+gif_file+'.png' spawn,unix_command openw,13,'/data/mace4/arm_data/eos/eos_image_name.dat' printf,13,datastream+'.'+curdate+'.gif' close,13 endif else $ write_gif,'/data/mace4/arm_data/temp_image/'+$ datastream+'.'+curdate+'_zoom.gif',tvrd() stop end ;**************************************************** ; colorbar.pro creates a colorbar for the DBZ images ;**************************************************** pro colorbar, image,dmax,dmin,cb_title,px,py,sx,sy min_image=0;min(image) max_image=255;max(image) cb_arr=fltarr(2,max_image-min_image+1) for j=0,max_image-min_image do $ cb_arr(*,j)=dmin+((dmax-dmin)/(max_image-min_image))*j cb_img=bindgen(2,max_image-min_image+1) for j=0,max_image-min_image do cb_img(*,j)=min_image+j tv, congrid(cb_img,(sx/35),sy),px[1]+sx/8,py[0] axis,px[1]+sx/8,py[0],yaxis=0,color=0,$ yrange=[cb_arr[0,0],cb_arr[0,max_image-min_image]],$ ystyle=1,/device,charsize=1.2,ytitle=cb_title,ticklen=-0.02 return end