function index_h2so4_neidziela,wave_um,t,wts ;------------------------------------------------------------------------- ; ; Purpose: ; Sulfate refractive indices from Neidziela et al., 1998, are reported ; versus wavelength, temperature, and composition (wt. % h2so4). This ; routine will interpolate these indices to the requested wavelength, ; temperature, and composition. ; ; Input: ; wave_um...wavelength in microns ; wts.......wt. fraction h2so4 ; t.........temperature in K ; ; Output: ; index....complex refractive index ; ; Notes: ; Set the variable "path" below to the location where your data files are kept ; ; Source: Mark Hervig ; ;------------------------------------------------------------------------- index = complex(0.,0.) wave_cm = 10000.0 / wave_um wtsp = wts * 100. ; fraction to % ;- get the h2so4 refractive index data file names, Niedziela ; path = 'c:\hervig\data\refractive_index\miller\h2so4\' path = '/home/mhervig/data/refractive_index/miller/h2so4/' if ( !version.os_family eq 'Windows') then spawn,'dir '+path+'Saw*.ri /b',files if ( !version.os_family eq 'unix') then spawn,'dir '+path+'Saw*.ri' ,files nfiles = n_elements(files) ;- the temperature and composition are in the file name, parse them out tn = fltarr(nfiles) cn = fltarr(nfiles) for i=0,nfiles-1 do begin m = strpos(files(i), 'Saw') tn(i) = float(strmid(files(i),m+3,3)) ; temperature, K cn(i) = float(strmid(files(i),m+6,2)) ; % h2so4 endfor if ( !version.os_family eq 'Windows') then files = path + files ;- put the temperatures in order, with no repeats s = sort(tn) ; numeric sort ts = tn(s) u = uniq(ts) ; find unique values tsu = ts(u) nt = n_elements(tsu) ;- find indices that bound the input parameters tlo = -1. thi = -1. c1t1 = -1. c2t1 = -1. c1t2 = -1. c2t2 = -1. k1 = -1 k2 = -1 k3 = -1 k4 = -1 k = where(tsu le t, nlo) & if (nlo gt 0) then tlo = tsu(k(nlo-1)) k = where(tsu gt t, nhi) & if (nhi gt 0) then thi = tsu(k(0 )) ;- if there are temperatures bounting t if (tlo gt 0 and thi gt 0) then begin ktlo = where(tn eq tlo, ntlo) ; files at tlo kthi = where(tn eq thi, nthi) ; files at thi ct1 = cn(ktlo) ; compositions at tlo ct2 = cn(kthi) ; compositions at thi k = where(ct1 le wtsp, n1) & if (n1 gt 0) then c1t1 = ct1(k(n1-1)) k = where(ct1 gt wtsp, n2) & if (n2 gt 0) then c2t1 = ct1(k(0 )) k = where(ct2 le wtsp, n3) & if (n3 gt 0) then c1t2 = ct2(k(n3-1)) k = where(ct2 gt wtsp, n4) & if (n4 gt 0) then c2t2 = ct2(k(0 )) ;- if there are compositions bounding wts, at tlo and at thi if (c1t1 gt 0 and c2t1 gt 0 and c1t2 gt 0 and c2t2 gt 0) then begin k1 = where(tn eq tlo and cn eq c1t1) & k1=k1(0) k2 = where(tn eq tlo and cn eq c2t1) & k2=k2(0) k3 = where(tn eq thi and cn eq c1t2) & k3=k3(0) k4 = where(tn eq thi and cn eq c2t2) & k4=k4(0) print,files(k1) print,files(k2) print,files(k3) print,files(k4) endif endif ;- read the index files if bounded in T and wts if (k1 gt 0 and k2 gt 0 and k3 gt 0 and k4 gt 0) then begin dx1 = getindex2(files(k1),wave_cm) dx2 = getindex2(files(k2),wave_cm) dx3 = getindex2(files(k3),wave_cm) dx4 = getindex2(files(k4),wave_cm) dtdt = (t - thi)/(tlo - thi) dcdc1 = (wtsp - c2t1)/(c1t1 - c2t1) dcdc2 = (wtsp - c2t2)/(c1t2 - c2t2) dxt1 = dcdc1 *(dx1-dx2) + dx2 dxt2 = dcdc2 *(dx3-dx4) + dx4 index = dtdt * ( dxt1 - dxt2) + dxt2 return,index endif print,'temperature and/or composition out of range in index_h2so4_neidziela.pro' return,index end