C+ C NAME: C Peep C PURPOSE: C Reads and displays information about several types of files: C Helios data files, SMEI camera images (*.nic), compressed files (*.ice). C CATEGORY: C I/O C CALLING SEQUENCE: program peep C INPUTS: C file command line argument: name of file C -nic identifies file as a SMEI camera file C -ice identifies file as a compressed SMEI camera file C -hos identifies file as Helios photometer file C -wso identifies file as WSO magnetic field map C CALLS: C ForeignArg, iHOSInfo, bReadNic, ice_read, itrim, LocFirst, Say C AskChar, iGetFileSpec, iSetFileSpec, lowercase, Str2Str, Int2Str C BRead_WSO, ArrI4GetMinMax, ArrR4GetMinMax, NicHdr C INCLUDE: include 'dirspec.h' include 'openfile.h' include 'filparts.h' include 'smei_frm_hdr.h' include 'smei_frm_layout.h' C PROCEDURE: C If no file name is specified on the command line then a prompt for a C file name will follow. C C In Windows a file type can be defined to run when a .nic or .ice file C is double-clicked in Explorer: C - In Explorer go to View/Options/File Type; select New Type C - In 'Descripton of Type' specify: SMEI CCD image C - In 'Associated Extension' specify: .nic C - Below the 'Actions' box, click New. C - In 'Action' specify: open C - In 'Application to perform action' specify: D:\soft\exe\win\peep.exe %1 C - Click OK. C MODIFICATION HISTORY: C MAY-2000, Paul Hick (UCSD/CASS) C JAN-2003, Paul Hick (UCSD/CASS) C Added -ice and -nic command line arguments C APR-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C Added capability to read WSO magnetic field files C- parameter (N = 1000000) character cFile* 120 character cArg * 50 character cInfo*1000 integer CR /13/ integer LF /10/ integer A(N) integer B(N) real AR(N) equivalence (A,AR) logical bReadNic logical bOK logical bHos logical bNic logical bIce logical bWSO logical bFts logical smei_frm_read character cSay * 4 /'peep'/ character cType* 10 character cStr *200 character cVers*8 integer Str2Str integer Flt2Str integer Time2Str integer BRead_WSO integer nDim(10) integer Lst(3,11) double precision hdr(SMEI__HDR_N) integer TT (2) i = 1 cFile = 'quiet' call ForeignArg(' ', i, cFile, cArg) if (LocFirst(cSwitch//'help',cArg) .ne. 0) then call Say(cSay,'S','usage', cSay//' file1#'// & cSay//' '//cSwitch//'help]') call Say(cSay,'S','Stop','exit') end if if (i .eq. 0) call AskChar('File name$file', cFile) iAct = OPN__TRYINPUT+OPN__NOPARSE+OPN__ONEPASS i = iSetFileSpec(cFile) if (iGetFileSpec(FIL__NAME, FIL__NAME, cStr) .eq. 0) & call Say(cSay,'E','no', 'filename specified') i = iGetFileSpec(FIL__TYPE, FIL__TYPE, cType) call lowercase(cType) call lowercase(cArg) bNic = LocFirst(cSwitch//'nic',cArg) .ne. 0 .or. cType .eq. '.nic' .or. cType .eq. '.nic.gz' bIce = LocFirst(cSwitch//'ice',cArg) .ne. 0 .or. cType .eq. '.ice' bHos = LocFirst(cSwitch//'hos',cArg) .ne. 0 bWSO = LocFirst(cSwitch//'wso',cArg) .ne. 0 bFts = LocFirst(cSwitch//'fts',cArg) .ne. 0 .or. cType .eq. '.fts' .or. cType .eq. '.fts.gz' if (bNic) then bOK = bReadNic(iAct, cFile, N, nDim(1), nDim(2), nB, AR, cInfo) if (cInfo(:3) .eq. 'buf') then call NicHdr(1,hdr,cInfo(4:)) nD = 2 TT(1) = nint( hdr( SMEI__HDR_TIME ) ) TT(2) = nint( hdr( SMEI__HDR_TIME+1) ) i = 0 i = i+Str2Str('SMEI frame:',cInfo(i+1:))+1 i = i+Time2Str('YYYY:DOY:hh:mm:ss', TT, cInfo(i+1:))+1 i = i+Str2Str( 'Camera', cInfo(i+1:) )+1 i = i+Int2Str( nint( hdr(SMEI__HDR_CAMERA ) ),cInfo(i+1:))+1 i = i+Str2Str('T=', cInfo(i+1:))+1 i = i+Flt2Str( sngl( hdr(SMEI__HDR_CCD_TEMP) ),3,cInfo(i+1:)) end if else if (bIce) then nDim(1) = N bOK = ice_read(iAct, cFile, nDim(1), AR, N, B, cInfo, cVers) .eq. 1 nD = 1 else if (bHos) then iR = iHOSInfo(iAct,cFile,iRecl,iSc,iYr,TBeg,TEnd,kPCF,Lst) bOK = .FALSE. else if (bWSO) then bOK = BRead_WSO(cFile, N, AR, nDim(1), nDim(2)) .eq. 1 nD = 2 cInfo = ' ' else if (bFts) then bOK = smei_frm_read(iAct, cFile, N, nDim(1), nDim(2), nB, AR, hdr, headroom) if (bOK) then nD = 2 TT(1) = nint( hdr( SMEI__HDR_TIME ) ) TT(2) = nint( hdr( SMEI__HDR_TIME+1) ) i = 0 i = i+Str2Str('SMEI frame:',cInfo(i+1:))+1 i = i+Time2Str('YYYY:DOY:hh:mm:ss', TT, cInfo(i+1:))+1 i = i+Str2Str( 'Camera', cInfo(i+1:) )+1 i = i+Int2Str( nint( hdr(SMEI__HDR_CAMERA ) ),cInfo(i+1:))+1 i = i+Str2Str('T=', cInfo(i+1:))+1 i = i+Flt2Str( sngl( hdr(SMEI__HDR_CCD_TEMP) ),3,cInfo(i+1:)) bNic = .TRUE. else call Say(cSay,'E','not','implemented yet') end if else iR = iHOSInfo(iAct,cFile,iRecl,iSc,iYr,TBeg,TEnd,kPCF,Lst) if (iR .eq. 0) call Say(cSay,'W','Type','unrecognized file type') bOK = .FALSE. end if if (bOK) then i = 0 i = i+Str2Str('size:' , cStr(i+1:))+1 i = i+Int2Str(nDim(1) , cStr(i+1:)) iA = nDim(1) do j=2,nD i = i+Str2Str('x' , cStr(i+1:)) i = i+Int2Str(nDim(j) , cStr(i+1:)) iA = iA*nDim(j) end do if (bWSO .or. bNic) then call ArrR4GetMinMax(-iA, AR, Amin, Amax) i = i+Str2Str('; min =' , cStr(i+1:))+1 i = i+Flt2Str(Amin , 3, cStr(i+1:))+1 i = i+Str2Str('; max =' , cStr(i+1:))+1 i = i+Flt2Str(Amax , 3, cStr(i+1:)) else call ArrI4GetMinMax(iA, A, iAmin, iAmax) i = i+Str2Str('; min =' , cStr(i+1:))+1 i = i+Int2Str(iAmin , cStr(i+1:))+1 i = i+Str2Str('; max =' , cStr(i+1:))+1 i = i+Int2Str(iAmax , cStr(i+1:)) end if call Say(cSay,'I','Array','.#.#'//cStr) i1 = 0 j = itrim(cInfo) if (j .eq. 0) call Say(cSay,'I','Trailer','absent') do while (i1 .lt. j) i2 = LocFirst(char(CR)//char(LF), cInfo(i1+1:j)) if (i2 .eq. 0) i2 = j-i1+1 if (i2 .le. 1) then write (*,'(1X,A)') ' ' else write (*,'(1X,A)') cInfo(i1+1:i1+i2-1) end if i1 = i1+i2-1+2 end do end if write (*,'(1X,A)') ' ' call Say(cSay,'I','Stop','end program') end