;+ ; NAME: ; skyd_version ; PURPOSE: ; Creates catalogue with software version numbers used ; to create skymap database ; CALLING SEQUENCE: PRO skyd_version, $ camera = camera , $ destination = destination,$ smeidb = smeidb ; OPTIONAL INPUTS: ; camera=camera array or scalar; type: integer; default: [1,2,3] ; SMEI cameras to be processed ; destination=destination ; scalar; type: string; default: $TUB ; destination directory for the skyd_equ catalogues ; /smeidb forces destination=$SMEIDB/cat/list ; (see PROCEDURE) ; INCLUDE: @compile_opt.pro ; CALLS: ; InitVar, TimeUnit, CheckDir, hide_env, smei_getfile ; TimeUnit, TimeSet, TimeGet, TimeSystem, smei_star_readpnt ; PROCEDURE: ; MODIFICATION HISTORY: ; JUN-2008, Paul Hick (UCSD/CASS) ;- ; Location of files with frame counts per orbit in $SMEIDB listdir = filepath(root=getenv('SMEIDB'),subdir='cat','list') InitVar, camera , [1,2,3] InitVar, smeidb , /key CASE smeidb OF 0: InitVar, destination, getenv('TUB') 1: destination = listdir ENDCASE IF NOT CheckDir(destination,/silent) THEN BEGIN message, /info, 'destination does not exist, '+hide_env(destination) RETURN ENDIF usec = TimeUnit(/sec) format = 'YEAR/MN/DD (DOY) hh:mm:ss.mss' nformat = strlen(format) first_orbit = 400 last_orbit = 28900 ncam = n_elements(camera) date_fmt ='YYYY-MN-DD hh:mm:ss' notime = strjoin(replicate(' ',strlen(TimeGet(/_ydoy,!TheTime,upto=usec)))) FOR icam=0,ncam-1 DO BEGIN count = 0 openw, iu, /get_lun, filepath(root=destination,'skyd_c'+strcompress(camera[icam],/rem)+'ver.txt') FOR orbit=last_orbit,first_orbit,-1 DO BEGIN sky_file = smei_getfile(orbit,camera=camera[icam],mode='sky',/exact,/silent) equ_file = smei_getfile(orbit,camera=camera[icam],mode='equ',/exact,/silent) pnt_file = smei_getfile(orbit,camera=camera[icam],mode='pnt',/exact,/silent) ecl_file = smei_getfile(orbit,camera=camera[icam],mode='ecl',/exact,/silent) sky_file = sky_file[0] equ_file = equ_file[0] pnt_file = pnt_file[0] ecl_file = ecl_file[0] cstr = string(orbit,format='(I5)')+' '+TimeGet(/_ydoy,TimeSet(smei=orbit),upto=usec) cstr += ' ' CASE sky_file EQ '' OF 0: BEGIN h = headfits(sky_file) ; Get Fits header time = fxpar(h,'DATE') time = TimeGet(/_ydoy,upto=usec,TimeSet(time,format=date_fmt)) vers = [fxpar(h,'SMEI_CAL'),fxpar(h,'SMEI_ORB'),fxpar(h,'SMEI_SKY')] mode = fxpar(h, 'MODE') cstr += string(mode,format='(I3)')+' | '+time+string(vers,format='(3F5.2)') END 1: BEGIN mode = -1 cstr += ' '+' | '+notime+strjoin(replicate(' ',3)) END ENDCASE cstr += ' | ' CASE equ_file EQ '' OF 0: BEGIN h = headfits(equ_file) ; Get Fits header time = fxpar(h,'DATE') time = TimeGet(/_ydoy,upto=usec,TimeSet(time,format=date_fmt)) vers = [fxpar(h,'SMEI_CAL'),fxpar(h,'SMEI_ORB'),fxpar(h,'SMEI_SKY'),fxpar(h,'BSTARVER'),fxpar(h,'BKGNDVER')] cstr += time+string(vers,format='(5F5.2)') END 1: cstr += notime+strjoin(replicate(' ',5)) ENDCASE cstr += ' | ' CASE pnt_file EQ '' OF 0: BEGIN tmp = smei_star_readpnt(pnt_file,hdr=h,/silent) time = h[ (where(strpos(h,'DATE') NE -1))[0] ] time = strmid(time,strpos(time,':')+2) time = TimeGet(/_ydoy,upto=usec,TimeSet(time,format=date_fmt)) h = [h,'SMEI_CAL: -1.0','SMEI_ORB: -1.0','SMEI_SKY: -1.0','BSTARVER: -1.0','BKGNDVER: -1.0'] vers = [sfloat(h[ (where(strpos(h,'SMEI_CAL') NE -1))[0] ]) , $ sfloat(h[ (where(strpos(h,'SMEI_ORB') NE -1))[0] ]) , $ sfloat(h[ (where(strpos(h,'SMEI_SKY') NE -1))[0] ]) , $ sfloat(h[ (where(strpos(h,'BSTARVER') NE -1))[0] ]) , $ sfloat(h[ (where(strpos(h,'BKGNDVER') NE -1))[0] ]) ] cstr += time+string(vers,format='(5F5.2)') END 1: cstr += notime+strjoin(replicate(' ',5)) ENDCASE cstr += ' | ' CASE ecl_file EQ '' OF 0: BEGIN h = headfits(ecl_file) ; Get Fits header time = fxpar(h,'DATE') time = TimeGet(/_ydoy,upto=usec,TimeSet(time,format=date_fmt)) vers = [fxpar(h,'SMEI_CAL'),fxpar(h,'SMEI_ORB'),fxpar(h,'SMEI_SKY'), $ fxpar(h,'BSTARVER'),fxpar(h,'BKGNDVER'),fxpar(h,'ZLDVER')] cstr += time+string(vers,format='(6F5.2)') END 1: cstr += notime+strjoin(replicate(' ',6)) ENDCASE IF count mod 50 EQ 0 THEN BEGIN printf, iu, strjoin(replicate('-',strlen(cstr))) printf, iu, 'Orbit Start Time Mode |' + $ ' SKY cal orb sky |' + $ ' EQU cal orb sky star bkgnd|' + $ ' PNT cal orb sky star bkgnd|' + $ ' ECL cal orb sky star bkgnd zld' printf, iu, strjoin(replicate('-',strlen(cstr))) ENDIF printf, iu, cstr count += 1 ENDFOR free_lun, iu ENDFOR RETURN & END