sortobs()函数:
note:是对读取出来的GNSS观测数据进行排序,并删除重复数据
argv:obs_t *obs
return:历元数
qsort()函数的排序后效果:
/* sort and unique observation data -------------------------------------------- * sort and unique observation data by time, rcv, sat * args : obs_t *obs IO observation data * return : number of epochs *-----------------------------------------------------------------------------*/ extern int sortobs(obs_t *obs) { int i,j,n; trace(3,"sortobs: nobs=%d ",obs->n); if (obs->n<=0) return 0; qsort(obs->data,obs->n,sizeof(obsd_t),cmpobs); /* 先用qsort()函数进行排序 */ /* delete duplicated data */ /* 删除重复的观测数据 */ for (i=j=0;i<obs->n;i++) { if (obs->data[i].sat!=obs->data[j].sat|| obs->data[i].rcv!=obs->data[j].rcv|| timediff(obs->data[i].time,obs->data[j].time)!=0.0) { obs->data[++j]=obs->data[i]; } } obs->n=j+1; for (i=n=0;i<obs->n;i=j,n++) { /* 通过时间对历元进行计数 */ for (j=i+1;j<obs->n;j++) { if (timediff(obs->data[j].time,obs->data[i].time)>DTTOL) break; } } return n; }