; pro getbrass,uarsday,datfile,ps=ps,log10=log ; ; Get Uars Solstice fluxes in Guy Brasseur's bins: ; Used Mgii.pro to determine uars solar min day is 1357, and ; uars solar max day is 144, however flux is not available ; for day 1357, so used Mgii.pro to determine 6 min days, ; and flux is available for the 6th min, which was on day 1417, so: ; smin = day 1417 ; smax = day 144 ; if n_elements(uarsday) eq 0 or n_elements(datfile) eq 0 then begin print,'Usage: getbrass,uarsday,datfile,ps=ps' return endif date = udate_to_vms(uarsday) print,'uarsday=',uarsday,' date=',date(0),' datfile=',datfile if keyword_set(ps) then print,'Will make ps file' format="(i5,2f12.2,f9.2,e15.4)" title = 'UARS DAY ' + string(uarsday,format="(i5)") + ' (' + date(0) + ')' ; ; Use local file if exists under name datfile ; ;finduars = findfile(datfile) ;if n_elements(finduars gt 0) then begin ; print,'Will use existing file ',datfile ; openr,lurd,datfile,/get_lun ; readf,lurd,bins,format=format ; goto, plot ;endif ; ; Get Solstice fluxes: ; print,'calling get_brasseur_bins...' get_brasseur_bins,uarsday,bins nbins = n_elements(bins.flux) print,'nbins=',nbins ; ; Write to ascii file: ; openw,luwr,datfile,/get_lun printf,luwr,title printf,luwr,format="(' bin wv_low wv_high wv_del flux')" for i=0,nbins-1 do begin printf,luwr,i+1,bins.wv_low(i),bins.wv_high(i),$ bins.wv_high(i)-bins.wv_low(i),bins.flux(i),format=format endfor close,luwr print,'Wrote file ',datfile free_lun,luwr ; ; Plot fluxes (uars fluxes are non-zero) ; plot: if (keyword_set(ps)) then begin set_plot,'PS' psfile = 'day'+strcompress(string(uarsday),/remove_all)+'.ps' device,filename=psfile endif else set_plot,'X' iflux = where(bins.flux ne 0.) flux = bins.flux(iflux) ibins = indgen(nbins) ibins = ibins(iflux)+1 ;print,'ibins=' & print,ibins ;print,'flux=' & print,flux if keyword_set(log) then $ plot_io,ibins,flux,title=title,xtitle='BRASSEUR BIN INDEX',$ ytitle='SOLSTICE FLUX (photons/s/cm^2)',xmargin=[13,5] $ else $ plot,ibins,flux,title=title,xtitle='BRASSEUR BIN INDEX',$ ytitle='SOLSTICE FLUX (photons/s/cm^2)',xmargin=[13,5] ; if (keyword_set(ps)) then begin device,/close_file print,'Wrote plot to file ',psfile endif return end