C+ C NAME: C smei_frm_getfirst C PURPOSE: C (internal use by smei_frm_get) C CALLING SEQUENCE: logical function smei_frm_getfirst(iFind,cPath,TTime,mode,cFrmSpec) C INPUTS: C iFind integer 1 for new search C 0 to continue search C (passed to iSearch) C cPath*(*) character directory is SMEI data base where C data for current doy are located. C TTime(2) integer test time C mode integer mode number (0,1,2) C OUTPUTS: C smei_frm_getfirst C logical .TRUE. if a frame is found with the mode C less than requested or if the mode is OK C but T < TTime C .FALSE. if no frame is found, or if a frame C is found with a mode larger than requested C (cFrmSpec is set to blank string). C .FALSE. if a frame is found with the right mode C and T >= TTime. cFrmSpec contains the C fully-qualified file name C cFrmSpec*(*) character Fully qualified file name of SMEI frame C or blank string C INCLUDE: include 'filparts.h' C CALLS: C iFilePath, iSearch, iSetFileSpec, iGetFileSpec, smei_Time2Split C Time2Differ, bOSFindClose C PROCEDURE: C smei_frm_get calls this routine in a while loop that terminates if C .FALSE. is returned. On a .FALSE. return, cFrmSpec contains a filename C only if it has the right mode, and T >= TTime. C MODIFICATION HISTORY: C MAR-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C- integer iFind character cPath*(*) integer TTime(2) integer mode character cFrmSpec*(*) integer Time2Differ character cStr*(FIL__LENGTH) integer TFrm(2) character cMode(0:2)*1 /'0','1','2'/ logical bTmp logical bOSFindClose if (iFind .eq. 1) then ! New search ! The iSearch call puts picks up all frames in the directory. ! The frames are ordered in three groups: first all mode 0 ! frames chronological, then mode 1, then mode 2. i = iFilePath(cPath,0,' ','*.*',cStr) smei_frm_getfirst = iSearch(1,cStr,cFrmSpec) .eq. 1 else ! Continue search smei_frm_getfirst = iSearch(0,' ' ,cFrmSpec) .eq. 1 end if if (smei_frm_getfirst) then ! If frame found ... i = iSetFileSpec(cFrmSpec) i = iGetFileSpec(FIL__NAME,FIL__NAME,cStr) smei_frm_getfirst = cStr(4:4) .le. cMode(mode) if (smei_frm_getfirst) then ! When looking for the first good frame (with the right ! mode and later then TTime), first check the mode. Return ! .TRUE. if the mode is too low smei_frm_getfirst = cStr(4:4) .lt. cMode(mode) if (.not. smei_frm_getfirst) then! Right mode .. ! It the time is earlier than TTime return .TRUE. call smei_Time2Split(0, cStr, TFrm) smei_frm_getfirst = Time2Differ(TFrm,TTime) .lt. 0 end if else ! Mode is too high cFrmSpec = ' ' bTmp = bOSFindClose() end if else ! No more files cFrmSpec = ' ' ! NOT redundant !!!! bTmp = bOSFindClose() ! (takes care of parse errors) end if return end