File: psk_parse.f90

package info (click to toggle)
wsjtx 2.7.0%2Brepack-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 70,440 kB
  • sloc: cpp: 75,379; f90: 46,460; python: 27,241; ansic: 13,367; fortran: 2,382; makefile: 197; sh: 133
file content (108 lines) | stat: -rwxr-xr-x 3,171 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
program psk_parse

  character line*256,callsign*12,callsign0*12,progname*30
  integer nc(6),ntot(6),nsingle(6)
  logical zap
  data callsign0/'            '/

  open(10,file='jt65-2',status='old')
  nc=0
  ntot=0
  ncalls=0
  nsingle=0
  zap=.false.

  do iline=1,9999999
     read(10,'(a256)',end=900) line
     n=len(trim(line))
     i1=0
     i2=0
     i3=0
     do i=1,n
        if(ichar(line(i:i)).eq.9) then
           if(i1.eq.0) then
              i1=i
              cycle
           endif
           if(i2.eq.0) then
              i2=i
              cycle
           endif
           if(i3.eq.0) then
              i3=i
              exit
           endif
        endif
     enddo
     callsign=line(1:i1-1)

     if(zap) then
        if(callsign(1:1).ge.'0' .and. callsign(1:1).le.'9' .and.               &
           callsign(2:2).ge.'0' .and. callsign(2:2).le.'9' .and.               &
           callsign(3:3).ge.'0' .and. callsign(3:3).le.'9') cycle

        if(callsign(1:1).ge.'A' .and. callsign(1:1).le.'Z' .and.               &
           callsign(2:2).ge.'A' .and. callsign(2:2).le.'Z' .and.               &
           callsign(3:3).ge.'A' .and. callsign(3:3).le.'Z' .and.               &
           callsign(4:4).ge.'A' .and. callsign(4:4).le.'Z') cycle

        if(callsign(1:1).eq.'N' .and.                                        &
           callsign(2:2).ge.'0' .and. callsign(2:2).le.'9' .and.               &
           callsign(3:3).ge.'0' .and. callsign(3:3).le.'9') cycle

     endif

     progname=line(i1+1:i2-1)
     do i=1,len(trim(progname))
        if(progname(i:i).eq.' ') progname(i:i)='_'
     enddo
     read(line(i2+1:i3-1),*) ndecodes
     read(line(i3+1:),*) nreporters

     j=6
     if(index(progname,'WSJT-X').gt.0) j=1
     if(index(progname,'HB9HQX').gt.0) j=2
     if(index(progname,'JTDX').gt.0) j=3
     if(index(progname,'Comfort').gt.0) j=4
     if(index(progname,'COMFORT').gt.0) j=4
     if(index(progname,'JT65-HF').gt.0 .and. j.eq.6) j=5

     nctot=sum(nc)
     if(callsign.ne.callsign0 .and. nctot.gt.0) then
        write(13,1000) callsign0,nc,nctot
1000    format(a12,6i8,i10)
        if(nctot.eq.1) nsingle(j)=nsingle(j)+1
        nc=0
        callsign0=callsign
        ncalls=ncalls+1
     endif
     nc(j)=nc(j) + ndecodes
     ntot(j)=ntot(j) + ndecodes
     write(12,1010) iline,callsign,ndecodes,nreporters,progname
1010 format(i8,2x,a12,2x,2i8,2x,a30)
  enddo

900 nctot=sum(nc)
  if(nctot.gt.0) write(13,1000) callsign0,nc,nctot

  write(*,1018) 
1018 format('   Total    WSJT-X  HB9HQX   JTDX  Comfort JT65-HF   Other'/  &
            '----------------------------------------------------------')
  write(*,1019)
1019 format('Spots reported; fraction of total:')
  write(*,1020) sum(ntot),ntot
1020 format(i8,2x,6i8)
  fac=1.0/sum(ntot)
  write(*,1030) 1.0000,fac*ntot
1030 format(f8.4,2x,6f8.4,f10.4)

  write(*,1038)
1038 format(/'Singletons; as fraction of spots by same program')
  write(*,1040) sum(nsingle),nsingle
1040 format(i8,2x,6i8)
  write(*,1030) float(sum(nsingle))/sum(ntot),float(nsingle)/ntot

  write(*,1050) ncalls
1050 format(/'Distinct calls spotted:',i6)

end program psk_parse