;+ ; NAME: GET_BKGHDS ; ; PURPOSE: ; To return the header information stored in the .bkg files. ; ; CATEGORY: ; ; CALLING SEQUENCE: ; GET_BKGHDS,YY,MM,DD,CN,FN,HEADER ; ; INPUTS: ; YY, MM, DD: The year, month and day the images were produced. ; ; CN: Camera number. ; ; FN: Filter number. ; ; KEYWORD PARAMETERS: ; None. ; ; OUTPUTS: ; HEADER: A structure containing the header information. It is organized ; as follows. ; ; header.utsec.sut: The starting time, in UT seconds, of the images ; used to produce a minimum image in the .bkg file. ; header.utsec.eut: The ending time, in UT seconds. ; header.utsec.int: The interval, in seconds, over which images were used ; to produce the minimum images in the .bkg files. ; NOTE that this information is redundant since it ; should = header.utsec.eut - header.utsec.sut. ; ; header.cam.c_num: The camera number of the images used to produced the ; minimum images in the .bkg file. ; ; header.cam.filt: The filter number ... ; ; header.date.year: The year the images used to make the minimum images ; in the .bkg file were produced. ; ; header.date.month: The month the images ... ; ; header.date.day: The day the images ... ; ; header.imgs.nimgs: The number of images used to make the minimum ; images in the .bkg file. ; ; COMMON BLOCKS: ; None. ; ; SIDE EFFECTS: ; None. ; ; RESTRICTIONS: ; None Known. ; ; PROCEDURE: ; The .bkg file corresponding to the date and camera-filter combination, ; is opened and the header bytes corresponding to every minimum image ; are read and returned in the structure HEADER. ; ; MODIFICATION HISTORY: ; Written July 1994, by T A Oliynyk. ; ;- PRO get_bkghds,yy,mm,dy,cn,fn,header ; If too few parameters, show documentation. IF N_PARAMS() LT 6 THEN BEGIN doc_library,'get_bkghds' header=-1 RETURN ENDIF ; Set up OS-specific parameters. @isitdos syy=STRING(yy MOD 100,FORMAT='(I2.2)') smm=STRING(mm,FORMAT='(I2.2)') sdd=STRING(dy,FORMAT='(I2.2)') scn=STRTRIM(cn,2) sfn=STRTRIM(fn,2) bpath=iroot+dd+'bkgrd'+dd filename=bpath+syy+smm+sdd+scn+sfn+'.bkg' f=FINDFILE(filename,count=exist) IF exist NE 0 THEN BEGIN OPENR,iunit,filename,/GET_LUN ifst=FSTAT(iunit) nimages=ifst.size/262168L images=ASSOC(iunit,BYTARR(262168L)) time = { misc1, sut: 0L, eut: 0L, int: 0L} camera = { misc2, c_num: 0, filt: 0 } date ={ misc3, year: 0 , month: 0, day: 0 } imgs = { misc4, nimgs: 0 } header=REPLICATE({ info, date: date, cam: camera, utsec: time , imgs: imgs } $ ,nimages) FOR i=0, nimages-1 DO BEGIN h1=FIX(images(i),0,6) h2=LONG(images(i),12,3) header(i).date.year = h1(0) header(i).date.month = h1(1) header(i).date.day = h1(2) header(i).cam.c_num = h1(3) header(i).cam.filt = h1(4) header(i).imgs.nimgs = h1(5) header(i).utsec.sut = h2(0) header(i).utsec.eut = h2(1) header(i).utsec.int = h2(2) ENDFOR FREE_LUN,iunit ENDIF ELSE BEGIN MESSAGE,'File does not exist for date and camera requested!',$ /INFORMATIONAL header=-1 ENDELSE RETURN END