pro rd_cal,filename,data,time_date,labels,nlines ; provide filename of a calfile and program returns records in floating array: data(n,36) ; the time information is returned in a separate string array: time_date(n) ; a indexed label string variable with the name of each type of data is included ; if you also want the number of lines just provide a variable and it will return the number ; of records. header='string' labels='string' dm37='string' temp1=fltarr(2500,36) ttemp1=strarr(2500) nlines=0 ;lun=1 openr,lun,filename, /get_lun readf,lun,header readf,lun,labels while not(EOF(lun)) do begin readf,lun,dm1,dm2,dm3,dm4,dm5,dm6,dm7,dm8,dm9,dm10,dm11,dm12,dm13,dm14,dm15,dm16,dm17,dm18,dm19,$ dm20,dm21,dm22,dm23,dm24,dm25,dm26,dm27,dm28,dm29,dm30,dm31,dm32,dm33,dm34,dm35,dm36,dm37 temp1(nlines,0)=dm1 ;record temp1(nlines,1)=dm2 ;wavelength temp1(nlines,2)=dm3 ;OL750 Silicon temp1(nlines,3)=dm4 ;OL750 Ge temp1(nlines,4)=dm5 ;Filter temp1(nlines,5)=dm6 ;Gain temp1(nlines,6)=dm7 ;Response time temp1(nlines,7)=dm8 ;grating temp1(nlines,8)=dm9 ;turret temp1(nlines,9)=dm10 ;sphere silicon temp1(nlines,10)=dm11 ;sphere filtered silicon temp1(nlines,11)=dm12 ;sphere InGAs temp1(nlines,12)=dm13 ;sphere temperature temp1(nlines,13)=dm14 ;collimator silicon temp1(nlines,14)=dm15 ;collimator filtered silicon temp1(nlines,15)=dm16 ;collimator InGAs temp1(nlines,16)=dm17 ;collimator temperature temp1(nlines,17)=dm18 ;Beam silicon temp1(nlines,18)=dm19 ;SSL InGAs temp1(nlines,19)=dm20 ;Beam temperature temp1(nlines,20)=dm21 ;Lamp current temp1(nlines,21)=dm22 ;d1 temp1(nlines,22)=dm23 ;d2 temp1(nlines,23)=dm24 ;d3 temp1(nlines,24)=dm25 ;Gas temperature temp1(nlines,25)=dm26 ;ambient temperature temp1(nlines,26)=dm27 ;sphere temperature temp1(nlines,27)=dm28 ;box temperature temp1(nlines,28)=dm29 ;chamber temperature temp1(nlines,29)=dm30 ;Cold strap temperature temp1(nlines,30)=dm31 ;Relative Humidity temp1(nlines,31)=dm32 ;T1 temperature temp1(nlines,32)=dm33 ;elevation angle temp1(nlines,33)=dm34 ;azimuth angle temp1(nlines,34)=dm35 ;polarizer angle temp1(nlines,35)=dm36 ;shutter state 0 closed, 1 open ttemp1(nlines)=dm37 ;date time nlines=nlines+1 endwhile ;nlines=nlines-1 data=fltarr(nlines,36) time_date=strarr(nlines) labels=strarr(37) data(*,*)=temp1(0:nlines-1,*) time_date(*)=ttemp1(0:nlines-1) labels=['Record','Wavelength','OL750 Si','OL750 Ge','Filter','Gain','Response Time','Grating',$ 'Turret','Sphere Silicon','Sphere Filtered Silicon','Sphere InGAs','Sphere Temperature',$ 'Collimator Silicon','Collimator Filtered Silicon','Collimator InGAs','Collimator Temperature',$ 'Beam Silicon','SSL InGAs','Beam Temperature','Lamp Current','d1','d2','d3','Gas Temperature',$ 'Ambient Temperature','Sphere Temperature','Box Temperature','Chamber Temperature',$ 'Cold Strap Temperature','Relative Humidity','T1 Temperature','Elevation','Azimuth','Polarizer',$ 'Shutter','Date-Time'] free_lun,lun return end