C+ C NAME: C WriteLOSY C PURPOSE: C Writes a summary file of observed and modeled velocities used C in the tomographic reconstruction. C CALLING SEQUENCE: subroutine WriteLOSY(cOut,cWildVIPS,NL,IYRF,IREC,XOBS,XMDL0,XMDL,XE,NGOOD) C INPUTS: C cOut character*(*) Output file name C cWildVIPS character*(*) File wildcard identifying the type C of IPS data used (Nagoya or Ooty) C NL integer # of IPS velocity los observations C C IYRF (NL) integer year of observations (identifies the data file C from which the original source data were read C IREC (NL) integer record number on original data file C (IYRF and IREC are output from href=ReadVIPS=) C XOBS (NL) real Observed velocities (should match the entry C from the original record) C XMDL0(NL) real Model velocities after 1st iteration ?? C XMDL (NL) real Model velocities C XE (NL) real source elongations (??) C NGOOD(NL) integer 0: bad IPS source; 1: good IPS source C OUTPUTS: C For each of the NL los observations the original record is retrieved from C the appropriate data file. Observed velocity, model velocity, difference C between observed and modeled velocity, and the 'bad source' flag are appended C to the record. The extended records are written to a file 'cOut' C CALLS: C iFreeLun, Int2Str, bOpenFile, itrim C INCLUDE: include 'dirspec.h' include 'openfile.h' C RESTRICTIONS: C Works only when original data are stored in yearly files (e.g. C Nagoya and Ooty IPS data). C MODIFICATION HISTORY: C NOV-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C- character cOut*(*) character cWildVIPS*(*) integer NL integer IYRF (*) integer IREC (*) real XOBS (*) real XMDL0(*) real XMDL (*) real XE (*) integer NGOOD(*) character cFile*512 character cStr1*120 character cStr2*120 character cAst(0:1) /'*',' '/ logical bOpen logical bOpenFile logical bWrite parameter (nYrLen = 4) save iOut bWrite = .TRUE. cFile = cWildVIPS iFile = index(cFile,cWildChar(:nYrLen)) do I=1,NL if (I .eq. 1) then bOpen = .FALSE. else if (IYRF(I) .ne. IYRF(I-1)) then iUr = iFreeLun(iUr) bOpen = .FALSE. end if if (.not. bOpen) then IR = Int2Str(IYRF(I),cFile(iFile:iFile+nYrLen-1)) bOpen = bOpenFile(OPN__REOPEN+OPN__TEXT+OPN__READONLY,iUr,cFile,iRecl) IR = 0 end if IR = IR+1 read (iUr,'(A)') cStr1 do while (IR .ne. IREC(I)) read (iUr,'(A)') cStr1 IR = IR+1 end do write (cStr2,'(4F10.4,A)') XOBS(I),XMDL0(I),XMDL(I),XE(I),cAst(NGOOD(I)) cStr2(itrim(cStr2)+NGOOD(I)+2:) = cStr1 if (bWrite) then ! Open output file iOut = itrim(cStr2) ! Record length output file if (.not. bOpenFile(OPN__TRYINPUT+OPN__TEXT+OPN__UNKNOWN+OPN__ONEPASS,iUw,cOut,iOut)) then if (bOpen) iUr = iFreeLun(iUr) return end if bWrite = .FALSE. end if write (iUw,'(A)') cStr2(:iOut) end do if (bOpen) iUr = iFreeLun(iUr) iUw = iFreeLun(iUw) return end