c John Belcher 12/4/2022:q! c subroutine vgrtrd(ANStmp,JTB,JDATA,JNE,LSTAT,JTLMOD,JCLK,IEOD) c c Routine to read Voyager mission tapes (the converted ascii version) c The following parameters are returned: c real: ANS(150): Answer array filled for L and M modes only. Only the c first 12 elements are filled. The elements are: c ANS(1) = Proton density in #/cc [ANS(38)] c ANS(2) = VR Proton velocity component in km/s [ANS(99)] c ANS(3) = VT Proton velocity component in km/s [ANS(100)] c ANS(4) = VN Proton velocity component in km/s [ANS(101)] c ANS(5) = Thermal width, moment in km/s [(ANS(34)+ANS(35)+ANS(36))/3] c The average of the A,B and C cup moments. c ANS(6) = Thermal width, fit in km/s Wf=(Wa + Wb + Wc) / 3 where c Wa = sqrt((WPER^2*(1-B.Na^2))+(WPAR^2*(B.Na^2))) c Likewise for Wb and Wc. c WPER = ANS(69); WPAR = ANS(68); B.N{a,b,c} are the directional c cosines between B and the cup normals [ANS(130,131,132)] c ANS(7) = Alpha density in #/cc, moment [ANS(117)] c ANS(8) = Alpha density in #/cc, fit [ANS(59)] c ANS(9) = BR magnetic field component in gammas [ANS(96)] c ANS(10)= BT magnetic field component in gammas [ANS(97)] c ANS(11)= BN magnetic field component in gammas [ANS(98)] c ANS(12)= Radial distance from Sun in AU c int*2: JTB(6): Time of the spectra set read with elements: c JTB(1) = Year in two digit form (Year = year - 1900) c JTB(2) = Day (if day > 255 then day = day - 256 and hour = hour + 100) c JTB(3) = Hour (if day > 255 then hour = hour + 100) c JTB(4) = Minutes c JTB(5) = Seconds c JTB(6) = mSeconds / 4 c int*2: JDATA(512): Digital currents in channels. 64 elements are filled for c L mode, 512 for M, and 16 for E1 and E2. Missing channel c currents are filled with -1's. c int*2: JNE: The total number of channels appropriate for the mode: 64 for L c 512 for M, 16 for E1 and E2. c int*4: LSTAT: Status word. Only one byte of the status word is stored on a c mission tape. It is copied twice at the bottom 2 bytes of c LSTAT. The upper half word is set to be 0. c int*2: JTLMOD: Mode type: 1 - L; 2 - M; 3 - E1; 4 - E2 c int*2: JCLK: Cup integration time index: 1 - 30 ms; 2 - 210 ms; 3 - 930 ms c int*4: IEOD: Error flag: 0 - ok; -1 - read 0 bytes, end of file; c -2 - read error from twait in bat.c c c c integer iyr,idoy,ihr,imin,iclk,istata,icomm,idatan,itlmod integer iengdn,modtal,mindex,modtlm character*4 ikinds real ttmp, sec, anstmp(12) INTEGER*2 JTB(6),JDATA(512),JNE,JTLMOD,JCLK integer ieod,lstat, dumlst character*1 cdl(2) data istart/0/ equivalence (dumlst,cdl(1)) common ikinds,mindex c c ncur will be the # of words of digital current (# of digital current data / 4) c n4 will be just 4*ncur c integer i,j,k,ncur,n4 c c buf will be used to read the data into c real buf(146) c c All the equivalencing is done in order to be able to read the one byte data c on the mission tape and put it into the appropriate variable type. c integer*4 i4,ibuf(146) integer*2 ihbuf(292), i2(2) character*1 i1(4), cbuf( 584) equivalence (ihbuf(1),buf(1)),(i4,i2(1)),(i1(1),i2(1)) equivalence (ibuf(1),buf(1)), ( cbuf(1), ibuf(1)) integer*2 i216(532) character*1 i1216(2,532) equivalence (i216(1),i1216(1,1)) c c jnea stores the total # of chennels for each possible mode c integer*4 jnea(4) c c ikinda stores the telemetry mode strings c character*4 ikinda(16) c c unit stores the environment variable name of the unit c character*4 unit c c llast is logical variable for end of tape check c logical*4 llast data unit /"ft32"/ data jnea /64, 512, 16, 16/ data ikinda /"GS-3", "CR-1", "CR-2", "CR-3", "CR-4", "CR5A", 1 "CR6A", "CR6B", "CR5B", "CR7S", "CR7L", "GS5S", "GS5L", 2 3*"****"/ c=========================================================================== c BEGIN EXECUTION c 5555 continue ieod = 0 read(32,1099,end=2000) jtb,mindex,modtlm,lstat,jne,jtlmod,jclk c Put the corresponding telemetry mode string into ikinds c ikinds = ikinda(modtlm+1) c write(6,1099) jtb 1099 format(8i5,z9,3I5) read(32,1199,end=2000) anstmp 1199 format(12e12.5) if(jtlmod.gt.2) n5 = 16 if(jtlmod.le.2) n5 = 4*jne read(32,1092,end=2000) (jdata(k),k=1,n5) 1092 format(16i4) 1098 format(6i5) c write(6,2098) (jdata(i),i=1,512) 2098 format(16i5) return c c END OF ROUTINE c=========================================================== 2000 continue ieod = 1 return end