pro plotvariables_lc, yyddd, day_u, day_v, day_wr, day_t, $ day_c, day_q, day_tl, day_pl ;****************************************************** ; AUGUST 17, 1999 KSchaaf and BBerger * ; Code is used with DAYFLUX.PRO when the user * ; selects 'y' for the plot_daily option. * ;****************************************************** ;Modified by BWBerger 3/2/00 to make code consitently use yyddd format. ; Also, filepath was changed to make daily plots go to its own directory ; given by !plots_daily. ; ; Modified by w wang Sep 20, 2000, for Lost Creek ;*************************** ; VARIABLE DICTIONARY * ;*************************** ; each of these variables should be of length 10800 ; u,v,wr,t are sonic readings ; u,v,wr - velocity in m/s in the x,y,z directions, respectively ; wr = rotated w (u,v, not rotated). ; t - virtual temperature in deg Celsius ; c,q,tl,pl are licor readings ; c - CO2 concentration in ppm ; q - H2O vapor mixing ratio in g/kg ; tl - licor temperature in K ; pl - licor pressure in hPa = mb ; wspd - windspeed in m/s ; wdir - wind direction in degrees true ;****************************************************** arrsize = len(day_u) ;size of each array (u,v,w,t, ...) ;****************************************************** ; INITIALIZE VARIABLES THAT WILL BE CALCULATED LATER * ;****************************************************** wspd = fltarr(1,arrsize)-999. wd = fltarr(1,arrsize)-999. phi = fltarr(1,arrsize)-999. dailyu = day_u[0,*] dailyv = day_v[0,*] dailyw = day_wr[0,*] dailyt = day_t[0,*] dailytl = day_tl[0,*] dailypl = day_pl[0,*] dailyc = day_c[0,*] dailyq = day_q[0,*] ;***CALCULATE WIND DIRECTIONS*** ;***CALCULATE WINDSPEEDS *** r = where((dailyu ne -999) and (dailyv ne -999), c) if (c ne 0) then begin phi(r) = ATAN(dailyv(r),dailyu(r))*180./!PI wd(r) = 242 - phi(r) wdtemp=wd(r) for i = 0,len(wdtemp)-1 do begin if wdtemp(i) > 360. then wdtemp(i)=wdtemp(i)-360. if wdtemp(i) < 0. then wdtemp(i)=wdtemp(i)+360. endfor wd(r)=wdtemp wspd(r) = sqrt(dailyu(r)^2 + dailyv(r)^2) endif badwd = arrsize - c ;count the # of badvals ;*** Create a time variable for plotting ;*** this will plot every 40 points tm = findgen(arrsize)/450. ;***************************************************** ; DEFINE SUBTITLES * ;***************************************************** subtitle = ' NO GOOD DATA FOR GIVEN VARIABLE' ;***************************************************** ;* CALCULATE max and min values for each variable. * ;* Need these to set the yrange values for the plots.* ;***************************************************** ;***find min where variable value ne -999 (missing). minu = minbadval(day_u) minv = minbadval(day_v) minw = minbadval(day_wr) mint = minbadval(day_t) minc = minbadval(day_c) minq = minbadval(day_q) mintl = minbadval(day_tl) minpl = minbadval(day_pl) minwspd = 0 ;***END FINDING MIN VALUES *** ;***BEGIN FINDING MAX VALUES *** maxu = max(day_u) maxv = max(day_v) maxw = max(day_wr) maxt = max(day_t) maxc = max(day_c) maxq = max(day_q) maxtl = max(day_tl) maxpl = max(day_pl) maxwspd = max(wspd) minvel = [minu, minv, minw] minvel = min(minvel) maxvel = [maxu, maxv, maxw] maxvel = max(maxvel) ;***************************** ;* BEGIN PLOTS * ;***************************** ;**********PLOT U************ set_plot, 'ps' fname = !plots_daily+yyddd+'_lc_u_v_w.ps' device, filename=fname,/landscape mplot,1,3 print, 'Plotting U' printf,8, 'Plotting U' goodindex,dailyu,gi_u,gflagu if (gflagu eq 1) then begin plot,tm(gi_u),dailyu(gi_u),title='LCREEK: U, '+yyddd, xticks=12, $ yrange = [minvel,maxvel], $ ytitle = 'u (m/s)', charsize=1.5 endif else begin plot,tm(gi_u),dailyu(gi_u),title='LCREEK: U, '+yyddd+subtitle, xticks=12, $ yrange = [minvel,maxvel], $ ytitle = 'u (m/s)', charsize=1.5 endelse ; print the badvals in the upper right corner of the plot xyouts,.8,.99,'% Bad = '+strtrim(string(100.*float(nbad(dailyu(*)))/len(dailyu)),2),$ /normal, charsize=1.0 ;**********PLOT V************ print, 'Plotting V' printf,8, 'Plotting V' goodindex,dailyv,gi_v,gflagv if (gflagv eq 1) then begin plot, tm(gi_v), dailyv(gi_v), title='LCREEK: V, '+yyddd, $ xticks=12, yrange = [minvel,maxvel], $ ytitle = 'v (m/s)', charsize=1.5 endif else begin plot, tm(gi_v), dailyv(gi_v), title='LCREEK: V, '+yyddd+subtitle, $ xticks=12, yrange = [minvel,maxvel], $ ytitle = 'v (m/s)', charsize=1.5 endelse ; print the %badvals in the upper right corner of the plot xyouts,.8,.66,'% Bad = '+strtrim(string(100.*float(nbad(dailyv(*)))/len(dailyv)),2),$ /normal, charsize=1.0 ;**********PLOT W************ print, 'Plotting W' printf,8, 'Plotting W' goodindex,dailyw,gi_w,gflagw if (gflagw eq 1) then begin plot,tm(gi_w),dailyw(gi_w),xtitle = 'TIME (hr)', ytitle = 'w (m/s)', $ title='LCREEK: W , '+yyddd, $ xticks=12,yrange = [minvel,maxvel], $ charsize=1.5 endif else begin plot,tm(gi_w),dailyw(gi_w),xtitle = 'TIME (hr)', ytitle = 'w (m/s)', $ title='LCREEK: W , '+yyddd+subtitle, $ xticks=12,yrange = [minvel,maxvel], $ charsize=1.5 endelse ; print the % badvals in the .... xyouts,.8,.32,'% Bad = '+strtrim(string(100.*float(nbad(dailyw(*)))/len(dailyw)),2),$ /normal, charsize=1.0 cplot device, /close ;******************************************** ; END PLOTS OF DAILYWr * ; BEGIN PLOTS OF DAYLYT * ;******************************************** fname = !plots_daily+yyddd+'_lc_t_c_q.ps' device, filename=fname,/landscape mplot,1,3 print, 'Plotting T' printf,8, 'Plotting T' goodindex,dailyt,gi_t,gflagt if (gflagt eq 1) then begin plot, tm(gi_t), dailyt(gi_t), title='LCREEK: T, '+yyddd, xticks=12, $ yrange=[mint-0.02*(maxt-mint), maxt+0.02*(maxt-mint)], ystyle=1, $ ytitle = 't (Deg C)', charsize=1.5 endif else begin plot,tm(gi_t),dailyt(gi_t),title='LCREEK: T, '+yyddd+subtitle,xticks=12, $ yrange=[mint-0.02*(maxt-mint), maxt+0.02*(maxt-mint)], ystyle=1, $ ytitle = 't (Deg C)', charsize=1.5 endelse xyouts,.8,.99,'% Bad = '+strtrim(string(100.*float(nbad(dailyt(*)))/len(dailyt)),2),$ /normal, charsize=1.0 ;******************************************* ; BEGIN PLOTS OF C * ;******************************************* ;************************************* ; call FINALRANGE.PRO to get the * ; range for the plot. This code * ; will be used for c,q,tl,pl plus * ; ci,qi,tli,pli. The plots will be * ; centered on the max and min vals * ; found in the FINALRANGE.PRO code * ;************************************* finalrange, day_c, range print, 'Plotting C' printf,8, 'Plotting C' goodindex,dailyc,gi_c,gflagc if (gflagc eq 1) then begin plot, tm(gi_c), dailyc(gi_c), title='LCREEK: C, '+yyddd, xticks=12,$ yrange = [range(0,0),range(0,1)], ystyle=1, $ ytitle = 'c (ppm)', charsize=1.5 endif else begin plot,tm(gi_c),dailyc(gi_c),title='LCREEK: C, '+yyddd+subtitle, xticks=12,$ yrange = [range(0,0),range(0,1)], ystyle=1, $ ytitle = 'c (ppm)', charsize=1.5 endelse xyouts,.8,.66,'% Bad = '+strtrim(string(100.*float(nbad(dailyc(*)))/len(dailyc)),2),$ /normal, charsize=1.0 ;******************************************* ; END PLOTS OF C * ; BEGIN PLOTS OF Q * ;******************************************* finalrange, day_q, range print, 'Plotting Q' printf,8, 'Plotting Q' goodindex,dailyq,gi_q,gflagq if (gflagq eq 1) then begin plot, tm(gi_q), dailyq(gi_q), title='LCREEK: Q, '+yyddd, xticks=12, $ xtitle='Time (hr)',$ yrange = [range(0,0),range(0,1)], ystyle=1, $ ytitle = 'q (g/kg)', charsize=1.5 endif else begin plot, tm(gi_q), dailyq(gi_q), title='LCREEK: Q, '+yyddd+subtitle, $ xticks=12, xtitle='Time (hr)',$ yrange = [range(0,0),range(0,1)], ystyle=1, $ ytitle = 'q (g/kg)', charsize=1.5 endelse xyouts,.8,.32,'% Bad = '+strtrim(string(100.*float(nbad(dailyq(*)))/len(dailyq)),2),$ /normal, charsize=1.0 device, /close cplot ;******************************************* ; END PLOTS OF Q * ; BEGIN PLOTS OF TL * ;******************************************* finalrange, day_tl, range fname = !plots_daily+yyddd+'_lc_tl_pl.ps' device, filename=fname,/landscape mplot,1,3 print, 'Plotting TL' printf,8, 'Plotting TL' goodindex,dailytl,gi_tl,gflagtl if (gflagtl eq 1) then begin plot, tm(gi_tl), dailytl(gi_tl), title='LCREEK: TL, '+yyddd, xticks=12, $ yrange = [range(0,0),range(0,1)], ystyle=1, $ ytitle = 'tl (K)', charsize=1.5 endif else begin plot, tm(gi_tl), dailytl(gi_tl), title='LCREEK: TL, '+yyddd+subtitle, $ xticks=12, $ yrange = [range(0,0),range(0,1)], ystyle=1, $ ytitle = 'tl (K)', charsize=1.5 endelse xyouts,.8,.99,'% Bad = '+strtrim(string(100.*float(nbad(dailytl(*)))/len(dailytl)),2),$ /normal, charsize=1.0 ;********** PLOT PL ***************** finalrange, day_pl, range print, 'Plotting PL' printf,8, 'Plotting PL' goodindex,dailypl,gi_pl,gflagpl if (gflagpl eq 1) then begin plot, tm(gi_pl), dailypl(gi_pl), title='LCREEK: PL, '+yyddd,$ xticks=12,xtitle = 'Time (hr)', $ yrange = [range(0,0),range(0,1)], ystyle=1, $ ytitle = 'pl (mb)', charsize=1.5 endif else begin plot, tm(gi_pl), dailypl(gi_pl), title='LCREEK: PL, '+yyddd+subtitle,$ xticks=12,xtitle = 'Time (hr)', $ yrange = [range(0,0),range(0,1)], ystyle=1, $ ytitle = 'pl (mb)', charsize=1.5 endelse ; print the %badvals in the upper right corner of the plot xyouts,.8,.66,'% Bad = '+strtrim(string(100.*float(nbad(dailypl(*)))/len(dailypl)),2),$ /normal, charsize=1.0 cplot device, /close ;************************************ ;* END PLOTS OF PL * ;* Begin plots of WSPD * ;************************************ fname = !plots_daily+yyddd+'_lc_wspd_wdir.ps' device, filename=fname,/landscape mplot,1,3 print, 'Plotting WSPD' printf,8, 'Plotting WSPD' goodindex,wspd,gi_wspd,gflagwspd if (gflagwspd eq 1) then begin plot, tm(gi_wspd), wspd(gi_wspd), title = 'LCREEK: WSPD '+yyddd, $ xticks=12, $ yrange=[minwspd-0.02*(maxwspd-minwspd), $ maxwspd+0.02*(maxwspd-minwspd)],ystyle=1,$ ytitle = 'wspd (m/s)', charsize=1.5 endif else begin plot,tm(gi_wspd),wspd(gi_wspd),title='LCREEK: WSPD '+yyddd+subtitle,$ xticks=12, $ yrange=[minwspd-0.02*(maxwspd-minwspd), $ maxwspd+0.02*(maxwspd-minwspd)],ystyle=1,$ ytitle = 'wspd (m/s)', charsize=1.5 endelse xyouts,.8,.99,'% Bad = '+strtrim(string(100.*float(badwd)/len(wspd)),2),$ /normal, charsize=1.0 ;************************************ ;* END PLOTS OF WSPD * ;* Begin plots of WDIR * ;************************************ labels = ['0','90','180','270','360'] reflines = [0,90,180,270,360] print, 'Plotting WDIR' printf,8, 'Plotting WDIR' goodindex,wd,gi_wdir,gflagwdir if (gflagwdir eq 1) then begin plot, tm(gi_wdir), wd(gi_wdir), title = 'LCREEK: WDIR '+yyddd, $ xticks=12, xtitle='Time (hr)',$ yrange = [0,360], ystyle=1, yticks=4, ytickname=labels, ticklen=0.01,$ ytitle = 'wdir (Deg True)', charsize=1.5 endif else begin plot,tm(gi_wdir),wd(gi_wdir),title='LCREEK: WDIR '+yyddd+subtitle, $ xticks=12, xtitle='Time (hr)',$ yrange = [0,360], ystyle=1, yticks=4, ytickname=labels, ticklen=0.01,$ ytitle = 'wdir (Deg True)', charsize=1.5 endelse refline,0,1,reflines,1 xyouts,.8,.99,'% Bad = '+strtrim(string(100.*float(badwd)/len(wd)),2),$ /normal, charsize=1.0 cplot device, /close set_plot, 'x' !P.CHARSIZE = 1.0 ;***************************** ; END PLOTS * ;***************************** return end