C+ C NAME: C program readsources_used C PURPOSE: C Write the velocity and g-level sources used in the tomography into a file that gives the source and its RA and Dec C C CALLING SEQUENCE: C call writegsource_used(istation,NLMAXV,cvgfiles,SRCGV,NLV) 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 NLV integer number of sources C C OUTPUTS: C FUNCTIONS/SUBROUTINES: C- program readsources_used parameter (NLMAX = 10000) character cfilen*11 /'nagoya.????'/ character SRCGV(NLMAX)*115 character cvgfiles(NLMAX)*11 iyr = 2013 call AskI4('Year of the data?',iyr) istation = 1 call AskI4('IPS Station 0=UCSD, 1=Nagoya, 2=Ooty?',istation) if(istation.eq.1) then ! nagoya write(cfilen(8:11),'(I4)') iyr print *, cfilen open (13, file=cFilen,status='old',recl=120,access='sequential',form='formatted',iostat=iReadnagoya) if(iReadnagoya.ne.0) then print *, 'There are no nagoya files for this year.' stop end if NL = 1 do I=1,NLMAX read (13,'(A115)',iostat=iReadnagoya) SRCGV(NL) if(iReadnagoya.eq.0) then cvgfiles(NL) = cFilen C print *, SRCGV(NL) NL = NL + 1 end if end do NL = NL - 1 call writesources_used(istation,NLMAX,cvgfiles,SRCGV,NL) end if stop end C**************************************************************************************************** subroutine writesources_used(istation,NLMAX,cvgfiles,SRCGV,NL) integer NSRCVGI (NLMAX) character cvgfiles (NLMAX)*11 character SRCGV (NLMAX)*115 character cvgfile*11 character cvgucsd*16 /'ucsdsources.????'/ character cvgnagoya*18 /'nagoyasources.????'/ character cvgooty*16 /'ootysources.????'/ character SRCGVU*115 ! UCSD character SRCGVN*115 ! Nagoya character SRCGVO*105 ! Ooty character SRCGVI (NLMAX)*115 ! Source output character source*8 character sourcei*8,sourceii*8 character ra*8 character sd1*1 /' '/ character d1*2 character sd2*1 /' '/ character d2*2 character sd3*1 /' '/ character d3*2 character freq*3 /'327'/ print *, 'Into writesources_used, istation =',istation,NL cvgfile = cvgfiles(1) if(NL.le.0) then print *, 'There are no IPS sources used in the tomography.' return end if do I=1,NL NSRCVGI(I) = 0 end do if(istation.eq.1) then do I=1,NL read (SRCGV(I),'(A8)') sourcei do II=I+1,NL read (SRCGV(II),'(A8)') sourceii if(sourcei.eq.sourceii.and.NSRCVGI(II).ne.1) then NSRCVGI(II) = 1 end if end do end do III = 0 do I=1,NL if(NSRCVGI(I).ne.1) then III = III+1 SRCGVI(III) = SRCGV(I) end if end do print *, ' ' print *, 'Number of sources found in the year = ', III print *, ' ' read (cvgfile,'(7X,I4)') iyr ! read and place the year in the file name write (cvgnagoya(15:18),'(I4)') iyr open (14,file=cvgnagoya,status='new',recl=115,access='sequential',form='formatted') do I=1,III SRCGVN = SRCGVI(I) read (SRCGVN,'(A8)') source read (SRCGVN,'(70X,A8)') ra read (SRCGVN,'(79X,A1)') sd1 read (SRCGVN,'(80X,A2)') d1 read (SRCGVN,'(83X,A2)') d2 read (SRCGVN,'(86X,A2)') d3 sd2 = ' ' sd3 = ' ' if(d1.eq.'00'.and.sd1.eq.'-') then sd1 = ' ' sd2 = '-' end if if(d2.eq.'00'.and.sd2.eq.'-') then sd2 = ' ' sd3 = '-' end if if(sd1.ne.'-'.and.sd2.ne.'-'.and.sd3.ne.'-') then ! The declination is positive sd1 = '+' sd2 = ' ' sd3 = ' ' if(d1.eq.'00'.and.sd1.eq.'+') then sd1 = ' ' sd2 = '+' end if if(d2.eq.'00'.and.sd2.eq.'+') then sd2 = ' ' sd3 = '+' end if end if write (* ,'(A8,1X,A8,1X,A1,A2,A1,A2,A1,A2,8X,A3)') source,ra,sd1,d1,sd2,d2,sd3,d3,freq write (14,'(A8,1X,A8,1X,A1,A2,A1,A2,A1,A2,8X,A3)') source,ra,sd1,d1,sd2,d2,sd3,d3,freq end do close (14) else print *, 'UCSD and Ooty used sources files not able to be produced yet.' end if return end