RINEX格式obs数据修复

  1. 修改文件名
     import os
        
     ofiles=[f for f in os.listdir("./") if f[-3:]=='18O']
     for i in ofiles:
         os.system("mv " + i + i.lower()[:7] + "0.18o")
    
  2. 修改观测类型数

    sed -i '11s/9/7/' *.18o
    
  3. 修改接收机类型、天线类型

     import os
        
     of=[o for o in os.listdir("./") if o[-3:]=='180']
        
     chc = ['BJD1', 'BYS1', 'CM01', 'CN01', 'DF01', 'DH01', 'DJSN', 'DS01', 'HNS1', 'JGSN', 'JX01', 'LCSN',
            'LH01', 'LK01', 'RD01', 'SS01', 'ST01', 'TZ01', 'WS01', 'XS01', 'XSX1', 'XYS1', 'YY01', 'ZH01']
     chcd = [i.lower() for i in chc]
     # print(chcd)
        
     for i in chcd:
         os.system("teqc -O.rt 'CHC N72' "+i+"0600.18o >"+i+"0600.18")
         os.system("teqc -O.rt 'CHC N72' "+i+"0610.18o >"+i+"0610.18")
         os.system("teqc -O.rt 'CHC N72' "+i+"0620.18o >"+i+"0620.18")
         os.system("teqc -O.rt 'CHC N72' "+i+"0630.18o >"+i+"0630.18")
         os.system("teqc -O.rt 'CHC N72' "+i+"0640.18o >"+i+"0640.18")
         os.system("teqc -O.rt 'CHC N72' "+i+"0650.18o >"+i+"0650.18")
         os.system("teqc -O.rt 'CHC N72' "+i+"0660.18o >"+i+"0660.18")
        
         os.system("mv "+i+"0600.18 "+i+"0600.18o")
         os.system("mv "+i+"0610.18 "+i+"0610.18o")
         os.system("mv "+i+"0620.18 "+i+"0620.18o")
         os.system("mv "+i+"0630.18 "+i+"0630.18o")
         os.system("mv "+i+"0640.18 "+i+"0640.18o")
         os.system("mv "+i+"0650.18 "+i+"0650.18o")
         os.system("mv "+i+"0660.18 "+i+"0660.18o")
        
        
     rcu = ["BJD1", "BYS1", "CM01", "CN01", "DF01", "DH01", "DJSN", "DS01", "HNS1", "JX01", "LH01",
            "LK01", "RD01", "SS01", "ST01", "TZ01", "WS01", "XS01", "XSX1", "XYS1", "YY01", "ZH01"]
     rc = [i.lower() for i in rcu]
     for i in rc:
         os.system("teqc -O.at 'HXCCGX601A' "+i+"0600.18o >"+i+"0600.18oo")
         os.system("teqc -O.at 'HXCCGX601A' "+i+"0610.18o >"+i+"0610.18oo")
         os.system("teqc -O.at 'HXCCGX601A' "+i+"0620.18o >"+i+"0620.18oo")
         os.system("teqc -O.at 'HXCCGX601A' "+i+"0630.18o >"+i+"0630.18oo")
         os.system("teqc -O.at 'HXCCGX601A' "+i+"0640.18o >"+i+"0640.18oo")
         os.system("teqc -O.at 'HXCCGX601A' "+i+"0650.18o >"+i+"0650.18oo")
         os.system("teqc -O.at 'HXCCGX601A' "+i+"0660.18o >"+i+"0660.18oo")
        
     files = os.listdir(".")
     files1 = [i for i in files if i[-3:] == "8oo"]
     for i in files1:
         os.system("mv "+i + " "+i[:-1])
        
     s = ['CM01', 'DS01', 'HNS1', 'LH01', 'SS01', 'WS01', 'XSX1', 'XYS1', 'YY01']
        
     s=["JGSN", "LCSN"]
     ss = [i.lower() for i in s]
     for i in ss:
         os.system("teqc  -O.at 'HXCGG486A' " + i+"0600.18o >"+i+"0600.18oo")
         os.system("teqc  -O.at 'HXCGG486A' " + i+"0610.18o >"+i+"0610.18oo")
         os.system("teqc  -O.at 'HXCGG486A' " + i+"0620.18o >"+i+"0620.18oo")
         os.system("teqc  -O.at 'HXCGG486A' " + i+"0630.18o >"+i+"0630.18oo")
         os.system("teqc  -O.at 'HXCGG486A' " + i+"0640.18o >"+i+"0640.18oo")
         os.system("teqc  -O.at 'HXCGG486A' " + i+"0650.18o >"+i+"0650.18oo")
         os.system("teqc  -O.at 'HXCGG486A' " + i+"0660.18o >"+i+"0660.18oo")
        
     files = os.listdir(".")
     files1 = [i for i in files if i[-3:] == "8oo"]
     print(files1)
     for i in files1:
         os.system("mv "+i + " "+i[:-1])
    

    保存为rtct.py

     python3 rtct.py >out.txt 2>err.txt
     grep teqc: err.txt > err.line
    

    结果:err.line

     teqc: failure to read ' 107514933.969    83777941.672    20459385.436    20459385.436    20459380.866' on line 53143 of 'bjd10630.18o'
     teqc: failure to read ' 109692038.234    85474341.670    20873689.870    20873689.870    20873689.852' on line 56019 of 'bjd10640.18o'
     teqc: failure to read ' 120250676.311    93701873.746    22882908.095    22882908.095    22882902.777' on line 111908 of 'bjd10650.18o'
     teqc: failure to read ' 126111758.115    98268964.639    23998240.964    23998240.964    23998234.788' on line 115739 of 'bjd10660.18o'
     teqc: failure to read ' 109686076.465    85469706.997    20872554.057    20872554.057    20872547.457' on line 32990 of 'bys10610.18o'
     teqc: failure to read ' 105770659.043    82418741.333    20127472.934    20127472.934    20127464.196' on line 48556 of 'bys10620.18o'
     teqc: failure to read ' 127367082.410    99247027.357    24237168.737    24237168.737    24237170.717' on line 54697 of 'bys10630.18o'
     teqc: failure to read ' 107287013.040    83600335.937    20416023.409    20416023.409    20416015.888' on line 53771 of 'bys10640.18o'
     teqc: failure to read ' 114885796.235    89521384.604    21862035.010    21862035.010    21862029.227' on line 104956 of 'bys10650.18o'
     teqc: failure to read ' 129642673.437   101020240.364    24670183.464    24670183.464    24670175.651' on line 151680 of 'bys10660.18o'
     teqc: failure to read ' 111772116.403    87095168.347    21269512.309    21269512.309    21269508.404' on line 57363 of 'cn010600.18o'
     teqc: failure to read ' 105562805.207    82256750.389    20087918.441    20087918.441    20087913.526' on line 46099 of 'cn010610.18o'
     teqc: failure to read ' 110649292.645    86220238.484    21055849.653    21055849.653    21055848.107' on line 48605 of 'cn010620.18o'
     teqc: failure to read ' 113947009.595    88789831.763    21683388.629    21683388.629    21683389.144' on line 45375 of 'cn010630.18o'
     teqc: failure to read ' 114722806.679    89394420.455    21831007.922    21831007.922    21831004.948' on line 57206 of 'cn010640.18o'
     teqc: failure to read ' 114299968.180    89064884.621    21750556.172    21750556.172    21750554.079' on line 117645 of 'cn010660.18o'
     teqc: failure to read ' 130911377.509   102008859.635    24911605.255    24911605.255    24911601.638' on line 58408 of 'df010600.18o'
     teqc: failure to read ' 123516032.143    96246240.318    23504315.770    23504315.770    23504309.210' on line 45755 of 'df010610.18o'
     teqc: failure to read ' 105692851.243    82358115.235    20112656.994    20112656.994    20112651.030' on line 46320 of 'df010620.18o'
     teqc: failure to read ' 123638077.928    96341368.397    23527541.797    23527541.797    23527541.965' on line 45132 of 'df010630.18o'
     teqc: failure to read ' 104472920.437    81407504.701    19880514.114    19880514.114    19880508.799' on line 44396 of 'df010640.18o'
     teqc: failure to read ' 110226488.547    85890806.817    20975378.167    20975378.167    20975372.529' on line 105687 of 'df010650.18o'
     teqc: failure to read ' 113805025.180    88679248.252    21656373.563    21656373.563    21656369.108' on line 53863 of 'df010660.18o'
     teqc: failure to read ' 112111862.908    87359866.532    21334177.672    21334177.672    21334172.215' on line 54094 of 'dh010610.18o'
     teqc: failure to read ' 106065618.728    82648508.543    20183616.035    20183616.035    20183609.918' on line 46696 of 'dh010620.18o'
     teqc: failure to read ' 116559414.529    90825499.849    22180519.591    22180519.591    22180515.537' on line 54508 of 'dh010630.18o'
     teqc: failure to read ' 128728722.951   100308045.123    24496269.498    24496269.498    24496275.873' on line 52932 of 'dh010640.18o'
     teqc: failure to read ' 116784559.828    91000922.513    22223362.868    22223362.868    22223355.010' on line 116433 of 'dh010650.18o'
     teqc: failure to read ' 130445093.104   101645511.475    24822875.658    24822875.658    24822871.127' on line 53072 of 'dh010660.18o'
     teqc: failure to read ' 111158990.334    86617440.526    21152836.536    21152836.536    21152834.500' on line 57979 of 'lk010610.18o'
     teqc: failure to read ' 123252931.610    96041196.005    23454250.493    23454250.493    23454245.355' on line 44130 of 'lk010620.18o'
     teqc: failure to read ' 127929936.047    99685695.364    24344252.691    24344252.691    24344257.751' on line 45907 of 'lk010630.18o'
     teqc: failure to read ' 129878254.335   101203715.424    24715010.872    24715010.872    24715019.540' on line 56664 of 'lk010640.18o'
     teqc: failure to read ' 121607545.898    94759136.843    23141144.584    23141144.584    23141136.717' on line 113538 of 'lk010650.18o'
     teqc: failure to read ' 130459622.556   101656903.706    24825619.864    24825619.864    24825612.944' on line 57740 of 'rd010600.18o'
     teqc: failure to read ' 117972273.361    91926543.662    22449351.051    22449351.051    22449343.742' on line 44958 of 'rd010610.18o'
     teqc: failure to read ' 118103209.253    92028533.652    22474266.280    22474266.280    22474260.026' on line 44872 of 'rd010620.18o'
     teqc: failure to read ' 132150188.959           0.000    25147344.507    25147344.507           0.000' on line 43973 of 'rd010630.18o'
     teqc: failure to read ' 129675406.487   101045743.477    24676417.683    24676417.683    24676417.182' on line 54366 of 'rd010640.18o'
     teqc: failure to read ' 120959311.847    94253984.474    23017786.648    23017786.648    23017778.443' on line 103640 of 'rd010650.18o'
     teqc: failure to read ' 129205960.742   100679976.031    24587061.099    24587061.099    24587054.830' on line 51468 of 'rd010660.18o'
     teqc: failure to read ' 120143812.415    93618504.573    22862599.277    22862599.277    22862590.797' on line 57704 of 'st010600.18o'
     teqc: failure to read ' 105622214.398    82303056.364    20099220.831    20099220.831    20099214.140' on line 44319 of 'st010610.18o'
     teqc: failure to read ' 115257441.157    89810976.563    21932770.977    21932770.977    21932770.779' on line 46709 of 'st010620.18o'
     teqc: failure to read ' 129556532.461   100953125.071    24653784.373    24653784.373    24653779.807' on line 54855 of 'st010630.18o'
     teqc: failure to read ' 129249534.690   100713864.256    24595393.493    24595393.493    24595399.113' on line 54840 of 'st010640.18o'
     teqc: failure to read ' 128049078.949    99778468.274    24366943.361    24366943.361    24366948.551' on line 53997 of 'st010650.18o'
     teqc: failure to read ' 114318303.219    89079184.977    21754043.586    21754043.586    21754038.192' on line 53703 of 'st010660.18o'
     teqc: failure to read ' 107829325.151    84022890.716    20519211.651    20519211.651    20519212.053' on line 50395 of 'tz010620.18o'
     teqc: failure to read ' 122519889.955    95470003.078    23314749.237    23314749.237    23314745.768' on line 107757 of 'tz010630.18o'
     teqc: failure to read ' 121475958.996    94656560.477    23116101.628    23116101.628    23116097.631' on line 105080 of 'tz010640.18o'
     teqc: failure to read ' 111437190.313    86834192.358    21205778.427    21205778.427    21205776.763' on line 111669 of 'tz010650.18o'
     teqc: failure to read ' 127509748.878    99358209.914    24264315.560    24264315.560    24264317.918' on line 57479 of 'xs010600.18o'
     teqc: failure to read ' 127700279.176    99506682.530    24300567.613    24300567.613    24300568.277' on line 55494 of 'xs010610.18o'
     teqc: failure to read ' 118930795.134    92673357.631    22631762.477    22631762.477    22631758.323' on line 47872 of 'xs010620.18o'
     teqc: failure to read ' 107178115.565    83515481.473    20395285.058    20395285.058    20395283.932' on line 44977 of 'xs010630.18o'
     teqc: failure to read ' 118362290.229    92230341.994    22523590.938    22523590.938    22523585.654' on line 49477 of 'xs010640.18o'
     teqc: failure to read ' 114360002.266    89111755.453    21761963.738    21761963.738    21761962.279' on line 41829 of 'xs010650.18o'
     teqc: failure to read ' 114250409.285    89026264.900    21741090.358    21741090.358    21741087.176' on line 51651 of 'xs010660.18o'
     teqc: failure to read ' 109597042.869    85400338.328    20855608.756    20855608.756    20855604.688' on line 57687 of 'zh010600.18o'
     teqc: failure to read ' 119756094.644    93316468.642    22788807.271    22788807.271    22788801.275' on line 46593 of 'zh010610.18o'
     teqc: failure to read ' 128557418.707   100174631.085    24463659.168    24463659.168    24463655.512' on line 46217 of 'zh010620.18o'
     teqc: failure to read ' 113929676.373    88776350.950    21680097.136    21680097.136    21680093.696' on line 43749 of 'zh010630.18o'
     teqc: failure to read ' 129066204.984   100571142.689    24560455.076    24560455.076    24560449.346' on line 54535 of 'zh010640.18o'
     teqc: failure to read ' 110010831.733    85722754.921    20934341.619    20934341.619    20934338.272' on line 53960 of 'zh010650.18o'
    
  4. 查看转换后文件的信息

     #!/usr/bin/python3
     import os
     import datetime as dt
        
     def main():
     	dirlist=os.listdir("./")
     	datafile=[it for it in dirlist if it!="teqc"]
        
     	for it in datafile:
     		if it[-1]=='o' or it[-1]=='O':
     			getinfo(it)
     #		os.system('teqc +nav ../' + name +'.17n  ../' + it + ' > ../' + name +".17o" + " 2> err.txt")
        
     def getinfo(name):
     	os.system('teqc +meta ./' + name + ' > ./' + name + '.txt' )
        
        
        
     if __name__=='__main__':
     	main()
    

    以上代码保存为 info.py

     ./info.py 
     grep final *.18o.txt >aa
     sed -i '-e /23:59:30.000/d' aa
    

    结果:aa

     bjd10630.18o.txt:final date & time:       2018-03-04 07:05:30.000
     bjd10640.18o.txt:final date & time:       2018-03-05 07:14:00.000
     bjd10650.18o.txt:final date & time:       2018-03-06 14:14:30.000
     bjd10660.18o.txt:final date & time:       2018-03-07 14:49:30.000
     bys10610.18o.txt:final date & time:       2018-03-02 04:28:00.000
     bys10620.18o.txt:final date & time:       2018-03-03 06:00:30.000
     bys10630.18o.txt:final date & time:       2018-03-04 06:56:00.000
     bys10640.18o.txt:final date & time:       2018-03-05 06:52:00.000
     bys10650.18o.txt:final date & time:       2018-03-06 13:10:30.000
     bys10660.18o.txt:final date & time:       2018-03-07 19:01:30.000
     cn010600.18o.txt:final date & time:       2018-03-01 07:08:00.000
     cn010610.18o.txt:final date & time:       2018-03-02 06:04:00.000
     cn010620.18o.txt:final date & time:       2018-03-03 05:59:00.000
     cn010630.18o.txt:final date & time:       2018-03-04 05:49:30.000
     cn010640.18o.txt:final date & time:       2018-03-05 07:13:30.000
     cn010660.18o.txt:final date & time:       2018-03-07 14:43:30.000
     df010600.18o.txt:final date & time:       2018-03-01 07:16:30.000
     df010610.18o.txt:final date & time:       2018-03-02 05:56:30.000
     df010620.18o.txt:final date & time:       2018-03-03 05:45:30.000
     df010630.18o.txt:final date & time:       2018-03-04 05:48:30.000
     df010640.18o.txt:final date & time:       2018-03-05 05:44:30.000
     df010650.18o.txt:final date & time:       2018-03-06 13:13:00.000
     df010660.18o.txt:final date & time:       2018-03-07 06:52:00.000
     dh010610.18o.txt:final date & time:       2018-03-02 07:06:30.000
     dh010620.18o.txt:final date & time:       2018-03-03 05:54:30.000
     dh010630.18o.txt:final date & time:       2018-03-04 06:58:30.000
     dh010640.18o.txt:final date & time:       2018-03-05 06:54:30.000
     dh010650.18o.txt:final date & time:       2018-03-06 14:45:30.000
     dh010660.18o.txt:final date & time:       2018-03-07 06:46:30.000
     lk010610.18o.txt:final date & time:       2018-03-02 07:25:00.000
     lk010620.18o.txt:final date & time:       2018-03-03 05:30:30.000
     lk010630.18o.txt:final date & time:       2018-03-04 05:54:30.000
     lk010640.18o.txt:final date & time:       2018-03-05 07:12:30.000
     lk010650.18o.txt:final date & time:       2018-03-06 14:09:30.000
     rd010600.18o.txt:final date & time:       2018-03-01 07:19:30.000
     rd010610.18o.txt:final date & time:       2018-03-02 05:57:00.000
     rd010620.18o.txt:final date & time:       2018-03-03 05:50:30.000
     rd010630.18o.txt:final date & time:       2018-03-04 05:47:30.000
     rd010640.18o.txt:final date & time:       2018-03-05 07:01:30.000
     rd010650.18o.txt:final date & time:       2018-03-06 13:10:30.000
     rd010660.18o.txt:final date & time:       2018-03-07 06:55:00.000
     st010600.18o.txt:final date & time:       2018-03-01 07:14:30.000
     st010610.18o.txt:final date & time:       2018-03-02 05:57:30.000
     st010620.18o.txt:final date & time:       2018-03-03 05:58:00.000
     st010630.18o.txt:final date & time:       2018-03-04 07:04:30.000
     st010640.18o.txt:final date & time:       2018-03-05 06:59:30.000
     st010650.18o.txt:final date & time:       2018-03-06 06:56:00.000
     st010660.18o.txt:final date & time:       2018-03-07 06:53:00.000
     tz010620.18o.txt:final date & time:       2018-03-03 06:24:00.000
     tz010630.18o.txt:final date & time:       2018-03-04 13:34:00.000
     tz010640.18o.txt:final date & time:       2018-03-05 13:20:30.000
     tz010650.18o.txt:final date & time:       2018-03-06 14:17:00.000
     xs010600.18o.txt:final date & time:       2018-03-01 07:08:00.000
     xs010610.18o.txt:final date & time:       2018-03-02 07:04:30.000
     xs010620.18o.txt:final date & time:       2018-03-03 05:53:30.000
     xs010630.18o.txt:final date & time:       2018-03-04 05:50:00.000
     xs010640.18o.txt:final date & time:       2018-03-05 13:06:30.000
     xs010650.18o.txt:final date & time:       2018-03-06 06:48:30.000
     xs010660.18o.txt:final date & time:       2018-03-07 14:41:00.000
     zh010600.18o.txt:final date & time:       2018-03-01 07:10:00.000
     zh010610.18o.txt:final date & time:       2018-03-02 06:02:30.000
     zh010620.18o.txt:final date & time:       2018-03-03 05:44:00.000
     zh010630.18o.txt:final date & time:       2018-03-04 05:40:00.000
     zh010640.18o.txt:final date & time:       2018-03-05 06:54:00.000
     zh010650.18o.txt:final date & time:       2018-03-06 06:51:30.000
    
  5. 发现问题

      18  3  4  7  5 30.0000000  0 36G16G26G26G27G27G14G22G31G23G08G08G32
                                     G32G29G03G03C21C23C27C22C25C29C26C30
                                     C32C34C28R21R10R07R09R08R11R20R19R01
    

    删掉第36颗卫星之后的所有卫星观测指,强制变为36颗

     import os
     ofile = [f for f in os.listdir('./') if f[-3:] == '18o']
     for f in ofile:
         os.system('sed -n -e "/37G/=" '+f+' > out')
         with open('out', 'r') as out:
             fline = []
             while True:
                 line = out.readline()
                 if line.strip() == '':
                     break
                 fline.append(line.strip())
                 # print(sline)
             nfline = [int(i) for i in fline]
             nnline = [i+1 for i in nfline]
             nline = [str(i) for i in nnline]
             command = ''
             for fl in fline:
                 command += fl+'d;'
             for nl in nline:
                 command += nl+'d;'
             os.system("sed -i '"+command[:-1] + "' "+f)
     os.system("sed -i 's/37G/36G/' *.18o")
        
     for f in ofile:
         os.system('sed -n -e "/38G/=" '+f+' > out')
         with open('out', 'r') as out:
             sline = []
             while True:
                 line = out.readline()
                 if line.strip() == '':
                     break
                 sline.append(line.strip())
                 # os.system(sline)
             nsline = [int(i) for i in sline]
             neline = [i+3 for i in nsline]
             eline = [str(i) for i in neline]
             command = ''
             for i in range(len(sline)):
                 command += sline[i]+','+eline[i]+'d;'
        
             os.system("sed -i '"+command[:-1] + "' "+f)
     os.system("sed -i 's/38G/36G/' *.18o")
        
     for f in ofile:
         os.system('sed -n -e "/39G/=" '+f+' > out')
         with open('out', 'r') as out:
             sline = []
             while True:
                 line = out.readline()
                 if line.strip() == '':
                     break
                 sline.append(line.strip())
                 # print(sline)
             nsline = [int(i) for i in sline]
             neline = [i+5 for i in nsline]
             eline = [str(i) for i in neline]
             command = ''
             for i in range(len(sline)):
                 command += sline[i]+','+eline[i]+'d;'
        
             os.system("sed -i '"+command[:-1] + "' "+f)
     os.system("sed -i 's/39G/36G/' *.18o")
        
        
     for f in ofile:
         os.system('sed -n -e "/40G/=" '+f+' > out')
         with open('out', 'r') as out:
             sline = []
             while True:
                 line = out.readline()
                 if line.strip() == '':
                     break
                 sline.append(line.strip())
                 # print(sline)
             nsline = [int(i) for i in sline]
             neline = [i+7 for i in nsline]
             eline = [str(i) for i in neline]
             command = ''
             for i in range(len(sline)):
                 command += sline[i]+','+eline[i]+'d;'
        
             os.system("sed -i '"+command[:-1] + "' "+f)
     os.system("sed -i 's/40G/36G/' *.18o")
        
     for f in ofile:
         os.system('sed -n -e "/41G/=" '+f+' > out')
         with open('out', 'r') as out:
             sline = []
             while True:
                 line = out.readline()
                 if line.strip() == '':
                     break
                 sline.append(line.strip())
                 # print(sline)
             nsline = [int(i) for i in sline]
             neline = [i+9 for i in nsline]
             eline = [str(i) for i in neline]
             command = ''
             for i in range(len(sline)):
                 command += sline[i]+','+eline[i]+'d;'
        
             os.system("sed -i '"+command[:-1] + "' "+f)
     os.system("sed -i 's/41G/36G/' *.18o")
        
    
Table of Contents