; ; sixplot.pro create the plot of the averaged data ; pro sixplot_all, thissite, curdate site=thissite ; ; Read in the name of the netcdf file to process ; ;ncdf_file=' ' ;openr, 10, 'avg_netcdf_file.dat' ;readf, 10, ncdf_file ;close, 10 ;print, 'plotting ',ncdf_file ;ncdf_file='Output/'+ncdf_file ; ; Get the file using the date as an input ; curdate=string(curdate) curdate=strcompress(curdate,/remove_all) ncdf_file=strcompress('Output/'+site+'.average.5min.'+curdate+'.000000.cdf',/remove_all) ;ncdf_file=site+'.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') reflectp_id=ncdf_varid(cdf_id, 'ReflectivityPossiblePoints') reflectc_id=ncdf_varid(cdf_id, 'ReflectivityUseablePoints') 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') down_short_id=ncdf_varid(cdf_id,'down_short_hemisp') down_long_id=ncdf_varid(cdf_id,'down_long_hemisp') up_short_id=ncdf_varid(cdf_id,'up_short_hemisp') up_long_id=ncdf_varid(cdf_id,'up_long_hemisp') down_psp_id=ncdf_varid(cdf_id,'down_psp1_mean') down_pir_id=ncdf_varid(cdf_id,'down_pir1_mean') up_psp_id=ncdf_varid(cdf_id,'up_psp1_mean') up_pir_id=ncdf_varid(cdf_id,'up_pir1_mean') fluxcl_id=ncdf_varid(cdf_id, 'twsflux_clearskyfit') solarra_id=ncdf_varid(cdf_id, 'SolarRatio') lwp_id=ncdf_varid(cdf_id, 'liq') if lwp_id eq -1 then lwp_id=ncdf_varid(cdf_id, 'liq2') cloud1_id=ncdf_varid(cdf_id,'cloud1') vceil_id=ncdf_varid(cdf_id,'first_cbh') ; ; 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 reflectp_id ne -1 then ncdf_varget, cdf_id, reflectp_id, reflectp if reflectc_id ne -1 then ncdf_varget, cdf_id, reflectc_id, reflectc 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]/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]/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 down_long_id ne -1 then ncdf_varget, cdf_id, down_long_id,down_long if down_short_id ne -1 then ncdf_varget, cdf_id, down_short_id,down_short if up_long_id ne -1 then ncdf_varget, cdf_id, up_long_id, up_long if up_short_id ne -1 then ncdf_varget, cdf_id, up_short_id, up_short if down_psp_id ne -1 then ncdf_varget, cdf_id, down_psp_id,down_psp if down_pir_id ne -1 then ncdf_varget, cdf_id, down_pir_id,down_pir if up_psp_id ne -1 then ncdf_varget, cdf_id, up_psp_id,up_psp if up_pir_id ne -1 then ncdf_varget, cdf_id, up_pir_id,up_pir 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 vceil_id ne -1 then begin ncdf_varget, cdf_id, vceil_id, vceil result=where(vceil ne -9999, count) if count ne 0 then begin vceil[result]=vceil[result]/1000. ;convert from meters to km endif endif ; ; ;if clutter_id ne -1 then ncdf_varget,cdf_id,clutter_id,clutter ;result=where(clutter eq 3 or clutter eq -9999,count) ;creflect=reflectivity ;if count ne 0 then begin ; print, count ;creflect[result]=-9999 ;endif ;stop ; ; Close the netcdf file ; ncdf_close,cdf_id ; ; Start the plot ; !x.margin=[10,3] !y.margin=[3,2] !y.omargin=[0,3] !p.multi=[0,2,3] ;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 ; ; Set up place holder plot ; holdx=[0,1] holdy=[0,1] ; Plot 1 if reflect_id ne -1 then begin 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 if cbase_id ge 0 then begin oplot,hrfrac,cbase,color=0,thick=2 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 endif if ctop_id ge 0 then begin 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 endif colorbar,'ReflectivityBestEstimate',image,dmax,dmin,cb_title,px,py,sx,sy endif ; Plot 2 if site eq 'sgp' then begin doesexist=n_elements(down_short) if doesexist eq 0 then solar_down=make_array(num_times,value=-9999) else $ solar_down=down_short endif ;if site eq 'sgp' then solar_down=psp2 if site eq 'nsa' and down_psp_id ne -1 then solar_down=down_psp if site eq 'twpc2' and down_psp_id ne -1 then solar_down=down_psp if fluxcl_id ne -1 then begin ; find the max and min value for solar down pmax=max(solar_down) result=where(solar_down eq -9999,count) if count ne 0 then solar_down[result]=1e6 pmin=min(solar_down) ; find the max and min value for fluxclear fmax=max(fluxclear) result=where(fluxclear eq -9999,count) if count ne 0 then fluxclear[result]=1e6 fmin=min(fluxclear) ; find the max and min of both maxes and mins dmax=pmax if fmax gt dmax then dmax=fmax dmin=pmin if fmin lt dmin then dmin=fmin plot, hrfrac, solar_down,$ yrange=[dmin,dmax],xrange=[stime,etime],$ xstyle=1,ystyle=1,$ psym=1,$ ytitle='w/m!E2',$ title='Flux',color=0 oplot, hrfrac, fluxclear,psym=6,color=60 ypt=(dmax-dmin)/100. xpt=(hrfrac[n_elements(hrfrac)-1]-hrfrac[0])/20. plots,[xpt*9,xpt*9],[72*ypt,72*ypt],/data,psym=1,color=0 xyouts,xpt*10,ypt*70,/data,'Solar Down',color=0,charsize=1 plots,[xpt*9,xpt*9],[62*ypt,62*ypt],/data,psym=6,color=60 xyouts,xpt*10,ypt*60,/data,'Flux Clear - Long',color=60,charsize=1 endif else if psp2_id ne -1 or down_psp_id ne -1 or down_short_id ne -1 then begin plot, hrfrac, solar_down,$ ;yrange=[dmin,dmax],$ xrange=[stime,etime],$ xstyle=1,ystyle=1,$ psym=1,$ ytitle='w/m!E2',$ title='Flux',color=0 endif else begin plot,holdx,holdy,/nodata xyouts,0.5,0.5,'No Skyrad or Sirs',/data,color=0,alignment=0.5 endelse ; Plot 3 if velocit_id ne -1 then begin velocity=transpose(velocity) contour, velocity, hrfrac, height, /nodata,$ title='Velocity (m/s)',$ 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, 'MeanDopplerVelocity', velocity, 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 if cloud1_id ge 0 then begin oplot,hrfrac,cloud1,color=40,thick=3,linestyle=0 plots,[(etime-stime)*0.85,(etime-stime)*0.95],[(eheight-sheight)*0.85,(eheight-sheight)*0.85],$ /data,linestyle=0,color=40,thick=2 xyouts,(etime-stime)*0.63,(eheight-sheight)*0.85,$ /data,'Laser Ceilometer',color=40,charsize=1 endif if vceil_id ge 0 then begin oplot,hrfrac,vceil,color=40,thick=3,linestyle=0 plots,[(etime-stime)*0.85,(etime-stime)*0.95],[(eheight-sheight)*0.85,(eheight-sheight)*0.85],$ /data,linestyle=0,color=40,thick=2 xyouts,(etime-stime)*0.63,(eheight-sheight)*0.85,$ /data,'Laser Ceilometer',color=40,charsize=1 endif colorbar,'MeanDopplerVelocity',image,dmax,dmin,cb_title,px,py,sx,sy endif ; Plot 4 if solarra_id ne -1 then begin plot, hrfrac, solarratio, yrange=[0,1],xrange=[stime,etime],psym=6,$ title='Solar Transmisivity Ratio = Solar Down/Long',$ xstyle=1,ystyle=1,color=0 endif else begin plot,holdx,holdy,/nodata xyouts,0.5,0.5,'No Skyrad or Sirs',/data,color=0,alignment=0.5 endelse ; Plot 5 if spectr_id ne -1 then begin spectrum=transpose(spectrum) contour, spectrum, hrfrac, height, /nodata,$ title='Spectrum Width (m/s)',$ xtitle='Time (UTC)',$ 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, 'SpectralWidth', spectrum, 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,'SpectralWidth',image,dmax,dmin,cb_title,px,py,sx,sy endif ; Plot 6 if lwp_id ne -1 then begin dmax=max(lwp) result=where(lwp eq -9999,count) if count ne 0 then lwp[result]=1e6 dmin=min(lwp) print, dmin,dmax,'lwp' plot, hrfrac, lwp,title='LWP - Microwave Radiometer',ytitle='g/m!E2', xtitle='Time (UTC)',$ xstyle=1,ystyle=1,psym=4,$ yrange=[dmin,dmax],xrange=[stime,etime],color=0 endif ; ; Add title to page ; if site eq 'nsa' then sitetitle='NSA '+curdate if site eq 'sgp' then sitetitle='SGP '+curdate if site eq 'twpc2' then sitetitle='TWP C2 '+curdate xyouts,0.5,0.95,sitetitle,/normal,color=0,charthick=2,charsize=3,alignment=0.5 ; ; Create gif file ; dep=strpos(ncdf_file,'cdf') print, dep giffile=strmid(ncdf_file,0, dep) + 'gif' print, giffile write_gif, giffile, tvrd( ) ;;stop end