FUNCTION nlines,file ; This function opens the specified file, determines its length in ; bytes, and reads it in as a BYTE-valued array. It then returns ; the number of occurrences of 10B in the file. 10B is the ASCII ; code for a line feed, which marks the end of a line of text (in ; UNIX, at least). OPENR,unit,file,/GET_LUN f=FSTAT(unit) IF f.SIZE EQ 0 THEN n=0L ELSE BEGIN b=BYTARR(f.size) READU,unit,b n=LONG(TOTAL(b EQ 10B)) ENDELSE CLOSE,unit FREE_LUN,unit RETURN,n END ;------------------------------------------------------------- ;+ ; NAME: ; QGETFILE ; PURPOSE: ; Read a text file into a string array. ; CATEGORY: ; CALLING SEQUENCE: ; s = qgetfile(f) ; INPUTS: ; f = text file name. in ; KEYWORD PARAMETERS: ; Keywords: ; ERROR=err error flag: 0=ok, 1=file not opened. ; /QUIET means give no error message. ; OUTPUTS: ; s = string array. out ; COMMON BLOCKS: ; NOTES: ; MODIFICATION HISTORY: ; R. Sterner, 20 Mar, 1990 ; D. Steele, 18 Mar, 1994 - added line count, changed WHILE loop ; to FOR loop, and changed name from ; GETFILE.PRO to QGETFILE.PRO. ; ; Copyright (C) 1990, Johns Hopkins University/Applied Physics Laboratory ; This software may be used, copied, or redistributed as long as it is not ; sold and this copyright notice is reproduced on each copy made. This ; routine is provided as is without any express or implied warranties ; whatsoever. Other limitations apply as described in the file disclaimer.txt. ;- ;------------------------------------------------------------- function qgetfile, file, error=err, help=hlp, quiet=quiet if (n_params(0) lt 1) or keyword_set(hlp) then begin print,' Read a text file into a string array.' print,' s = getfile(f)' print,' f = text file name. in' print,' s = string array. out' print,' Keywords:' print,' ERROR=err error flag: 0=ok, 1=file not opened.' print,' /QUIET means give no error message.' return, -1 endif get_lun, lun on_ioerror, err ; The following lines were added by D P Steele, 94/03/18 nl=nlines(file) s=STRARR(nl) openr, lun, file ; s = [' '] t = '' ; while not eof(lun) do begin FOR i=0L,nl-1 DO BEGIN ; replace EOF search with FOR loop readf, lun, t ; s = [s,t] s(i)=t ; avoid slow string concatenation ; endwhile ENDFOR close, lun free_lun, lun err = 0 ; return, s(1:*) RETURN,s err: if !err eq -168 then begin if not keyword_set(quiet) then print,' Non-standard text file format.' free_lun, lun ; return, s(1:*) RETURN,s endif if not keyword_set(quiet) then print,$ ' Error in getfile: File '+file+' not opened.' free_lun, lun err = 1 return, -1 end ; -------------------------------------------------------------------- PRO qlook1,file,debug=debug ; IDL Version 3.1.0 (RISC/os mipseb) ; Journal File for cnsr3@jasper ; Working directory: /jasper/cnsr3_data1 ; Date: Mon Jan 9 10:18:08 1995 ; First convert HH:MM:SS times to UT seconds. ; Then segregate data by camera. ; Then determine cycles and identify dark counts. ; Save dark counts and remove them from the other data. ; Segregate data by camera/filter. ; Subtract interpolated dark counts from all data. ; Apply approximate calibration factors. ; Plot approximate Rayleighs or Rayleighs/nm. ; Load the quick-look data file q=qgetfile(file) nq=N_ELEMENTS(q) IF KEYWORD_SET(debug) THEN help,q ; -------------------------------------------------------------------- ; Extract numeric data and convert HH:MM:SS times to UT seconds cam=INTARR(nq) filt=cam expos=cam data=LONARR(nq) utsec=FLTARR(nq) FOR i=0,nq-1 DO BEGIN qi=q(i) cam(i)=FIX(STRMID(qi,0,1)) filt(i)=FIX(STRMID(qi,2,1)) expos(i)=FIX(STRMID(qi,5,3)) hut=FIX(STRMID(qi,9,2)) mut=FIX(STRMID(qi,12,2)) sut=FIX(STRMID(qi,15,2)) utsec(i)=(hut*60.+mut)*60.+sut data(i)=LONG(STRMID(qi,18,STRLEN(qi)-18)) ENDFOR ; Segregate data by camera. c0=WHERE(cam EQ 0) nc0=N_ELEMENTS(c0) c1=WHERE(cam EQ 1) nc1=N_ELEMENTS(c1) noerr=(nc0 EQ nc1) AND (TOTAL(utsec(c0) EQ utsec(c1)) EQ nc0) IF NOT noerr THEN MESSAGE,'At least one missing image; synch problems' STOP RETURN END