;+ ; NAME: ; smeidb_mounted ; PURPOSE: ; Check whether SMEI data base is accessible ; CATEGORY: ; camera/idl/misc ; CALLING SEQUENCE: FUNCTION smeidb_mounted, tf, drive=drive ; INPUTS: ; tf scalar, or array[1] ; either a time (in the form of a standard ; time structure), or the name of a SMEI frame ; (e.g. 'c2frm_2003_123_456789') ; OPTIONAL INPUT PARAMETERS: ; The SMEI frames are stored in directories of the form ; $SMEIDB#/yyyy_doy/c#. ; OUTPUTS: ; sts scalar; type: string ; directory where frame(s) for specified time are located ; INCLUDE: @compile_opt.pro ; On error, return to caller ; COMMON BLOCKS: common smei_filepath_save, checkdrives, sdat ; CALLS: ; InitVar, IsType, IsTime, TimePosn, CheckDir, flt_read ; TimeSet, TimeGet, destroyvar, who_am_i, flt_string ; smei_filepath ; PROCEDURE: ; MODIFICATION HISTORY: ; JUL-2004, Paul Hick (UCSD/CASS) ; MAR-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ; Introduced timeposn call to extract time from frame ;- source = 'SMEIDB?' InitVar, checkdrives, 1 ; Initialize common block IF checkdrives THEN BEGIN CASE flt_read(filepath(root=who_am_i(/dir), 'smei_drives.txt'), sdat, error=error, silent=2) OF 0: BEGIN destroyvar, checkdrives, sdat message, error END 1: sdat = round(sdat) ENDCASE checkdrives = 0 ; Check for smei_drives.txt only once ENDIF CASE 1 OF IsType(tf, /generic_int ): drv = tf IsTime(tf ): drv = fix( flt_string( smei_filepath( tf, /base) ) ) IsType(tf, /string ): drv = fix( flt_string( smei_filepath( timeposn(tf,/extract), /base) ) ) ELSE : drv = [1,2,3,4] ENDCASE sts = 1 FOR i=0,n_elements(drv)-1 DO BEGIN base = getenv('SMEIDB'+strcompress(drv[i],/rem)) idrv = where( sdat[0,*] EQ drv[i] ) tdir = TimeGet(format='YEAR_DOY', TimeSet(yr=sdat[1,idrv],doy=sdat[2,idrv])) tdir = filepath(root=base,tdir) IF NOT CheckDir(tdir) THEN BEGIN sts = sts AND 0 message, /info, base+' not accessible' ENDIF ENDFOR RETURN, sts & END