rtklib处理以BDT为时间基准的观测数据时遇到的BUG

rtklib只能处理以GPST和UTC为时间基准的数据,想正确处理以BDT为时间基准的数据需要将观测数据的时间进行转换,具体如下:

在 readrnxobs()函数(在文件rinex.c line:1030左右处)中加入一行代码:

            /* BDT -> GPST */
            if (*tsys==TSYS_CMP) data[i].time=bdt2gpst(data[i].time);

即可。

修改后的代码:

/* read RINEX observation data -----------------------------------------------*/
static int readrnxobs(FILE *fp, gtime_t ts, gtime_t te, double tint,
                      const char *opt, int rcv, double ver, int *tsys,
                      char tobs[][MAXOBSTYPE][4], obs_t *obs, sta_t *sta)
{
    obsd_t *data;
    uint8_t slips[MAXSAT][NFREQ+NEXOBS]={{0}};
    int i,n,flag=0,stat=0;
    
    trace(4,"readrnxobs: rcv=%d ver=%.2f tsys=%d\n",rcv,ver,tsys);
    
    if (!obs||rcv>MAXRCV) return 0;
    
    if (!(data=(obsd_t *)malloc(sizeof(obsd_t)*MAXOBS))) return 0;
    
    /* read RINEX observation data body */
    while ((n=readrnxobsb(fp,opt,ver,tsys,tobs,&flag,data,sta))>=0&&stat>=0) {
        
        for (i=0;i<n;i++) {
            
            /* UTC -> GPST */
            if (*tsys==TSYS_UTC) data[i].time=utc2gpst(data[i].time);
            /* BDT -> GPST */
            if (*tsys==TSYS_CMP) data[i].time=bdt2gpst(data[i].time);
            
            /* save cycle slip */
            saveslips(slips,data+i);
        }
        /* screen data by time */
        if (n>0&&!screent(data[0].time,ts,te,tint)) continue;
        
        for (i=0;i<n;i++) {
            
            /* restore cycle slip */
            restslips(slips,data+i);
            
            data[i].rcv=(uint8_t)rcv;
            
            /* save obs data */
            if ((stat=addobsdata(obs,data+i))<0) break;
        }
    }
    trace(4,"readrnxobs: nobs=%d stat=%d\n",obs->n,stat);
    
    free(data);
    
    return stat;
}

 

posted @ 2022-03-07 09:43  無常  阅读(346)  评论(0编辑  收藏  举报