; ; Plot a molts edass monthly summary ; Command line should be: plot_molts,'sgp',200012 ; pro plot_molts,site,searchdate ; ; common containing the molts data ; common molts_data, pres,temp,u_wind,v_wind,humid,omega,cloud_h2o_mix,conv_lat_heat,$ stab_lat_heat,sw_heat,lw_heat,cloud_fract,turb_kin,ice_mix,$ numtimes,base_time,time_offset,numheights,newheight,files ; ; Read in the molts data ; get_molts_data,site,searchdate ; ; Rename height ; height=newheight ; ; Select which data to plot ; dataname=strarr(14) dataname=['Pressure','Temperature','Wind U-component','Wind V-component',$ 'Specific Humidity','Omega','Cloud Water Mixing Ratio',$ 'Convective Latent Heating Rate','Stable Latent Heating Rate',$ 'Short-Wave Heating Rate','Long-Wave Heating Rate',$ 'Cloud Cover in a Layer','Turbulent Kinetic Energy in a Layer',$ 'Ice Mixing Ratio'] datatag=strarr(14) datatag=['pres','temp','uwind','vwind','humid','omega','wmix','convh',$ 'stabh','swhr','lwhr','cfrac','turb','imix'] cb_title=strarr(14) cb_title=['mb','Kelvin','m/s','m/s','kg/kg','Pa/s','log kg/kg','K/s','K/s',$ 'K/s','K/s','%','m!E2!N/s!E2','kg/kg'] ; ; Get name for gifs and files ; parts=strsplit(files[0],'/',/extract) tag=strmid(parts[5],0,36) ;nsa sgp ; ; Loop through the variables in the file ; for datanum=0,13 do begin ;loop through the different variables print, datatag[datanum] if datanum eq 0 then data=pres if datanum eq 1 then data=temp if datanum eq 2 then data=u_wind if datanum eq 3 then data=v_wind if datanum eq 4 then data=humid if datanum eq 5 then data=omega if datanum eq 6 then data=cloud_h2o_mix if datanum eq 7 then data=conv_lat_heat if datanum eq 8 then data=stab_lat_heat if datanum eq 9 then data=sw_heat if datanum eq 10 then data=lw_heat if datanum eq 11 then data=cloud_fract if datanum eq 12 then data=turb_kin ; Ice mixing ration doesn't exist in 1999 files if datanum eq 13 then begin if n_elements(ice_mix) ne 0 then data=ice_mix if n_elements(ice_mix) eq 0 then goto,skip_ice_mix endif ; ; Convert wmix to log ; if datanum eq 6 then begin result=where(data ne 0 and data gt -9999 ,count) if count ne 0 then data[result]=alog10(data[result]) endif ; ; Find the max and min data values ; dmax=max(data) ; both -99999 and -9999 flags in the data ; -9999 are in convh and stabh result=where(data le -9999, count) if count ne 0 then data[result]=1e6 dmin=min(data) if count ne 0 then data[result]=-99999 if datanum eq 6 then begin result=where(data eq 0,count) if count ne 0 then data[result]=-99999 endif ;dmin=-4 ;dmax=3 print, 'dmax',dmax,'dmin',dmin if dmax eq dmin then goto, no_data_to_plot ; ; Calculate the file starting and ending date and time ; standard_date_time,base_time+time_offset(0),syear,smonth,sday,shour,smin,ssec print,'file start',syear,smonth,sday,shour,smin,ssec standard_date_time,base_time+time_offset(numtimes-1),eyear,emonth,eday,ehour,emin,esec print,'file end',eyear,emonth,eday,ehour,emin,esec ; ; Calculate the standard date arrays ; 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) ; ; 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='molts',/pixmap dummy=label_date(date_format=[' %D %M !C %H:%I ']) ; ; 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(base_time+time_offset eq week1,count) if count eq 1 then week1=result[0] else stop ;week2=num_sec_ep(1999,07,8,0,0,0) week2=num_sec_ep(syear,smonth,sday+7,shour,smin,ssec) result=where(base_time+time_offset eq week2,count) if count eq 1 then week2=result[0] else stop week=data[week1:week2-1,*] weektime=julian_day[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,weektime[0],height[0],xaxis=0,color=0,xstyle=1,xtickunits='time',$ xtickformat='label_date',xrange=[weektime[0],weektime[n_elements(weektime)-1]] axis,weektime[0],height[numheights-1],xaxis=1,color=0,xstyle=1,xtickunits='time',$ xtickformat='(A1)',xrange=[weektime[0],weektime[n_elements(weektime)-1]] axis,weektime[0],height[0],yaxis=0,color=0,ystyle=1,yrange=[height[0],height[numheights-1]],$ ytitle='Height (km)' axis,weektime[n_elements(weektime)-1],height[0],yaxis=1,color=0,ystyle=1,yrange=[height[0],height[numheights-1]],$ ytickformat='(A1)' colorbarm,dataname[datanum],data,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(base_time+time_offset eq week1,count) if count eq 1 then week1=result[0] else stop ;week2=num_sec_ep(1999,07,15,0,0,0) week2=num_sec_ep(syear,smonth,sday+14,shour,smin,ssec) result=where(base_time+time_offset eq week2,count) if count eq 1 then week2=result[0] else stop week=data[week1:week2-1,*] weektime=julian_day[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,weektime[0],height[0],xaxis=0,color=0,xstyle=1,xtickunits='time',$ xtickformat='label_date',xrange=[weektime[0],weektime[n_elements(weektime)-1]] axis,weektime[0],height[numheights-1],xaxis=1,color=0,xstyle=1,xtickunits='time',$ xtickformat='(A1)',xrange=[weektime[0],weektime[n_elements(weektime)-1]] axis,weektime[0],height[0],yaxis=0,color=0,ystyle=1,yrange=[height[0],height[numheights-1]],$ ytitle='Height (km)' axis,weektime[n_elements(weektime)-1],height[0],yaxis=1,color=0,ystyle=1,yrange=[height[0],height[numheights-1]],$ ytickformat='(A1)' colorbarm,dataname[datanum],data,dmax,dmin,cb_title[datanum],px,py,sx,sy endif skip_plot_2: ; ; 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(base_time+time_offset eq week1,count) if count eq 1 then week1=result[0] else goto,skip_plot_3 ;week2=num_sec_ep(1999,07,22,0,0,0) week2=num_sec_ep(syear,smonth,sday+21,shour,smin,ssec) result=where(base_time+time_offset eq week2,count) if count eq 1 then week2=result[0] else stop week=data[week1:week2-1,*] weektime=julian_day[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,weektime[0],height[0],xaxis=0,color=0,xstyle=1,xtickunits='time',$ xtickformat='label_date',xrange=[weektime[0],weektime[n_elements(weektime)-1]] axis,weektime[0],height[numheights-1],xaxis=1,color=0,xstyle=1,xtickunits='time',$ xtickformat='(A1)',xrange=[weektime[0],weektime[n_elements(weektime)-1]] axis,weektime[0],height[0],yaxis=0,color=0,ystyle=1,yrange=[height[0],height[numheights-1]],$ ytitle='Height (km)' axis,weektime[n_elements(weektime)-1],height[0],yaxis=1,color=0,ystyle=1,yrange=[height[0],height[numheights-1]],$ ytickformat='(A1)' colorbarm,dataname[datanum],data,dmax,dmin,cb_title[datanum],px,py,sx,sy endif skip_plot_3: ; ; 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(base_time+time_offset eq week1,count) if count eq 1 then week1=result[0] else goto, skip_plot_4 ;week2=num_sec_ep(1999,07,29,0,0,0) week2=num_sec_ep(syear,smonth,sday+28,shour,smin,ssec) result=where(base_time+time_offset eq week2,count) if count eq 1 then begin week2=result[0] endif else begin week2=numtimes-1 ;for February endelse week=data[week1:week2-1,*] weektime=julian_day[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,weektime[0],height[0],xaxis=0,color=0,xstyle=1,xtickunits='time',$ xtickformat='label_date',xrange=[weektime[0],weektime[n_elements(weektime)-1]] axis,weektime[0],height[numheights-1],xaxis=1,color=0,xstyle=1,xtickunits='time',$ xtickformat='(A1)',xrange=[weektime[0],weektime[n_elements(weektime)-1]] axis,weektime[0],height[0],yaxis=0,color=0,ystyle=1,yrange=[height[0],height[numheights-1]],$ ytitle='Height (km)' axis,weektime[n_elements(weektime)-1],height[0],yaxis=1,color=0,ystyle=1,yrange=[height[0],height[numheights-1]],$ ytickformat='(A1)' colorbarm,dataname[datanum],data,dmax,dmin,cb_title[datanum],px,py,sx,sy endif skip_plot_4: ; ; 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(base_time+time_offset eq week1,count) if count eq 1 then week1=result[0] else goto, skip_plot_5 ;week2=num_sec_ep(1999,07,31,23,0,0) week2=num_sec_ep(syear,smonth,eday,ehour,emin,esec) result=where(base_time+time_offset eq week2,count) if count eq 1 then week2=result[0] else stop week=data[week1:week2-1,*] weektime=julian_day[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,weektime[0],height[0],xaxis=0,color=0,xstyle=1,xtickunits='time',$ xtickformat='label_date',xrange=[weektime[0],weektime[n_elements(weektime)-1]] axis,weektime[0],height[numheights-1],xaxis=1,color=0,xstyle=1,xtickunits='time',$ xtickformat='(A1)',xrange=[weektime[0],weektime[n_elements(weektime)-1]] axis,weektime[0],height[0],yaxis=0,color=0,ystyle=1,yrange=[height[0],height[numheights-1]],$ ytitle='Height (km)' axis,weektime[n_elements(weektime)-1],height[0],yaxis=1,color=0,ystyle=1,yrange=[height[0],height[numheights-1]],$ ytickformat='(A1)' colorbarm,dataname[datanum],data,dmax,dmin,cb_title[datanum],px,py,sx,sy endif skip_plot_5: ; ; 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) if site eq 'nsa' then capsite='NSA' if site eq 'sgp' then capsite='SGP' parts=strsplit(tag,'.',/extract) datastream=parts[0]+'.'+parts[1] xyouts,0.5,0.95,align=0.5,charsize=1.7,/normal,color=0,$ ; strmid(files[0],3,23)+' Monthly Summary for '+dataname[datanum]+'!C'+capsite+' - '+smon+' '+syr datastream+' Monthly Summary for '+dataname[datanum]+$ '!C'+capsite+' - '+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='/data/mace4/arm_data/temp_image/'+tag+datatag[datanum] write_gif,giffile+'.gif',tvrd( ) ; ; Remove png file ; unix_command='rm '+giffile+'.png' spawn,unix_command skip_ice_mix: no_data_to_plot: endfor ;end loop through variables end