Skip to Content

Teqc: Matlab scripts for reading and plotting COMPACT2 files

Teqc is a toolkit for manipulating GNSS data. It has many useful features for editing, translating and quality checking GNSS data (website). One feature of Teqc allows ascii files to be output for plotting. You can chose from two different file formats (COMPACT or COMPACT2). The COMPACT file format only includes data from the GPS constellation. The COMPACT2 file format was created to include data from other constellations. Currently (02/08/2012), teqc will only output data from the GPS and GLONASS constellations to the COMPACT2 file format. The COMPACT2 file format is described at

The following Matlab functions will read and plot the data from COMPACT2 format files:

read_compact_2.m    plot_compact_2.m

Note: These functions are not optimized for speed and may not be suitable for highrate data files. Reading and plotting a COMPACT2 file created from a daily 30sec RINEX takes ~4 seconds on a 2011 Macbook Pro. The form for the figures were inspired from the matlab script located here.

How to create COMPACT2 format files using teqc:

This example shows how to create COMPACT2 format files using a Trimble .tgd file:

1) Create a daily observation and navigation file.

teqc +obs + +nav +,+ -tbin 1d TEST 5024K68415201202070000a.tgd
! Notice ! incomplete code for parsing Trimble .dat record 32 (Galileo ion/UTC model) in file ’5024K68415201202070000a.tgd’ ... skipping
teqc:  creating file ’TEST0370.12g’ ...
teqc:  creating file ’TEST0380.12n’ ...
teqc:  creating file ’TEST0370.12n’ ...
teqc:  creating file ’TEST0380.12o’ ...
teqc:  creating file ’TEST0380.12g’ ...
teqc:  creating file ’TEST0390.12n’ ...

2) Create COMPACT2 ascii files using the qc and plot2 flags. The ’+qc’ flag will run Teqc’s quality check program. The ’+plot2’ flag will force Teqc to output plot files in the COMPACT2 file format. Teqc will automatically find any navigation files for the GPS (.12n) and GLONASS (.12g) satellites if they are present in the same directory. If they are not present, Teqc will not be able to create the COMPACT2 files.

teqc +plot2 +qc TEST0380.12o

The newly created COMPACT2 files:

  • TEST0380.iod 
  • TEST0380.ion
  • TEST0380.mp1 
  • TEST0380.mp2
  • TEST0380.sn1
  • TEST0380.sn2
  • TEST0380.azi
  • TEST0380.ele


How to use the matlab functions to read and plot COMPACT2 files:

1) The function read_compact_2.m must be included in your Matlab path or in the same directory for plot_compact_2.m to work.

2) To plot the GPS data included in a given COMPACT2 file, simply type "plot_compact_2(’filename’,’gps’)". An example is shown below:

3) An example figure showing the elevation angle of GPS satellites over a 24 hour period:





  • Attached Files
  • read_compact_2.m (3.84 KB) 698
  • plot_compact_2.m (2.98 KB) 568

    Last modified: 2019-12-27  16:36:35  America/Denver