C C PROGRAM "cnvrnx3-rnx2" ===== Version 2.0 =================== C C Program for reading a RINEX 3 file and creating a GPS-only copy that C is then converted to Rinex 2. C The result is a version 2 and a version 3 file C with only the GPS data of types: C1, P1, P2, C2, L1, L2, C5, L5, S1, S2 or S5, C if present in the original RINEX 3 file (absent C2, P2, L2 either of L2C C or "heritage L2", blank columns are created for them, for compatibility in C some special cases). C C The line command to launch this program is: C C cnvrnx3-rnx2 rnxv3 i C C Where: "rnxv3" is the 12-character name of the input RINEX 3 file C to be processed; C "i" is a two-character flag signaling the type and number C of output files, and whether the "heritage" C or the L2C phase are to be used. See details below. C C ALL ARGUMENTS MUST BE PRESENT: They have no default values. C C In the code below, "i" is called "icreate". C There are six output options, depending on the value of flag "i": C C i = +0 to save in RINEX 2.11 both L2 phase and L2C phase (as "LC"). C C i = -0 NOT to save in RINEX 2.11 the L2C code and phase.' C A blank column "T2" is created instead of "C2", to symplify the code.' C C i = 30 A GPS-only RINEX 3 version is created. C C i = 1 to output the RINEX 2 GPS-only as a permanent file C (the GPS-only RINEX 3 file is a scratch file). C i = 2 to output both RINEX 2 and 3 GPS-only permanent files. C C i =-1, i = -2 Same as = 1, =2 above, but forcing the use of NOT IN USE C the phase of L2C whenever possible. NOT IN USE C C Both output files names begin with that of the original file, C with ".gps.rnx" or ".gps.rnx3" added at the end, to identify them clearly. C C Doppler data are NOT copied to the output RINEX 2 file. C C SPECIAL HEADER COMMENT RECORDS: C C The header of the RINEX 2 version generated with this program contains a C number of COMMENT records with information complementary to that in the C regular RINEX 2 header records, e.g. a listing the original RINEX 3 C 3-letter-code data types that were converted to the 2-letter ones in the C "# / TYPES OF OBSERV" record. Also clarifying the kind of L2 phase data: C "heritage" or L2C; whether the L2 phase from L2C requires a 1/4 wave C correction or not; etc. C C The user has to select which rinex 3 data types are going to be C copied to the rinex 2 file by "commenting out" the type of all unwanted C rinex 3 data in the header of their file, changing the name of the type C labels first letter to a "T". Example: L1C -> T1C, S1C -> T1C C to deselect L1C, S1C. C This is not necessary for any type of Doppler: all of those are automatically C excluded from the RINEX 2 ouput file. C C THERE HAS TO BE at most only one type of data in the header C for each of basic type groups "C1", "P1" and "L1", C provided the respective phases and codes are truly present C (i.e., with both listed in the header, and their data columns that are not C all blanks. C -- Exception: C2, L2, P2. There should be a column for each of these, even if C it is all blanks; if there is not one in the original Rinex 3, one will be C created automatically by this program in the Rinex 2 version. C C Due to uncertainty with the treatment by receiver manufacturers C of the 1/4 cycle offset between the old and the new civilian L2 phase data, C at least for now, it is safest to choose the "heritage" L2 phase, if C available, and not the L2 of L2C. So this program makes that choice C automatically, unless the user expressly request the use of the L2C phase C through the command line, as explained above. C If there are no P2, L2 heritage data in the RINEX 3 file, then C2 and C the phase of L2C are used instead, automatically (this takes care of two C future situations: when most or all GPS satellites transmit L2C, and when the C heritage signals in L2 are no longer supported). C C I the user choses the option "+0" in the command line, both the "heritage" C L2 phase (as "LC") and the L2C phase are saved in the output RINEX 2.11 file. C C ************** Oscar L. Colombo - V 1.0 January 2012 ************** C ************** Oscar L. Colombo - V 2.0 June 2012 ************** C implicit real*8(a-h,o-z) C character*1 cl2conly,charmin character*2 cicreate character*4 char4 character*7 stat character*12 rnxfilen,rnxfilev3 character*21 rnx2fileout,rnx3fileout character*80 headrec,header(100),rnxhead character*200 typestring character*450 datarecs(30),datarec,recout,record C dimension nprnc2(32) data ihead/1/,inunit/10/,interval/0/,iendheader/0/, .ibad/0/,nl2cprn/0/,nprnc2/32*0/,l2cnot/0/ C write(0,'(" ")') write(0,'(" Program ""CNVRNX3-RNX2"" V1.0")') write(0,'(" for converting RINEX 3 ", ."to RINEX 2")') write(0,'(" Copyright (C) 2012 Oscar L. Colombo.")') write(0,'(" ")') C C WINDOWS (Intel Visual Fortran) ! Comment or uncomment call getarg(1,rnxfilev3,istatus1) ! the following statements call getarg(2,cicreate,istatus2) ! to switch from WINDOWS to UNIX/LINUX 5 continue if(istatus1.gt.12.or.istatus2.ne.2. .or.ibad.eq.1) then C WINDOWS C UNIX/LINUX (Gfortran) C call get_command_argument(1,rnxfilev3,12,istatus1) C call get_command_argument(2,cicreate,2,istatus2) C 5 continue C if(istatus1.ne.0.or.istatus2.ne.0. C .or.ibad.eq.1) then C UNIX/LINUX C UNIX/LINUX (G77) c call getarg(1,rnxfilev3) c call getarg(2,cicreate) c 5 continue c if(ibad.eq.1) then C UNIX/LINUX print*,' ' print*,' ERROR in line command "cnvrnx3-rnx2"' print*,' The correct command is: ' print*,' ' print*,'"cnvrnx3-rnx2 rnxv3 i"' print*,' ' print*,' "rnxv3", = Name of the RINEX file', .' to be converted -- up to 12 characters long.' print*,' ' print*,' "i" = 2-character flag.' print*,' ' print*,' To copy L2 and the phase of L2C if both present:' print*,' i = +0 (and only the RINEX2 file is created) ' print*,' NOT to copy any L2C data, even if they are present:' print*,' i = -0 (and only the RINEX2 file is created) ' print*,' To create a RINEX 3 file with only the GPS data:' print*,' i = 30 ' print*,' To copy the "heritage" L2 phase whenever possible:' print*,' i = +1 if only the RINEX2 file is created;' print*,' i = +2 if both RINEX2 & RINEX3 files are ', .'created.' c print*,' To copy as "L2" the phase of L2C, whenever possible:' c print*,' i = -1 if only the RINEX2 file is created;' c print*,' i = -2 if both RINEX2 & RINEX3 files are ', c .'created.' print*,' ' print*,' The converted RINEX 2.11 file does not include Doppler ' print*,' data.' print*,' ' print*,' NOTE: If more than one type of L1 phase and S/N data is' print*,' present: one of L1(C,Y,M,W,P) and the corresponding ' print*,' S1(C,Y,M,W,P)' print*,' MUST be chosen, deselecting the others by changing' print*,' the first letter in their labels to a "T" ' print*,' in the header of the input Rinex 3 file.' print*,' Example: L1C -> T1C, S1C -> T1C to select L1W, S1W .' print*,' ALSO: one must choose just one S2(C,Y,M,W,P,X,L,S).' print*,' EXCEPT when option "+0" is chosen in the command line.' print*,' With this option, it is OK to select one of S2(Y,M,W,P)' print*,' and one of S2(C,X,L,S).' print*,' ' print*,' Try again.' print*,' ' stop endif read(cicreate,'(a1,i1)') charmin,kicreate if(charmin.ne.'+'.and.charmin.ne.'-'.and.charmin.ne.'3') then ibad = 1 go to 5 endif read(cicreate,'(i2)') icreate if(icreate.eq.30) icreate = 0 rnxfilen = rnxfilev3 if(iabs(icreate).gt.2) then ibad = 1 go to 5 endif C l2cmust = 0 C!!!? if(icreate.lt.0) then print*,' ' print*,' The option chosen does not work properly yet.' print*,' SORRY ' print*,' ' print*,' !!!!!! JOB ABANDONED !!!!!!' print*,' ' stop endif C!!!? if(icreate.lt.0) l2cmust = 1 if(icreate.eq.0) l2cmust = 2 l2conly = 1 nol2c = 1 C!!! c print*,' charmin, icreate ',charmin,icreate C!!! if(charmin.eq.'-'.and.iabs(icreate).eq.0) then l2cnot = 1 l2cmust = 0 endif kikiriki = 0 if(charmin.eq.'3') then l2cnot = 0 l2cmust = 0 l2conly = 0 kikiriki = 1 endif C!!! c print*,' l2cnot, l2conly, l2cmust ',l2cnot,l2conly,l2cmust C!!! C write(rnx3fileout,'(a7,"0",a4,".gps.rnx3")') rnxfilen(1:7), .rnxfilen(9:12) write(rnx2fileout,'(a7,"0",a4,".gps.rnx2")') rnxfilen(1:7), .rnxfilen(9:12) C if(iabs(icreate).eq.1.or.icreate.eq.0) stat = 'scratch' if(iabs(icreate).eq.2.or.charmin.eq.'3') stat = 'unknown' C open(10,file=rnxfilen,form='formatted',status='old',err=10) go to 11 10 continue print*,' ' print*,' Error when trying to open file: ',rnxfilen print*,' File is missing or garbled.' print*,' ' print*,' !!!!! JOB ABANDONED !!!!!' stop 11 continue C if(stat.eq.'scratch') then open(20,form='formatted',status='scratch') elseif(stat.eq.'unknown') then open(20,file=rnx3fileout,form='formatted',status='unknown') endif C nhead = 0 C write(0,'(" Processing input file ",a12)') rnxfilen nrec = 0 C C Copying the header of the input RINEX 3 file to the RINEX 2 version: C kp2 = 0 kc2 = 0 kl2 = 0 klc2= 0 lp2 = 0 lc2 = 0 ll2 = 0 llc2= 0 20 continue if(ihead.eq.1) then nrec = nrec+1 read(10,'(a80)',end=70) headrec C!!! c print*,headrec C!!! if(nrec.eq.1) then if(headrec(61:80).ne.'RINEX VERSION / TYPE') then print*,' ' print*,' File: ',rnxfilen print*,' is not a RINEX file, or else the header is garbled.' print*,' Hint: First record should have "RINEX VERSION / TYPE"' print*,' in columns 61 - 73, but this one does not.' print*,' ' print*,' !!!! JOB ABANDONED !!!!' print*,' ' stop endif if(headrec(6:6).ne.'3') then print*,' File: ',rnxfilen,' is not RINEX V 3' print*,' ' print*,' !!!!! JOB ABANDONED !!!!!!' print*,' ' stop endif headrec(41:52) = 'G ' write(20,'(a80)') headrec write(20,'(a20,"RINEX VERSION OF ORIGINAL FILE",10x,"COMMENT", ." ")') .headrec(1:20) go to 20 endif if(headrec(61:67).eq.'GLONASS') go to 20 cG 7 C1C L1C C1W C2W L2W C2L L2L SYS / # / OBS TYPES if(headrec(1:1).ne.'G'.and.headrec(61:79).eq. .'SYS / # / OBS TYPES') then go to 20 elseif(headrec(1:1).eq.'G'.and.headrec(61:79).eq. .'SYS / # / OBS TYPES'.and.ihead.eq.1) then read(headrec(5:6),'(i2)') ntypes do i = 1,200 typestring(i:i) = ' ' enddo write(20,'(a80)') headrec typestring(1:52) = headrec(8:60) if(ntypes.gt.13) then nrec = nrec+1 read(10,'(a80)',end=70) headrec write(20,'(a80)') headrec typestring(53:104) = headrec(8:60) endif C!!! c print*,ntypes c print*,typestring C!!! ks1 = 0 ks2 = 0 ksl1 = 0 do i = 1,ntypes k1 = 1+4*(i-1) k2 = k1+3 char4 = typestring(k1:k2) if(char4.eq.'C2M '.or.char4.eq.'C2P '.or.char4.eq.'C2W '. .or.char4.eq.'C2Y ') then kp2 = 1 lp2 = 4+(i-1)*16 endif if(char4.eq.'C2L '.or.char4.eq.'C2S '.or.char4.eq.'C2X ') then kc2 = 1 lc2 = 4+(i-1)*16 endif if(char4.eq.'L2L '.or.char4.eq.'L2S '.or.char4.eq.'L2X ') then klc2 = 1 llc2 = 4+(i-1)*16 endif if(char4.eq.'L2M '.or.char4.eq.'L2P '.or.char4.eq.'L2W '. .or.char4.eq.'L2Y ') then kl2 = 1 endif if(char4.eq.'S1C ') ks1 = ks1+1 if(char4.eq.'S1X ') ks1 = ks1+1 if(char4.eq.'S1W ') ks1 = ks1+1 if(char4.eq.'S1P ') ks1 = ks1+1 if(char4.eq.'S1Y ') ks1 = ks1+1 if(char4.eq.'S1M ') ks1 = ks1+1 C if(char4.eq.'S2C ') ks2 = ks2+1 if(char4.eq.'S2X ') ks2 = ks2+1 if(char4.eq.'S2W ') ks2 = ks2+1 if(char4.eq.'S2P ') ks2 = ks2+1 if(char4.eq.'S2Y ') ks2 = ks2+1 if(char4.eq.'S2M ') ks2 = ks2+1 C if(char4.eq.'L1C '.or.char4.eq.'L1W '.or.char4.eq.'L1X '.or. .char4.eq.'L1P '.or.char4.eq.'L1Y ') ksl1 = ksl1+1 C!!! c write(*,'(" ks2, char4 "i1,a4)') ks2,char4 C!!! enddo cc endif if(klc2.eq.1.and.l2cmust.eq.2.and.ks2.eq.2) ks2 = 0 if(kikiriki.eq.0) then if(ks1.gt.1.or.ks2.gt.1.or.ksl1.gt.1) then print*,' ' print*,' More than one s/n "S" column for L1 or L2 data ' print*,' and more than one phase for L1, according to ' print*,' the RINEX 3 file header.' print*,' To convert to RINEX 2,11, only one such column ' print*,' can be present for L1''s phase, only one for the s/n ' print*,' of the pair L1+P1, and one for the s/n of L2+P2.' print*,' Chose one type of L1 phase, or of s/n signal, ' print*,' by changing the first letter in the identifier ' print*,' of the other phase or s/n data types to a "T" ' print*,' in the "SYS / # / OBS TYPES" header record. ' print*,' ' print*,' !!!!!!! JOB ABANDONED !!!!!!!' print*,' ' stop endif endif go to 20 !! endif !! nhead = nhead+1 write(20,'(a80)') headrec 12 continue if(headrec(61:68).eq.'INTERVAL') interval = 1 if(nhead.gt.200.and.iendheader.eq.0) then print*,' ' print*,' The input Rinex 3 file: ',rnxfilen print*,' does not have an END OF HEADER record.' print*,' Insert one manuallly, and run again.' print*,' ' print*,' !!!!!! JOB ABANDONED !!!!!!!' print*,' ' stop endif if(headrec(61:73).eq.'END OF HEADER') then if(interval.eq.0) then print*,' ' print*,' The Rinex 3 file: ',rnxfilen print*,' does not have an INTERVAL record in its header.' print*,' Insert one manuallly, and run again.' print*,' ' print*,' !!!!!! JOB ABANDONED !!!!!!!' print*,' ' stop endif iendheader = 1 ihead = 0 go to 21 endif endif go to 20 21 continue C C Read in all data records, copying the GPS records C to the GPS-only RINEX 3 file. C kprod = kp2*kc2*klc2 nrecs = 0 ngps1 = 1 ntypchars = ntypes*16+3 50 continue nrec = nrec+1 read(10,'(a450)',err=22,end=70) datarec go to 23 22 continue print*,' ' print*,' Error occurred while reading record No. ',nrec+1 print*,' in file ',rnxfilen print*,' ' print*,' !!!!!! JOB ABANDONED !!!!!!' print*,' ' stop 23 continue nrec = nrec+1 if(datarec(1:1).eq.'>') then ! This is the header of a data block. write(rnxhead,'(a80)') datarec c> 2011 08 29 11 00 0.0000000 0 20 read(rnxhead(31:32),'(i2)') iflag if(iflag.gt.1) then ! Copy as they are "event" records and comments. read(rnxhead(34:35),'(i2)') npass do i = 2,npass nrec = nrec+1 read(10,'(a80)',err=22) datarec write(20,'(a80)') datarec enddo go to 50 else nrecs = nrecs+1 read(rnxhead,'(12x,2i3)') ihh,min read(rnxhead(34:35),'(i2)') ndata endif ngps = 0 do i = 1,ndata nrec = nrec+1 read(10,'(a450)',end=70,err=22) datarec if(datarec(1:1).eq.'G') then nrecs = nrecs+1 ! Counting the total number of records with GPS data. ngps = ngps+1 ! Counting the GPS records in this data block. datarecs(ngps) = datarec C C If there are records with both P2 and C2, set flag to "0" C (no L2 phase and carrier swaps in sub. "cnvrnx3to2": C C!!! c print*,' kprod, kp2, kc2, klc2 ',kprod,kp2,kc2,klc2 c print*,' kp2, kc2, lp2, lc2 ',kp2,kc2,lp2,lc2 c if(datarecs(ngps)(lc2:lc2+8).ne.' ') c .datarecs(ngps)(lp2:lp2+8) = ' ' C!!! if(kprod.ne.0) then if(datarecs(ngps)(llc2:llc2+8).ne.' ') then read(datarecs(ngps)(2:3),'(i2)') mmprn mnot = 0 do k = 1,32 if(mmprn.eq.nprnc2(k)) mnot = 1 enddo if(mnot.eq.0) then nl2cprn = nl2cprn+1 nprnc2(nl2cprn) = mmprn endif endif if(datarecs(ngps)(lp2:lp2+8).ne.' '.and. . datarecs(ngps)(lc2:lc2+8).ne.' ') then l2conly = 0 if(datarecs(ngps)(llc2:llc2+8).ne.' ') then nol2c = 0 endif endif endif C endif enddo write(20,'(a33,i2)') rnxhead(1:33),ngps ! Writing the block header C in the GPS-only RINEX 3 file. C C Writing the GPS data records to the GPS-only RINEX 3 file, C each with the minimum number of characters (no trailing blanks): C do i = 1,ngps do k = 1,450 datarec(k:k) = ' ' enddo datarec = datarecs(i) nchars = 0 do k = 450,1,-1 if(datarec(k:k).ne.' ') then nchars = k go to 80 endif enddo 80 continue do im = 1,450 if(im.le.nchars) then record(im:im) = datarec(im:im) elseif(im.le.ntypchars) then record(im:im) = ' ' endif enddo write(20,'(450a1)') (record(ji:ji),ji=1,ntypchars) enddo endif go to 50 70 continue if(nrec.eq.0) then print*,' File: ',rnxfilen,' is empty.' print*,' ' print*,' !!!!!!! JOB ABANDONED !!!!!!!' print*,' ' stop endif 200 continue C C!!! c print*,' nol2c, l2conly, kl2, ',nol2c,l2conly,kl2 C!!! if(nol2c.eq.1) l2conly = 0 ! Do not replace "heritage" L2 Phase C with L2C phase when L2C phase is all blanks or is absent. if(kl2.eq.0) l2conly = 1 ! If there is no "heritage" L2 phase, C replace it with the L2C phase, if possible. C if(l2cmust.eq.1) l2conly = -1 ! Signal to sub. "cnvrnx3to2" that the L2C C phase is to be used whenever the L2C code C is available and there are L2C phase data C in the RINEX 3 file. C if(l2cmust.eq.2.and.klc2.eq.1) l2conly = 2 ! If both the "heritage" L2 phase C and the L2C phase are present along with their C corresponding "S2s" put them in separate columns C in the output RINEX 2.11 file. C if(l2cnot.eq.1) then ! User has set "cicreate = -0", to get a rinex 2 file l2conly = 0 ! with neither LC2 code nor phase in it. endif C C!!! c l2conly = 1 c print*,' klc2, l2cmust, l2conly ',klc2,l2cmust,l2conly C!!! C C Now write an output RINEX 2 file with the information C in the version 3 output file, but only copy data of C1, P2, L1, L2(P2), and C2 C data types, chosen according to the instructions in this program's header. C irnx2out = 30 irnx3out = 20 C if(charmin.ne.'3') then call cnvrnx3to2(rnx3fileout,rnx2fileout,irnx3out,irnx2out, .l2conly,rnxfilen,nprnc2,nl2cprn,l2cnot) endif C write(0,'(" ")') if(iabs(icreate).eq.2.or.(charmin.eq.'3'.and.icreate.eq.0)) then write(0,'(" Output rinex 3.01 file: ",a21," has been created.")') .rnx3fileout endif if(charmin.ne.'3') then write(0,'(" Output rinex 2.11 file: ",a21," has been created.")') .rnx2fileout endif if(icreate.lt.0) then write(0,'(" ")') write(0,'(" All RINEX 2.11 records for IIR-M, II-F satellites, " .)') write(0,'(" or later, have the phase of L2C, at user''s ", ."request.")') endif write(0,'(" ")') write(0,'(" JOB HAS ENDED")') write(0,'(" ")') C stop end C subroutine cnvrnx3to2(rnx3fileout,rnx2fileout,irnx3out,irnx2out, .l2conly,rnxfilen,nprnc2,nl2cprn,l2cnot) C C This subroutine creates a version 2.11 RINEX file from a version 3.01, C ***GPS-only**** file with: C1, P1, L1(C1 or P1), C2(L, S, or X), C P2(P, W, or Y), L2(P, W, or Y). C This file has data from the new civilian type C2, L2 "S", "L", and "X" C signals from the IIR-M, IIF and later satellites, when these are present. C Format of a RINEX 3 data record: (a3,[ntypes]f16.5), where "ntypes" C is the number of data types of interest. C (For RINEX 2 records, the format is: ([ntype]*f16.5).) C C C No L5 data are copied to the output RINEX 2 file. C C The user has to select which rinex 3 data types are going to be C copied to the rinex 2 file by "commenting out" the type of all unwanted C rinex 3 data, in the header of their file, changing the name of the type C to "T1 ", "T2 ". Example: C2M = T2 (3 characters, the last one a blank). C There has to be, at most, only one type of data left unchanged in the header C for each of basic type groups "C1", "P1", "P2", "L1", "L2", and "C2", C and the respective phases and codes have to be truly present (i.e., with both C listed in the header, and data columns that are not all blanks C -- but see also comments at the beginning of the main program. C Due to uncertainty with the treatment by receiver manufacturers C C of the 1/4 cycle offset between the old and the new civilian L2 phase data, C at least for now, it is safest to choose the "heritage" L2 phase, if C available, and not the L2 of L2C. (but see also the comments at beginning C of the main program). C C If the user choses the option "+0" in the command line, both the "heritage" C L2 phase (as "LC") and the L2C phase are saved in the output RINEX 2.11 file. C C C Input variables: C rnx3fileout = string with the name of the input file. C irnx3out = unit number of input file C irnx2out = unit number of output file C l2conly = flag: = 1 if there are satellites with only L2C data; C = 0 if there is "heritage" L2 phase available. C =-1 if there is only L2C phase available from C Block IIR-M, IIF, or only the L2C data is to be copied. C = 2 if there are both L2C and L2 "heritage" phase, C and both are to be copied. C =-2 as in -1, but a RINEX 3 file with only GPS data C is created as well. C Output: C rnx2fileout = string with the name of the output file. C C ********************* Oscar L. Colombo - October 2011 ********************* C implicit real*8(a-h,o-z) C character*1000 recordin,records(60),typstring character*80 recordout,recordo,recordar,recordon character*162 stringtyp character*21 rnx2fileout character*16 rnx3fileout,dataint,dataout(30),blank16 character*12 rnxfilen character*4 char4,ortyp(28),orbtypec5,orbtypel5,orbtypes5 character*1 charg C dimension itypes2(30),mprn(32),nchars(110),nprnc2(32) data itypes2/30*0/,charg/'G'/,blank16/' '/, .ortyp/28*' '/ C rewind irnx3out open(irnx2out,file=rnx2fileout,form='formatted',status='unknown') C C Read and copy or convert each header record to its rinex 2 equivalent C (e.g. "sys / # /obs types"). C If there is no equivalent, the rinex 3 record is ignored, except for C the "SYS / PHASE SHIFTS " record. C If a necessary rinex 2 record has no good equivalent in rinex 3, C that rinex 2 line is created and written in the rinex 2 header C (e.g. "wavelength factor"). C nrec = 0 nrecout = 0 read(irnx3out,'(a80)') recordin nrec = 1 recordin(6:9) = '2.11' recordin(41:41) = 'G' write(irnx2out,'(a80)') recordin nrecout = 1 10 continue read(irnx3out,'(a80)') recordin nrec = nrec+1 cG 7 C1C L1C C1W C2W L2W C2L L2L SYS / # / OBS TYPES if(recordin(1:1).eq.'G'.and.recordin(61:79).eq. .'SYS / # / OBS TYPES') then read(recordin(5:6),'(i2)') ntypes typstring(1:52) = recordin(8:59) read(irnx3out,'(a80)') recordin nrec = nrec+1 if(recordin(1:1).eq.' '.and.recordin(61:79).eq. ! Found a second "OBS TYPE" record. .'SYS / # / OBS TYPES') then typstring (53:105) = recordin(8:60) else backspace irnx3out endif ntyp = 0 ntym = 0 is2 = 0 C C Setting up a table of pointers (in arrays "stringtyp" and "itypes2" C to assign a place in the rinex 2 version for the rinex 3 data. C The user has to select which rinex 3 data types are going to be C copied to the rinex 2 file by changing the type of all not wanted C rinex 3 data as "T1 ", "T2 ", or "D1 ", "D2 ". (See comments in the header C for more information.) C lcidata = 0 ! Block III "L1 signals present" flag. lc5data = 0 ! "L5 signals present" flag. ic1 = 0 il1 = 0 ip1 = 0 ip2 = 0 ipp2= 0 il2 = 0 ill2= 0 ic2 = 0 icc2= 0 il2c= 0 iw1 = 0 is1 = 0 is2 = 0 l21 = 0 kl2c= 0 is2c= 0 moretyp = 0 ic5 = 0 il5 = 0 is5 = 0 lc52= 0 ll52= 0 ls52= 0 do i = 1,162 stringtyp(i:i) = ' ' enddo do i = 1,ntypes i1 = (i-1)*4+1 i2 = i1+4 char4 = typstring(i1:i2) if(char4.eq.'C1C ') then stringtyp(1:6) = ' C1' ! Eventually, L1C (GPS III) will be available C in some satellite but not in others, so it should be treated same as L2C. itypes2(i) = 1 ntyp = ntyp+1 ntym = ntym+1 ortyp(itypes2(i)) = char4 ic1 = 1 endif if(char4.eq.'L1C '.or.char4.eq.'L1P '.or.char4.eq.'L1W '. .or.char4.eq.'L1Y '.or.char4.eq.'L1M ') then stringtyp(7:12) = ' L1' itypes2(i) = 2 ntyp = ntyp+1 ntym = ntym+1 ortyp(itypes2(i)) = char4 il1 = 1 endif if(char4.eq.'C2M '.or.char4.eq.'C2P '.or.char4.eq.'C2W '. .or.char4.eq.'C2Y ') then stringtyp(13:18) = ' P2' itypes2(i) = 3 ntyp = ntyp+1 ntym = ntym+1 ortyp(itypes2(i)) = char4 lp21 = 4+(i-1)*16 lp22 = lp21+16-1 ip2 = 1 endif if(char4.eq.'L2M '.or.char4.eq.'L2P '.or.char4.eq.'L2W '.or. .char4.eq.'L2Y ') then stringtyp(19:24) = ' L2' itypes2(i) = 4 ntyp = ntyp+1 ntym = ntym+1 ortyp(itypes2(i)) = char4 il2 = 1 endif if(char4.eq.'L2S '.or.char4.eq.'L2L '.or.char4.eq.'L2X ') then kl2c = 1 kml2c = kl2c if(l2cnot.eq.0.and.(l2conly.ne.0.or.l2conly.eq.2)) then l21 = 4+(i-1)*16 l22 = l21+16-1 ortyp(9) = char4 il2c = 1 iii = i endif endif if(char4.eq.'C2L '.or.char4.eq.'C2S '.or.char4.eq.'C2X ') then if(l2cnot.eq.0) then itypes2(i) = 5 stringtyp(25:30) = ' C2' lc21 = 4+(i-1)*16 lc22 = lc21+16-1 else stringtyp(25:30) = ' T2' endif ntyp = ntyp+1 ntym = ntym+1 itypes2(i) = 5 ortyp(itypes2(i)) = char4 lc21 = 4+(i-1)*16 lc22 = lc21+16-1 ic2 = i endif if(char4.eq.'C5I '.or.char4.eq.'L5I '.or.char4.eq.'S5I '.or. .char4.eq.'C5Q '.or.char4.eq.'L5Q '.or.char4.eq.'S5Q '.or. .char4.eq.'C5X '.or.char4.eq.'L5X '.or.char4.eq.'S5X ') then l5data = 1 moretyp = 1 if(char4(1:2).eq.'C5') then lc51 = 4+(i-1)*16 lc52 = lc51+16-1 ic5 = i orbtypec5 = char4 endif if(char4(1:2).eq.'L5') then orbtypel5 = char4 ll51 = 4+(i-1)*16 ll52 = ll51+16-1 il5 = i endif if(char4(1:2).eq.'S5') then orbtypes5 = char4 ls51 = 4+(i-1)*16 ls52 = ls51+16-1 is5 = i endif endif if(char4.eq.'S1C '.or.char4.eq.'S1M '.or.char4.eq.'S1P '.or. .char4.eq.'S1Y '.or.char4.eq.'S1W ') then stringtyp(31:36) = ' S1' itypes2(i) = 6 ntyp = ntyp+1 ntym = ntym+1 ortyp(itypes2(i)) = char4 is1 = 1 endif if(char4.eq.'S2M '.or.char4.eq.'S2P '.or.char4.eq.'S2W '.or. .char4.eq.'S2Y ') then is2 = 1 ! S1 and S2 are always together. stringtyp(37:42) = ' S2' itypes2(i) = 7 ntyp = ntyp+1 ntym = ntym+1 ortyp(itypes2(i)) = char4 endif if(l2cnot.eq.0)then if(char4.eq.'S2L '.or.char4.eq.'S2S '.or.char4.eq.'S2X ') then is2 = 1 ! S1 and S2 are always together. ls1 = 4+(i-1)*16 ls2 = ls1+16-1 is2c= 1 jjj = i ortyp(10) = char4 endif endif C!!! c print*,' l2conly, i ',l2conly,i c stop C!!! enddo if(l2conly.eq.-1) ortyp(10) = ' ' do i = 1,ntypes i1 = (i-1)*4+1 i2 = i1+4 char4 = typstring(i1:i2) if(char4.eq.'C1M '.or.char4.eq.'C1P '.or.char4.eq.'C1W '. .or.char4.eq.'C1Y ') then ip1 = 1 if(ic1.eq.1) then if(is2.eq.1) then stringtyp(43:48) = ' P1' itypes2(i) = 8 else stringtyp(31:36) = ' P1' itypes2(i) = 6 endif elseif(ic1.eq.0) then stringtyp(1:6) = ' P1' itypes2(i) = 1 endif ntyp = ntyp+1 iw1 = 1 ntym = ntym+1 ortyp(itypes2(i)) = char4 endif enddo C!!! c print*,' l2conly,il2c,l2cnot ',l2conly,il2c,l2cnot C!!! if(l2conly.eq.2.and.il2c.eq.1.and.l2cnot.eq.0) then C!!! c print*,' is2, ic1, ip1, is2c ',is2,ic1,ip1,is2c C!!! ntyp = ntyp+1 !! if(is2.eq.1.and.ic1.eq.1) then if(ip1.eq.1) then stringtyp(49:54) = ' LC' itypes2(iii) = 9 if(is2c.eq.1) then ! <<<<<< stringtyp(55:60) = ' SC' itypes2(jjj) = 10 endif elseif(ip1.eq.0) then stringtyp(43:48) = ' LC' itypes2(iii) = 8 if(is2c.eq.1) then stringtyp(49:54) = ' SC' itypes2(jjj) = 9 endif endif elseif(is2.eq.1.and.ic1.eq.0) then if(ip1.eq.1) then stringtyp(43:48) = ' LC' itypes2(iii) = 8 if(is2c.eq.1) then ! <<<<<< stringtyp(49:54) = ' SC' itypes2(jjj) = 9 endif elseif(ip1.eq.0) then stringtyp(37:42) = ' LC' itypes2(iii) = 7 if(is2c.eq.1) then ! <<<<<< stringtyp(43:48) = ' SC' itypes2(jjj) = 8 endif endif elseif(is2.eq.0.and.ic1.eq.1) then if(ip1.eq.1) then stringtyp(37:42) = ' LC' itypes2(iii) = 7 if(is2c.eq.1) then ! <<<<<< stringtyp(43:48) = ' SC' itypes2(jjj) = 8 endif elseif(ip1.eq.0) then stringtyp(31:36) = ' LC' itypes2(iii) = 6 if(is2c.eq.1) then ! <<<<<< stringtyp(37:42) = ' SC' itypes2(jjj) = 7 endif endif elseif(is2.eq.0.and.ic1.eq.0) then if(ip1.eq.1) then stringtyp(31:36) = ' LC' itypes2(iii) = 6 if(is2c.eq.1) then ! <<<<<< stringtyp(37:42) = ' SC' itypes2(jjj) = 7 endif elseif(ip1.eq.0) then stringtyp(25:30) = ' LC' itypes2(iii) = 5 if(is2c.eq.1) then ! <<<<<< stringtyp(31:36) = ' SC' itypes2(jjj) = 6 endif endif endif if(l2cnot.eq.0) then if(itypes2(iii).lt.9) then ortyp(itypes2(iii)) = ortyp(9) ortyp(itypes2(iii)+1) = ortyp(10) if(itypes2(iii).lt.8) then ortyp(9) = ' ' ortyp(10) = ' ' elseif(itypes2(iii).eq.8) then ortyp(10) = ' ' endif endif if(is2c.eq.1) ntyp = ntyp+1 C!!! c print*,' ntyp ',ntyp c print*,stringtyp C!!! elseif(l2cnot.eq.1) then ortyp(9) = ' ' ortyp(10) = ' ' endif endif C C Checking for missing essential data types, reserving their spaces for blank columns: C if(ip2.eq.0) then ! There has to be a "P2" column, even a blank one. stringtyp(13:18) = ' P2' ntyp = ntyp+1 ntym = ntym+1 lp21 = 0 ipp2= 1 write(recordout,'( ."+ P2: No P2 in RINEX 3 file: blank column has been created. ", ."COMMENT")') nrecout = nrecout+1 write(irnx2out,'(a80)') recordout endif if(ic2.eq.0.or.l2cnot.eq.1) then ! There has to be a "C2" column, even a blank one. if(l2cnot.eq.0) then stringtyp(25:30) = ' C2' write(recordout,'( ."+C2: No C2 in RINEX 3 file: blank column has been created. ", ."COMMENT")') nrecout = nrecout+1 write(irnx2out,'(a80)') recordout ntyp = ntyp+1 ntym = ntym+1 elseif(l2cnot.eq.1) then stringtyp(25:30) = ' T2' write(recordout,'("+C2: No C2 in RINEX 3 copied, blank ""T2""", ." column put instead.COMMENT")') write(irnx2out,'(a80)') recordout nrecout = nrecout+1 endif lc21 = 0 icc2= 1 endif if(il2.eq.0) then ! There has to be an "L2" column, even a blank one. C (and once all satellites are Block IIR-M, IIF, or III) stringtyp(19:24) = ' L2' ntyp = ntyp+1 ntym = ntym+1 ll21 = 0 ilc2 = 1 write(recordout,'( ."+ L2: No L2 in RINEX 3: L2C phase saved as L2, when possible", .". COMMENT")') write(irnx2out,'(a80)') recordout nrecout = nrecout+1 endif igout = 0 if(l2conly.eq.-1.and.il2c.eq.0.or.il2.eq.0) then print*,' No phase of either L2 or L2C declared in header,' print*,' but the use of both phases is requested by user.' igout = 1 endif if(l2conly.eq.-1.and.il2c.eq.0) then print*,' There is no phase of L2C declared in header,' print*,' but the use of L2C phase is requested by user.' igout = 1 endif if(l2conly.eq.-1.and.ic2.eq.0) then print*,' There is no C2 declared in header,' print*,' and the use of L2C phase is requested by user.' igout = 1 endif if(l2conly.eq.2.and.(il2c.eq.0.or.il2.eq.0)) then print*,' There is either no "heritage" L2 phase or no L2C phase,' print*,' but user has asked to have both in the RINEX 2 file.' endif if(ic1.eq.0.and.iw1.eq.0) then print*,' There is no C1 or P1 declared in header.' igout = 1 endif if(il1.eq.0) then print*,' There is no L1 declared in header.' igout = 1 endif if(ip2.eq.0.and.ic2.eq.0) then print*,' There is no P2 or C2 declared in header.' igout = 1 endif if(il2.eq.0.and.il2c.eq.0) then print*,' No "heritage" L2 or L2C''s L2 declared in header.' igout = 1 endif if(is1.ne.is2) then print*,' One of S1, S2 is declared in header,' print*,' but not the other.' igout = 1 endif if(igout.eq.1) go to 123 go to 124 123 continue print*,' ' print*,' In the header of the RINEX 3 file: ',rnxfilen print*,' one or more essential or required data types ' print*,' are missing, so this file cannot be processed:' print*,' ' print*,' !!!!!!! JOB ABANDONED !!!!!!!' print*,' ' stop 124 continue C IF(moretyp.eq.1) THEN C!!! c print*,' moretyp ',moretyp c print*,' itypes2 ',itypes2 c print*,' ic5, il5, is5 ',ic5,il5,is5 C!!! do i = 1,ntypes if(itypes2(i).ne.0) ntypmax = i enddo if(l5data.eq.1) then ! There are L5 data, so copy them to the Rinex 2 version. ntyp = ntypmax if(ic5.gt.0) then ntyp = ntyp+1 itypes2(ic5) = ntyp ortyp(ntyp) = orbtypec5 stringtyp((ntyp-1)*6+1:(ntyp*6)) = ' C5' endif if(il5.gt.0) then ntyp = ntyp+1 itypes2(il5) = ntyp ortyp(ntyp) = orbtypel5 stringtyp((ntyp-1)*6+1:(ntyp*6)) = ' L5' endif if(is5.gt.0) then ntyp = ntyp+1 itypes2(is5) = ntyp ortyp(ntyp) = orbtypes5 stringtyp((ntyp-1)*6+1:(ntyp*6)) = ' S5' endif endif if(lcidata.eq.1) then ! There are Block III LC1 data, so copy them to the Rinex 2 version. ntyp = ntyp+1 if(l5data.eq.0) ntyp = ntypmax+1 C... endif C!!! c print*,' ntyp ',ntyp,' ntypes ',ntypes c print*,' itypes2 ',itypes2 C!!! endif ! If(moretyp.eq.1) THEN... C c 8 C1 C2 P1 P2 L1 L2 S1 S2 # / TYPES OF OBSERV if(stringtyp((ntyp-1)*6+1:ntyp*6).eq.' ') ntyp = ntyp-1 if(ntyp.le.9) then write(irnx2out,'(4x,i2,a54,"# / TYPES OF OBSERV ")') .ntyp,stringtyp(1:54) nrecout = nrecout+1 elseif(ntyp.le.18) then write(irnx2out,'(4x,i2,a54,"# / TYPES OF OBSERV ")') .ntyp,stringtyp(1:54) nrecout = nrecout+1 write(irnx2out,'(6x,a54,"# / TYPES OF OBSERV ")') .stringtyp(55:108) nrecout = nrecout+1 if(ntyp.gt.18) then write(irnx2out,'(6x,a54,"# / TYPES OF OBSERV ")') .stringtyp(109:162) nrecout = nrecout+1 endif endif write(irnx2out,'("NO DOPPLER DATA COPIED FROM THE ", ."RINEX 3 FILE. COMMENT ")') write(irnx2out,'("DATA TYPES COPIED FROM THE ORIGINAL RINEX ", ."3 FILE: COMMENT ")') nrecout = nrecout+1 do j = 1,80 recordo(j:j) = ' ' enddo if(ntyp.le.14) then write(recordo,'("@ ",14a4)') (ortyp(k),k=1,14) write(recordo(61:67),'("COMMENT")') write(irnx2out,'(a80)') recordo nrecout = nrecout+1 else write(recordo,'("@ ",14a4)') (ortyp(k),k=1,14) write(recordo(61:67),'("COMMENT")') write(irnx2out,'(a80)') recordo nrecout = nrecout+1 write(recordo,'("@ ",14a4)') (ortyp(k),k=15,28) write(recordo(61:67),'("COMMENT")') write(irnx2out,'(a80)') recordo nrecout = nrecout+1 endif go to 10 endif if(recordin(61:79).eq.'SYS / # / OBS TYPES') go to 10 if(recordin(61:78).eq.'SYS / PHASE SHIFTS') then if(recordin(1:3).eq.'G L'.and.recordin(6:10).eq.'-25') then go to 10 else kml2c = 0 if(recordin(1:11).eq.'G L2L -0.25') then write(recordin(1:80), .'("G L2L -0.25000 ", ."COMMENT")') endif if(l2conly.eq.0) then if(l2cnot.eq.0) then write(irnx2out,'(a80)') recordin nrecout = nrecout+1 write(recordin(1:80), .'("All L2 phase in this file is ""heritage"" (but see below). ", ." COMMENT")') if(l21.ne.0) then write(irnx2out,'(a80)') recordin nrecout = nrecout+1 write(recordin(1:80), .'("The L2C phase copied only to replace any blank L2 entries. ", ." COMMENT")') else write(irnx2out,'(a80)') recordin nrecout = nrecout+1 write(recordin(1:80), .'("No L2C phase replaced any blank L2 phase entries", ." COMMENT")') endif endif if(l2cnot.eq.1) then write(irnx2out,'(a80)') recordin nrecout = nrecout+1 write(recordin(1:80), .'("NO L2C data in the original file was copied to this file. ", ."COMMENT")') endif elseif(l2conly.eq.1) then write(irnx2out,'(a80)') recordin nrecout = nrecout+1 write(recordin(1:80), .'("For IIR-M, IIF: If only L2C phase available: saved as ""L2""", .". COMMENT")') elseif(l2conly.eq.-1) then write(irnx2out,'(a80)') recordin nrecout = nrecout+1 write(recordin(1:80), .'("For IIR-M, IIF: If L2 and L2C phase present: only L2C ", ."phase COMMENT")') write(irnx2out,'(a80)') recordin nrecout = nrecout+1 write(recordin(1:80), .'("saved in column ""L2"". ", ." COMMENT")') elseif(l2conly.eq.2) then write(irnx2out,'(a80)') recordin nrecout = nrecout+1 write(recordin(1:80), .'("For IIR-M, IIF: both heritage L2 phase and L2C phase saved.", ." COMMENT")') write(irnx2out,'(a80)') recordin nrecout = nrecout+1 write(recordin(1:80), .'("(""LC"" is the L2C phase, ""SC"" is the L2C S/N) ", ." COMMENT")') endif if(l2conly.ne.2) then if(l2cnot.eq.0) then if(l2conly.eq.-1) then write(recordin(1:80), .'("The ""heritage"" L2 has been replaced with the phase of L2C.", ." COMMENT")') else write(recordin(1:80), .'("NO ""heritage"" L2 has been replaced with the phase of L2C. ", ." COMMENT")') endif elseif(l2cnot.eq.1) then write(recordin(1:80), .'("NO L2C data in the original file was copied to this file. ", ."COMMENT")') endif endif endif endif C if(recordin(61:73).eq.'END OF HEADER'.and.nl2cprn.ne.0) then write(recordon,'("% Number L2C satellites: ",i2, .", listed below by PRN:",7x,"COMMENT")') nl2cprn write(irnx2out,'(a80)') recordon do km = 1,80 recordon(km:km) = ' ' enddo nsss = nl2cprn if(nl2cprn.gt.18) nsss = 18 write(recordon,'("% ",18(" ",i2))') (nprnc2(km), .km=1,nsss) recordon(61:67) = 'COMMENT' write(irnx2out,'(a80)') recordon if(nl2cprn.gt.18) then do km = 1,80 recordon(km:km) = ' ' enddo write(recordon,'("% ",18(" ",i2))') (nprnc2(km), .km=19,nl2cprn) recordon(61:67) = 'COMMENT' write(irnx2out,'(a80)') recordon endif endif C if(recordin(61:73).eq.'END OF HEADER'.and.kml2c.ne.0) then recordar = recordin C write(recordin(1:80), .'("G% NO 1/4 CYCLE CORRECTION APPLIED TO THE L2C PHASE. ", ," COMMENT")') if(l2conly.eq.0) then write(irnx2out,'(a80)') recordin nrecout = nrecout+1 write(recordin(1:80), .'("All L2 phase in this file is ""heritage"" (but see below). ", ." COMMENT")') if(l21.ne.0) then write(irnx2out,'(a80)') recordin nrecout = nrecout+1 write(recordin(1:80), .'("The L2C phase copied only to replace any blank L2 entries. ", ." COMMENT")') else write(irnx2out,'(a80)') recordin nrecout = nrecout+1 write(recordin(1:80), .'("No L2C phase replaced any blank L2 phase entries", ." COMMENT")') endif elseif(l2conly.eq.1) then write(irnx2out,'(a80)') recordin nrecout = nrecout+1 write(recordin(1:80), .'("For IIR-M, IIF: If only L2C phase available: saved as ""L2""", .". COMMENT")') elseif(l2conly.eq.-1) then write(irnx2out,'(a80)') recordin nrecout = nrecout+1 write(recordin(1:80), .'("For IIR-M, IIF: If L2 and L2C phase present: only L2C ", ."phase COMMENT")') write(irnx2out,'(a80)') recordin nrecout = nrecout+1 write(recordin(1:80), .'("saved in column ""L2"". ", ." COMMENT")') elseif(l2conly.eq.2) then write(irnx2out,'(a80)') recordin nrecout = nrecout+1 write(recordin(1:80), .'("For IIR-M, IIF: both heritage L2 phase and L2C phase saved.", ." COMMENT")') write(irnx2out,'(a80)') recordin nrecout = nrecout+1 write(recordin(1:80), .'("(""LC"" is the L2C phase, ""SC"" is the L2C S/N) ", ." COMMENT")') endif write(irnx2out,'(a80)') recordin nrecout = nrecout+1 if(l2conly.ne.2) then if(l2cnot.eq.0) then if(l2conly.eq.-1) then write(recordin(1:80), .'("The ""heritage"" L2 has been replaced with the phase of L2C.", ." COMMENT")') else write(recordin(1:80), .'("NO ""heritage"" L2 has been replaced with the phase of L2C. ", ." COMMENT")') endif elseif(l2cnot.eq.1) then write(recordin(1:80), .'("NO L2C data in the original file was copied to this file. ", ."COMMENT")') endif write(irnx2out,'(a80)') recordin nrecout = nrecout+1 endif go to 11 endif C c 1 1 WAVELENGTH FACT L1/2 if(recordin(61:68).eq.'ANTENNA:') then write(irnx2out,'(5x,"1 1",48x,"WAVELENGTH FACT L1/2")') endif nrecout = nrecout+1 if(recordin(61:73).eq.'END OF HEADER') then recordar = recordin go to 11 endif write(irnx2out,'(a80)') recordin nrecout = nrecout+1 go to 10 11 continue write(irnx2out,'(a80)') recordar nrecout = nrecout+1 100 continue read(irnx3out,'(a450)',end=200) recordin nrec = nrec+1 if(recordin(1:1).eq.'>') then ! Creating in memory, and then C writing to the output file a C rinex 2-formatted data block, C with the epoch, etc. in its first record, C followed by as many data records C as there are GPS satellites. C!!! c print*,' ntyp ',ntyp C!!! c> 2011 08 29 01 00 0.0000000 0 10 c 11 07 10 13 11 30.0000000 0 10G18G 8G29G25G 6G22G31G 3G15G21 write(records(1),'(1x,a31)') recordin(5:35) read(records(1)(31:32),'(i2)') nsats ! "nsats" is the number of GPS C data records. C!!! c print*,' records(1) ',records(1) c print*,' nsats ',nsats C!!! ip = 1 do i = 1,nsats ! Creating the observation records in array "records". ip = ip+1 read(irnx3out,'(a450)',end=200) recordin nrec = nrec+1 read(recordin(2:4),'(i2)') nprn mprn(i) = nprn do j = 1,ntyp dataout(j) = blank16 enddo do k = 1,ntypes ! "ntypes" is the number of data types listed C in the rinex 3 header. k1 = 4+(k-1)*16 k2 = k1+16 dataint = recordin(k1:k2) imm = itypes2(k) if(imm.ne.0) then dataout(imm) = dataint if(imm.eq.5.and.l2cnot.eq.1.and.l2conly.eq.0) .dataout(imm) = blank16 if(l2conly.eq.1.and.lc21.ne.0) then ! In data records with L2C only, C replace the L2 and S2 blanks with the corresponding C L2C values. if(recordin(lc21:lc22).ne.blank16) then if(lp21.ne.0) then if(recordin(lp21:lp22). .eq.blank16) then ! If this record is for one of those satellites, proceed. if(imm.eq.4) dataout(imm) = recordin(l21:l22) if(imm.eq.7.and.recordin(k1:k2).eq.blank16) .dataout(imm) = recordin(ls1:ls2) endif endif endif endif endif enddo if(il2.eq.0.and.l2conly.eq.1) dataout(4) = recordin(l21:l22) ! When the C "heritage" signals are not present, use the L2C phase, if the L2C C code and phase are available. if(l2conly.eq.-1.and.lc21.ne.0.and.l21.ne.0) then if(recordin(lc21:lc22).ne.blank16) then dataout(4) = recordin(l21:l22) ! When the user requires the use of C the L2C phase in all obs. of satellites C of blocks IIR-M, IIF and later ones C -- if available in the RINEX 3 file. C endif endif if(ntyp.le.5) then ! "ntyp" is the number of data types C listed in the output rinex 2 file. write(records(ip),'(5a16)') (dataout(ik),ik=1,ntyp) nchars(ip) = ntyp*16 else write(records(ip),'(5a16)') (dataout(ik),ik=1,5) nchars(ip) = 80 C nkkk = ntyp/5 if((ntyp/5)*5.eq.ntyp) nkkk = nkkk-1 do j = 1,nkkk lim1 = j*5+1 lim2 = lim1+4 if(lim2.gt.ntyp) lim2 = ntyp ip = ip+1 nchars(ip) = 80 write(records(ip),'(5a16)') . (dataout(ik),ik=lim1,lim2) do k = 80,1,-1 km = k if(records(ip)(k:k).ne.' ') then go to 90 endif enddo 90 continue if(lim2.eq.ntyp) km = 16*(lim2-lim1+1) nchars(ip) = km enddo endif enddo C ntoto = 33+nsats*3-1 write(records(1)(33:80),'(20(a1,i2))') (charg,mprn(i),i=1,nsats) ! Creating the header C of the rinex 2 block in array "records". if(nsats.le.12) then write(irnx2out,'(80a1)') (records(1)(k:k),k=1,ntoto) ! Writing the block header record to the output rinex 2 file. else write(irnx2out,'(80a1)') (records(1)(k:k),k=1,68) ! Writing the block header record to the output rinex 2 file. write(irnx2out,'(32x,47a1)') (records(1)(k:k),k=69,33+ntoto) endif do i = 2,ip write(irnx2out,'(80a1)') (records(i)(k:k),k=1,nchars(i)) enddo endif go to 100 C 200 continue C return end C