PRO ucles_read, file, nw, no, w, f ;+ ; Program: ; ucles_read ; Purpose: ; reads a 2d dataframe into IDL where the ; original data comes in a simple 2-column file. ; the user MUST tell the programme what the 2 dimensions are. ; Example: ; ucles_read,'aat_fram_0001.dat',1024,46,w,f ; INPUT ; file : string variable containing file name ; file contains 2 columns of wl and fl ; and EXACTLY nw * no lines. ; nw : number of wavelengths ; no : number of orders ; OUTPUT ; w ; 2d real array (nw,no) containing wavelengths ; f : 2d real array (nw,no) containing fluxes ;- PRINT,'UCLES_READ: Reading echelle spectrum:',file w = fltarr(nw,no) f = fltarr(nw,no) title = ' dummy ' ; Open the data file on_ioerror,endofdata openr, lun, file, /get_lun ; read the header ReadF, lun, title print, title ReadF, lun, title ReadF, lun, nw_tot print, nw_tot, ' ? ', nw,no,'=',nw*no FOR j=0,no-1 DO BEGIN FOR i=0,nw-1 DO BEGIN ReadF, lun, ww, ff w(i,j) = ww f(i,j) = ff ENDFOR ENDFOR close,lun free_lun, lun RETURN endofdata: close,lun free_lun, lun print,'bad input file ',file END