; ; clutter_reflect.pro create the plot of the averaged data, and the averaged ; pro clutter_reflect, curdate ; ; Get the file using the date as an input ; curdate=string(curdate) curdate=strcompress(curdate,/remove_all) ncdf_file='Output/sgp.average.5min.'+curdate+'.000000.cdf' ;ncdf_file='sgp.average.5min.'+curdate+'.000000.cdf' ; ; Open the netcdf file ; cdf_id=ncdf_open(ncdf_file) ; ; Get the dimension id's ; time_did=ncdf_dimid(cdf_id, 'time') height_did=ncdf_dimid(cdf_id, 'height') ; ; Get the dimensions ; ncdf_diminq, cdf_id, time_did, char_string, num_times ncdf_diminq, cdf_id, height_did, char_string, num_heights ; ; Get the variable id's ; baset_id=ncdf_varid(cdf_id, 'base_time') timeo_id=ncdf_varid(cdf_id, 'time_offset') height_id=ncdf_varid(cdf_id, 'height') reflect_id=ncdf_varid(cdf_id, 'ReflectivityBestEstimate') clutter_id=ncdf_varid(cdf_id, 'qc_ReflectivityClutterFlagMode') cbase_id=ncdf_varid(cdf_id, 'CloudBaseBestEstimate') ctop_id=ncdf_varid(cdf_id, 'RadarFirstTop') velocit_id=ncdf_varid(cdf_id, 'MeanDopplerVelocity') spectr_id=ncdf_varid(cdf_id, 'SpectralWidth') psp2_id=ncdf_varid(cdf_id, 'psp2') fluxcl_id=ncdf_varid(cdf_id, 'twsflux_clearskyfit') solarra_id=ncdf_varid(cdf_id, 'SolarRatio') lwp_id=ncdf_varid(cdf_id, 'liq') cloud1_id=ncdf_varid(cdf_id,'cloud1') ; ; Get the variables ; if baset_id ne -1 then ncdf_varget, cdf_id, baset_id, base_time if timeo_id ne -1 then ncdf_varget, cdf_id, timeo_id, time_offset ; ; Calculate Julian Date (jday) and Fractional Hour (hrfrac) ; ijday_ihrfrac_fm_numsec,base_time, time_offset, hrfrac, jday, yy,mm,dd,hh,mi,ss if height_id ne -1 then begin ncdf_varget, cdf_id, height_id, height height=height/1000 ;convert from meters to km endif if reflect_id ne -1 then ncdf_varget, cdf_id, reflect_id, reflectivity if cbase_id ne -1 then begin ncdf_varget, cdf_id, cbase_id, cbase result=where(cbase ne -9999, count) if count ne 0 then begin ;cbase[result]=cbase[result]-318 cbase[result]=cbase[result]/1000. ;convert from meters to km endif endif if ctop_id ne -1 then begin ncdf_varget, cdf_id, ctop_id, ctop result=where(ctop ne -9999, count) if count ne 0 then begin ;ctop[result]=ctop[result]+318 ctop[result]=ctop[result]/1000. ;convert from meters to km endif endif if velocit_id ne -1 then begin ncdf_varget, cdf_id, velocit_id, velocity result=where(velocity ne -9999,count) if count ne 0 then begin velocity[result]=velocity[result]/1000. endif endif if spectr_id ne -1 then begin ncdf_varget, cdf_id, spectr_id, spectrum result=where(spectrum ne -9999,count) if count ne 0 then begin spectrum[result]=spectrum[result]/1000. endif endif if psp2_id ne -1 then ncdf_varget, cdf_id, psp2_id, psp2 if fluxcl_id ne -1 then ncdf_varget, cdf_id, fluxcl_id, fluxclear if solarra_id ne -1 then ncdf_varget, cdf_id, solarra_id, solarratio if lwp_id ne -1 then begin ncdf_varget, cdf_id, lwp_id, lwp result=where(lwp ne -9999,count) if count ne 0 then begin lwp[result]=lwp[result]*10000 endif endif if cloud1_id ne -1 then begin ncdf_varget, cdf_id, cloud1_id, cloud1 result=where(cloud1 ne -9999, count) if count ne 0 then begin cloud1[result]=cloud1[result]/1000. ;convert from meters to km endif endif ; ; if clutter_id ne -1 then begin ncdf_varget,cdf_id,clutter_id,clutter result=where(clutter eq 0 ,count) creflect=reflectivity if count ne 0 then begin print,'************found clutter**********',count creflect[result]=-9999 endif endif ; ; Close the netcdf file ; ncdf_close,cdf_id ; ; Start the plot ; !x.margin=[10,3] !y.margin=[3,2] !p.multi=[0,1,2] ;sixplot !p.charsize=2 ;make letters bigger loadct, 5 ;colortable !p.background=!d.n_colors-1 ;change background color to white blanks=[' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '] window,0, xsize=900,ysize=700;,/pixmap stime=hrfrac[0] etime=hrfrac[num_times-1] sheight=height[0] eheight=height[num_heights-1] print,' heights',sheight,eheight print, 'times',stime,etime ; Plot 1 reflectivity=transpose(reflectivity) contour, reflectivity, hrfrac, height, /nodata, $ title='Radar Reflectivity (DbZe)',$ xstyle=1,ystyle=1,$ xmargin=[5,8],$ xrange=[stime,etime],yrange=[sheight,eheight],color=0 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_scale, 'ReflectivityBestEstimate', reflectivity, image,$ stime,etime,hrfrac,sheight,eheight,height,dmax,dmin tv,congrid(image,sx,sy),px[0],py[0] axis,stime,sheight,xaxis=0,color=0,xrange=[stime,etime],xstyle=1 axis,stime,eheight,xaxis=1,color=0,xrange=[stime,etime],xstyle=1,xtickname=blanks axis,stime,sheight,yaxis=0,color=0,yrange=[sheight,eheight],ystyle=1 axis,etime,sheight,yaxis=1,color=0,yrange=[sheight,eheight],ystyle=1,ytickname=blanks ;oplot,hrfrac,cbase,color=0,thick=2 ;oplot,hrfrac,ctop,color=0,thick=2, linestyle=2 ;plots,[(etime-stime)*0.85,(etime-stime)*0.95],[(eheight-sheight)*0.85,(eheight-sheight)*0.85],$ ; /data,linestyle=2,color=0,thick=2 ;xyouts,(etime-stime)*0.70,(eheight-sheight)*0.85,$ ; /data,'Cloud Top',color=0,charsize=1 ;plots,[(etime-stime)*0.85,(etime-stime)*0.933],[(eheight-sheight)*0.75,(eheight-sheight)*0.75],$ ; /data,linestyle=0,color=0,thick=2 ;xyouts,(etime-stime)*0.70,(eheight-sheight)*0.75,$ ; /data,'Cloud Base',color=0,charsize=1 colorbar,'ReflectivityBestEstimate',image,dmax,dmin,cb_title,px,py,sx,sy ; Plot 2 creflect=transpose(creflect) contour, creflect, hrfrac, height, /nodata, $ title='Radar Reflectivity (DbZe) filtered by Clutter Flag',$ xstyle=1,ystyle=1,$ xmargin=[5,8],$ xrange=[stime,etime],yrange=[sheight,eheight],color=0 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_scale, 'ReflectivityBestEstimate', creflect, image,$ stime,etime,hrfrac,sheight,eheight,height,dmax,dmin tv,congrid(image,sx,sy),px[0],py[0] axis,stime,sheight,xaxis=0,color=0,xrange=[stime,etime],xstyle=1 axis,stime,eheight,xaxis=1,color=0,xrange=[stime,etime],xstyle=1,xtickname=blanks axis,stime,sheight,yaxis=0,color=0,yrange=[sheight,eheight],ystyle=1 axis,etime,sheight,yaxis=1,color=0,yrange=[sheight,eheight],ystyle=1,ytickname=blanks colorbar,'ReflectivityBestEstimate',image,dmax,dmin,cb_title,px,py,sx,sy giffile=strmid(ncdf_file,0, 33) + 'clutter.gif' print, giffile write_gif, giffile, tvrd( ) ;;stop end