pro read_ge, mjd, iok, a, dir=dir @compile_opt.pro ; On error, return to caller ;+ ; NAME: ; read_ge ; PURPOSE: ; Read edited Cambridge IPS daily data file ; CATEGORY: ; I/O ; CALLING SEQUENCE: ; read_ge, MJD, IOK, A ; INPUTS: ; MJD int Modified Julian day for requested file ; OUTPUTS: ; IOK int = 0 if file not succesfully read ; = 1 if file succesfully read ; RESTRICTIONS: ; The file is searched for in the $DAT directory ; PROCEDURE: ; An edited data file consists of 73 record. ; The header record contains the modified Julian day again. ; The number of data records is 72 ; MODIFICATION HISTORY: ; 1992, Tom Davidson ;- filename = filepath(root=dir,'E'+strcompress(mjd,/remove_all)+'.dat') message , 'Reading data in file '+filename, /info iok = 0 openr, /get_lun, IU , filename, /fortran, error=err if err ne 0 then return ; Return on open error on_ioerror, READ_ERROR ; Establish I/O error handler data = fltarr(14) dum = 0l readf, IU, dum ; Read header record (modified JD) for i=0,71 do begin ; Read 72 records into a readf, IU ,format='(14f8.3)',data & a[i,*] = data endfor free_lun, IU ; Close file on_ioerror, NULL ; Cancel I/O error handler iok = 1 return READ_ERROR: ; I/O error on_ioerror, NULL free_lun, IU message, !ERR_STRING, /ioerror return & end