;pro plot_mmcr_cal_dbze_main_nsa common mmcr_cal_data_combined, combo_hrfrac,combo_jday,combo_timeoffset, $ combo_ntimes, combo_num_sec,combo_hts,combo_numhts,combo_dbz, $ combo_specavg, combo_ipp, combo_nci, combo_nfft, combo_numcohints, $ combo_numcodebits common mmcr_mom_data_combined, combo_snr,combo_vel,combo_wid,combo_Nyq common mode_output, dbz_output, vel_output, wid_output, snr_output, modeid, modename common mask_variables, dif_sig, count_pro, levels_t, mask ; ; Get name of mmcrcal file ; fname=' ' openr, 1, 'input_fname' readf, 1, fname, format='(a100)' close, 1 fname=strtrim(fname,2) ; ; If it is a .c1 file change it to .a1 ; if n_elements(strsplit(fname,'c1',/extract,/regex)) gt 1 then begin sepname=strsplit(fname,'c1',/extract,/regex) fname2=sepname[0]+'a1'+sepname[1] print, 'changing ',fname,'to',fname2 spawn, 'mv '+fname+' '+fname2 fname=fname2 endif ; ; Set up some characteristics for the plot ; !p.charsize=2. !p.font=-1 loadct, 15 ; This is the stern color scheme gamma_ct, 1.65 ; ; Get the data ; ;get_mmcr_caldata_moments_data_timesync, fname2, 0., 23.99 get_mmcr_caldata_moments_data_timesync, fname, 0., 23.99 ; ; Assign mode names. ; mode4_index=3 mode3_index=2 mode2_index=1 mode1_index=0 ;for j=0,3 do begin ; if combo_specavg[j]+combo_nfft[j]+combo_numcohints[j]+combo_numcodebits[j] eq 149 then mode1_index=j ; if combo_specavg[j]+combo_nfft[j]+combo_numcohints[j]+combo_numcodebits[j] eq 113 then mode2_index=j ; if combo_specavg[j]+combo_nfft[j]+combo_numcohints[j]+combo_numcodebits[j] eq 116 then mode3_index=j ; if combo_specavg[j]+combo_nfft[j]+combo_numcohints[j]+combo_numcodebits[j] eq 130 then mode4_index=j ;endfor for kkj=0,3 do begin mode1_index=kkj dif_sig=fltarr(combo_ntimes[mode1_index],combo_numhts[mode1_index]) dif_sig[*,*]=(float(combo_snr[mode1_index,0:combo_ntimes[mode1_index]-1,0:combo_numhts[mode1_index]-1])) mask=intarr( n_elements(dif_sig[*,0]),n_elements(dif_sig[0,*])) mask[*,*]=0 count_pro=combo_ntimes[mode1_index] levels_t=combo_numhts[mode1_index] ; ; This turns the snr into db - has been converted to float above. ; dif_sig=dif_sig/100. ; ; This turns the snr into a physical value ; ; radar_mask_pre_mmcr dif_sig=10.^(dif_sig/10.) radar_mask_mmcr ; ; This turns the snr back into db ; dif_sig=10.*alog10(dif_sig) radar_mask_post_mmcr ;common mask_variables, dif_sig, count_pro, levels_t, mask if mode1_index ne 9999 then begin WINDOW, 3, /pixmap, XSIZE=1000, YSIZE=700, TITLE='MMCR Moments' !p.multi = [0,4,3] xl=0.075 & yl=0.80 & xr=0.85 & yr=0.95 plot_dbz=fltarr(combo_ntimes[mode1_index],combo_numhts[mode1_index]) & plot_dbz[*,*]=combo_dbz[mode1_index,0:combo_ntimes[mode1_index]-1,0:combo_numhts[mode1_index]-1] plot_hrfrac=fltarr(combo_ntimes[mode1_index]) & plot_hrfrac=combo_hrfrac[mode1_index,0:combo_ntimes[mode1_index]-1] plot_hts=fltarr(combo_numhts[mode1_index]) & plot_hts=combo_hts[mode1_index,0:combo_numhts[mode1_index]-1] plot_ntimes=combo_ntimes[mode1_index] & plot_numhts=combo_numhts[mode1_index] dbz_output=long((float(mask))*plot_dbz*100.) plot_dbz=plot_dbz*(float(mask)) if max(mask) gt 0 then begin min_val=min(plot_dbz[where(mask eq 1)]) endif else begin min_val=-80. endelse if max(mask) gt 0 then begin max_val=max(plot_dbz[where(mask eq 1)]) endif else begin max_val=0. endelse if min_val lt -80.0 then min_val=-80.0 & if max_val gt 30.0 then max_val=30.0 if n_elements(where(mask eq 0.0)) gt 1 then plot_dbz[where(mask eq 0.0)]=min_val+1. plot_2d_image_999_maxminin_test, plot_dbz, plot_hrfrac, plot_hts/1000., plot_ntimes, plot_numhts, $ ' ', ' ', 'Height (km)', [xl,yl,xr,yr], $ [xr+0.05,yl,xr+0.065,yr], 'dBZe', max(plot_dbz*(float(mask))), min_val, 220 xl=0.075 & yl=0.60 & xr=0.85 & yr=0.75 ;plot_2d_image_999, plot_dbz, plot_hrfrac, plot_hts/1000., plot_ntimes, plot_numhts, $ ; ' ', ' ', 'Height (km)', [xl,yl,xr,yr], $ ; [xr+0.05,yl,xr+0.065,yr], 'dBZe' plot_dbz[*,*]=(float(combo_vel[mode1_index,0:combo_ntimes[mode1_index]-1,0:combo_numhts[mode1_index]-1])) for j=0,plot_ntimes-1 do plot_dbz[j,*]=((plot_dbz[j,*]*combo_Nyq[mode1_index]))/10000. vel_output=long((float(mask))*plot_dbz*1000.) plot_dbz=plot_dbz*(float(mask)) if max(mask) gt 0 then begin min_val=min(plot_dbz[where(mask eq 1)]) endif else begin min_val=-80. endelse if max(mask) gt 0 then begin max_val=max(plot_dbz[where(mask eq 1)]) endif else begin max_val=0. endelse if min_val lt -3.0 then min_val=-3.0 & if max_val gt 3.0 then max_val=3.0 if n_elements(where(mask eq 0.0)) gt 1 then plot_dbz[where(mask eq 0.0)]=min_val+0.05 plot_2d_image_999_maxminin_test, plot_dbz, plot_hrfrac, plot_hts/1000., plot_ntimes, plot_numhts, $ ' ', ' ', 'Height (km)', [xl,yl,xr,yr], $ [xr+0.05,yl,xr+0.065,yr], 'Doppler Velocity (m/s)', max_val,min_val, 200 xl=0.075 & yl=0.40 & xr=0.85 & yr=0.55 ;plot_dbz[*,*]=(float(combo_snr[mode1_index,0:combo_ntimes[mode1_index]-1,0:combo_numhts[mode1_index]-1])) ;for j=0,plot_ntimes-1 do plot_dbz[j,*]=(plot_dbz[j,*])/100. ;snr_output=long(plot_dbz*100.) ;plot_2d_image_999, plot_dbz*(float(mask)), plot_hrfrac, plot_hts/1000., plot_ntimes, plot_numhts, $ ; ' ', ' ', 'Height (km)', [xl,yl,xr,yr], $ ; [xr+0.05,yl,xr+0.065,yr], 'Signal to Noise (db)' plot_dbz[*,*]=(float(combo_wid[mode1_index,0:combo_ntimes[mode1_index]-1,0:combo_numhts[mode1_index]-1])) for j=0,plot_ntimes-1 do plot_dbz[j,*]=((plot_dbz[j,*]*combo_Nyq[mode1_index]))/10000. wid_output=long((float(mask))*plot_dbz*1000.) plot_dbz=plot_dbz*(float(mask)) min_val=0. if n_elements(where(mask eq 1)) gt 1 then max_val=max(plot_dbz[where(mask eq 1)]) if min_val lt -3.0 then min_val=-3.0 & if max_val gt 3.0 then max_val=3.0 if n_elements(where(mask eq 0.0)) gt 1 then plot_dbz[where(mask eq 0.0)]=min_val+0.05 plot_2d_image_999_maxminin_test, plot_dbz, plot_hrfrac, plot_hts/1000., plot_ntimes, plot_numhts, $ ' ', ' ', 'Height (km)', [xl,yl,xr,yr], $ [xr+0.05,yl,xr+0.065,yr], 'Spectral Width (m/s)', max_val,0., 200 xl=0.075 & yl=0.20 & xr=0.85 & yr=0.35 plot_dbz[*,*]=(float(combo_snr[mode1_index,0:combo_ntimes[mode1_index]-1,0:combo_numhts[mode1_index]-1])) for j=0,plot_ntimes-1 do plot_dbz[j,*]=(plot_dbz[j,*])/100. snr_output=long(plot_dbz*100.) plot_2d_image_999_maxminin_test, plot_dbz, plot_hrfrac, plot_hts/1000., plot_ntimes, plot_numhts, $ ' ', ' ', 'Height (km)', [xl,yl,xr,yr], $ [xr+0.05,yl,xr+0.065,yr], 'Signal to Noise (db)',30.,-60., 200 if combo_specavg[mode1_index] eq 20 and combo_nfft[mode1_index] eq 128 and combo_numcohints[mode1_index] eq 1 and combo_numcodebits[mode1_index] eq 0 then modename='Robust' if combo_specavg[mode1_index] eq 44 and combo_nfft[mode1_index] eq 64 and combo_numcohints[mode1_index] eq 5 and combo_numcodebits[mode1_index] eq 0 then modename='General' if combo_specavg[mode1_index] eq 50 and combo_nfft[mode1_index] eq 64 and combo_numcohints[mode1_index] eq 6 and combo_numcodebits[mode1_index] eq 0 then modename='General' if combo_specavg[mode1_index] eq 16 and combo_nfft[mode1_index] eq 64 and combo_numcohints[mode1_index] eq 4 and combo_numcodebits[mode1_index] eq 32 then modename='Sensitive' if combo_specavg[mode1_index] eq 16 and combo_nfft[mode1_index] eq 64 and combo_numcohints[mode1_index] eq 6 and combo_numcodebits[mode1_index] eq 32 then modename='Sensitive' if combo_specavg[mode1_index] eq 50 and combo_nfft[mode1_index] eq 64 and combo_numcohints[mode1_index] eq 8 and combo_numcodebits[mode1_index] eq 8 then modename='BndryLayer' if combo_specavg[mode1_index] eq 50 and combo_nfft[mode1_index] eq 64 and combo_numcohints[mode1_index] eq 10 and combo_numcodebits[mode1_index] eq 8 then modename='BndryLayer' print, 'modename is ',modename print, 'parameters are ' print, combo_specavg[mode1_index],combo_nfft[mode1_index],combo_numcohints[mode1_index],combo_numcodebits[mode1_index] warning_flag=0 ;for iii=1,combo_ntimes[mode1_index]-1 do begin ; if (plot_hrfrac[iii]-plot_hrfrac[iii-1]) gt 0.05 then warning_flag=1 ;endfor strings=str_sep(fname,'/') xyouts, 400, 30, alignment=0.5,strings[n_elements(strings)-1]+' Mode: '+modename, /device, color=0, charsize=1.5 if warning_flag eq 1 then begin xyouts, 400, 60, alignment=0.5,'WARNING: Discontinuous File. Plot Incorrect!', /device, color=0, charsize=2.5 endif modeid=mode1_index ;************************* ; Create gif file ;************************* ; ; Extract the strings between the '.' ; strings=strsplit(fname,'.',/extract) ; ; Change the last string to be the mode.gif ; strings[n_elements(strings)-1]=modename+'.gif' ; ; Collapse the strings to create the gif name ; gifname=strjoin(strings,'.',/single) ; ; Create gif file ; write_gif,gifname,tvrd() ; ; Call this next subroutine with the filename ; write_mode_specific_moments, fname endif endfor end_program: print, 'Done' end