;+ ; NAME: ; mk_nuwgt_low ; PURPOSE: (one line) ; make a list of inverse cm (and optionally, weights) (lowlevel) ; DESCRIPTION: ; pick nu's appropriate for the temperature ; CATEGORY: ; Spectra ; CALLING SEQUENCE: ; nuarr = mk_nuwgt_low(nu0arr, dopwarr, nx, ndopw, s, ng, dnuarr) ; INPUTS: ; nu0arr - array of line centers (may be scalar) ; dopwarr - array of doppler widths (same length as nu0arr) ; nx - number of points in all other grids ; ndopw - number of doppler widths in the core ; s - scale of spacing between grids (must be >1 ) ; ng - number of grids ; OPTIONAL INPUT PARAMETERS: ; none ; KEYWORD INPUT PARAMETERS: ; none ; KEYWORD OUTPUT PARAMETERS: ; none ; OUTPUTS: ; nu - array of wavenumbers (inverse cm) ; dnuarr - if present, array of wavenumber weights (inverse cm) ; COMMON BLOCKS: ; None ; SIDE EFFECTS: ; RESTRICTIONS: ; None ; PROCEDURE: ; MODIFICATION HISTORY: ; Written 2001 May, by Leslie Young, SwRI ; Modified 2004 Jun 27, LAY, based on Meadows&Crisp 1996 ;- function drop1, a return, a[1:n_elements(a)-1] end function drop1rev, a return, reverse(a[1:n_elements(a)-1]) end function mk_nuwgt_low, nu0arr, dopwarr, nx, ndopw, s, ng, numin, mumax, dnuarr ; number of lines nl = n_elements(nu0arr) ; shortward of the first line il = 0 nu0b = nu0arr[il] dopwb = dopwarr[il] db = 2*(ndopw*dopwb)/nx/s nub = nu0b-db*s/2. xb = nu0b + [0.] for ig = 1, ng do begin db = db * s xb = [xb, nub - (findgen(nx)+0.5)*db] nub = nub - db * nx end nuarr = drop1rev(xb) print,' - il=0' print, nuarr ; intermediate for il = 1, nl-1 do begin nu0a = nu0b dopwa = dopwb da = 2*(ndopw*dopwa)/nx/s nua = nu0a+da*s/2. nu0b = nu0arr[il] dopwb = dopwarr[il] db = 2*(ndopw*dopwb)/nx/s nub = nu0b-db*s/2. if nua ge nub then begin nuarr = [nuarr, nu0a] endif else begin xa = nu0a + [0., 0.] xb = nu0b + [0.] continue = 1 ig = 1 while continue eq 1 and ig le ng do begin da = da * s db = db * s nuanext = nua + da * nx nubnext = nub - db * nx if nuanext lt nubnext then begin xa = [xa, nua + (findgen(nx)+0.5)*da] xb = [xb, nub - (findgen(nx)+0.5)*db] endif else begin if db lt da then begin na = floor((nubnext-nua)/da-0.5) if na gt 0 then $ xa = [xa, nua + (findgen(na)+0.5)*da] xb = [xb, nub - (findgen(nx)+0.5)*db] endif else begin xa = [xa, nua + (findgen(nx)+0.5)*da] nb = floor((nub-nuanext)/db-0.5) if nb gt 0 then $ xb = [xb, nub - (findgen(nb)+0.5)*db] endelse continue = 0 endelse nua = nuanext nub = nubnext ig = ig + 1 endwhile nuarr = [nuarr, drop1(xa), drop1rev(xb)] endelse print,'il=0 - il=1' print, nuarr end ; longward of the last line il = nl-1 nu0a = nu0arr[il] dopwa = dopwarr[il] da = 2*(ndopw*dopwa)/nx/s nua = nu0a+da*s/2. xa = nu0a + [0., 0.] for ig = 1, ng do begin da = da * s xa = [xa, nua + (findgen(nx)+0.5)*da] nua = nua + da * nx end nuarr = [nuarr, drop1(xa)] print,'il= 1 - ' print, nuarr return, nuarr end pro mk_nuwgt_lowTEST nu0arr = [0., 10.] dopwarr = [1.,1.] nx = 10. ndopw = 1. s = exp(1.) ng = 5. nuarr = mk_nuwgt_low( nu0arr, dopwarr, nx, ndopw, s, ng, dnuarr) end