diff options
| author | Christoph Berg <myon@debian.org> | 2026-10-09 14:12:35 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2026-10-09 14:12:35 +0200 |
| commit | ffc62c792c9a5196cb4ce7a353287dfe20db6524 (patch) | |
| tree | 1269efa852935b183daae4bb33a58d1b4d2ffb53 /lib/jt65_host_support.f90 | |
| parent | 059831534c7e884f0a607ed86b582fd00d821731 (diff) | |
New upstream version 3.3.0~beta1+dfsgupstream/3.3.0_beta1+dfsg
Diffstat (limited to 'lib/jt65_host_support.f90')
| -rw-r--r-- | lib/jt65_host_support.f90 | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/lib/jt65_host_support.f90 b/lib/jt65_host_support.f90 new file mode 100644 index 00000000..6abd3b74 --- /dev/null +++ b/lib/jt65_host_support.f90 @@ -0,0 +1,61 @@ +module jt65_host_support + use jt65_decode, only: jt65_decoder,jt65_average_entry + use prog_args, only: data_dir + implicit none + private + public :: load_jt65_calls,write_jt65_averages + +contains + + subroutine load_jt65_calls(calls,grids) + character(len=12), allocatable, intent(out) :: calls(:) + character(len=4), allocatable, intent(out) :: grids(:) + character(len=12), allocatable :: call_buffer(:) + character(len=4), allocatable :: grid_buffer(:) + character(len=180) :: line + integer :: unit,ios,count,first,second + + allocate(call_buffer(10000),grid_buffer(10000)) + count=0 + open(newunit=unit,file=trim(data_dir)//'/CALL3.TXT',status='old',action='read',iostat=ios) + if(ios==0) then + do while(count<size(call_buffer)) + read(unit,'(a)',iostat=ios) line + if(ios/=0) exit + if(line(:4)=='ZZZZ'.or.line(:2)=='//') cycle + first=index(line,',') + if(first<4) cycle + second=index(line(first+1:),',') + if(second<5) cycle + count=count+1 + call_buffer(count)=line(:first-1) + grid_buffer(count)=line(first+1:first+4) + enddo + close(unit) + endif + calls=call_buffer(:count) + grids=grid_buffer(:count) + end subroutine load_jt65_calls + + subroutine write_jt65_averages(decoder,unit) + class(jt65_decoder), intent(inout) :: decoder + integer, intent(in) :: unit + type(jt65_average_entry) :: entries(64) + integer :: count,i + character :: used,polarity + + call decoder%get_averages(entries,count) + rewind(unit) + do i=1,count + used='.' + if(entries(i)%used) used='$' + polarity=' ' + if(entries(i)%polarity<0) polarity='#' + if(entries(i)%polarity>0) polarity='*' + write(unit,'(a1,i5.4,f6.1,f6.2,i6,1x,a1)') used,entries(i)%utc, & + entries(i)%sync,entries(i)%dt,entries(i)%frequency,polarity + enddo + endfile(unit) + flush(unit) + end subroutine write_jt65_averages +end module jt65_host_support |
