C+ C NAME: C writegoodsourcegv.f C PURPOSE: C Write the velocity and g-level values used in the tomography into files (bad sources are flagged bad) C This program only works if NLV = LNG and N_ING = N_INV C CALLING SEQUENCE: C call writegoodsourcegv(istation,NLMAXV,cvgfiles,SRCGV,NBSV,NSBG,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, 0 C NLV integer number of sources C C OUTPUTS: C FUNCTIONS/SUBROUTINES: C- subroutine writegoodsourcegv(istation,NLMAXV,cvgfiles,SRCGV,NBSV,NBSG,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 velocity source? integer NBSG (NLMAXV) ! Is this a good or bad g-level source? print *, 'Into write good sources gv' cv = 'e' clstcvgfile = ' ' BADVOBSU = -999.0 IBADVOBSN = -999 IBADVOBSO = -9999 BADGOBSN = 0.00000 BADDOBSNIN = -.99999 BADGOBSO = -99.999 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).eq.0) write(SRCGVU(23:31),'(F9.1)') BADVOBSU ! Bad UCSD velocities, no UCSD g-levels write (14,'(A)') SRCGVN end if if(istation.eq.1) then ! Nagoya velocities SRCGVN = SRCGV(I) if(NBSV(I).eq.0) write(SRCGVN(50:54),'(I5)') IBADVOBSN ! Bad Nagoya velocities if(NBSG(I).eq.0.and.I.le.NLV) write(SRCGVN(59:66),'(F8.5)') BADGOBSN ! Bad Nagoya g-levels if(NBSG(I).eq.0.and.I.gt.NLV) write(SRCGVN(59:66),'(F8.5)') BADDOBSNIN ! Bad in-situ density write (14,'(A)') SRCGVN end if if(istation.eq.2) then ! Ooty velocities SRCGVO = SRCGV(I) if(NBSV(I).eq.0) write(SRCGVO(81:85),'(I5)') IBADVOBSO ! Bad Ooty velocities if(NBSG(I).eq.0) write(SRCGVO(99:105),'(F7.3)') BADGOBSO ! Bad Ooty g-levels if(NBSG(I).eq.0.and.I.gt.NLV) write(SRCGVO(99:105),'(F7.3)') BADGOBSO ! Bad in-situ density write (14,'(A)') SRCGVO end if end do close (14) return end