C+ C NAME: C writegoodsourcev.f C PURPOSE: C Write the velocity and g-level values used in the tomography into files (bad sources are flagged bad) C CALLING SEQUENCE: C call writegoodsourcev(istation,NLMAXV,cvgfiles,SRCGV,NBSV,NLV,N_IN) C INPUTS: C istation 0 - UCSD, 1 - Nagoya, 2 - Ooty C NLMAXV Maximum number of sources C cvgfiles(NLV+N_IN) character*9 vfile name to write out (i.e., ooty.2004) C SRCGV(NLV+N_IN) character*115 all the file values C NBSV(NLV+N_IN) integer good or bad source, if good 1, if bad, < 1 C NLV integer number of sources C C OUTPUTS: C FUNCTIONS/SUBROUTINES: C- subroutine writegoodsourcev(istation,NLMAXV,cvgfiles,SRCGV,NBSV,NLV,N_IN) character cvgfiles (NLMAXV)*11 character SRCGV (NLMAXV)*115 character clstcvgfile*11 character cvgfil*11 character SRCGVU*115 ! UCSD character SRCGVN*66 ! Nagoya character SRCGVO*105 ! Ooty character cv*1 integer NBSV (NLMAXV) ! Is this a good or bad source? print *, 'Into write good sources V' cv = 'v' clstcvgfile = ' ' BADVOBSU = -999.0 IBADVOBSN = -999 IBADVOBSO = -9999 do I=1,NLV+N_IN C print *, I, istation, cvgfiles(I) C if(clstcvgfile .ne. cvgfiles(I)) then if(I.eq.1.and.(NLV+N_IN).gt.0) then close (14) cvgfil = cvgfiles(I) write (cvgfil(2:2),'(A)') cv ! For velocity files to distinguish them if(istation.eq.0) open (14,file=cvgfil,status='new',recl=115,access='sequential',form='formatted') if(istation.eq.1) open (14,file=cvgfil,status='new',recl=66, access='sequential',form='formatted') if(istation.eq.2) open (14,file=cvgfil,status='new',recl=105,access='sequential',form='formatted') clstcvgfile = cvgfiles(I) else if((NLV+N_IN).le.0) return end if if(istation.eq.0) then ! UCSD velocities SRCGVU = SRCGV(I) if(NBSV(I).le.0) write(SRCGVU(23:31),'(F9.1)') BADVOBSU ! Bad UCSD velocities write (14,'(A)') SRCGVN end if if(istation.eq.1) then ! Nagoya velocities SRCGVN = SRCGV(I) if(NBSV(I).le.0) write(SRCGVN(50:54),'(I5)') IBADVOBSN ! Bad Nagoya velocities write (14,'(A)') SRCGVN end if if(istation.eq.2) then ! Ooty velocities SRCGVO = SRCGV(I) if(NBSV(I).le.0) write(SRCGVO(81:85),'(I5)') IBADVOBSO ! Bad Ooty velocities write (14,'(A)') SRCGVO end if end do close (14) return end