MERGE MULTIPLE RINEX FILES

Dennis Milbert

Updated:  2012-jul-19

RINEX files are interesting animals. The identity of columns varies from file to file. The satellites are in any order, and can change order from epoch to epoch. And, of course, data can start and stop at any time, and be logged at different rates at different sites. RINEX is easy to write, but it takes work to read.

The program, manyrins, takes multiple RINEX files, and merges them into a single file in a format that I like. Its ASCII in, and ASCII out. Also, a list file, list.txt, is input to identify the file names of the RINEX files to be merged.

Contents




Operation

The program operates in the DOS console window. You can spawn a console window from the "Start" menu by going through:

   Start --> All Programs --> Accessories --> Command Prompt.
Aside from the RINEX files you wish to merge, only one additional file is needed. It is a simple ASCII list of the file names of the RINEX files. Only one output file is generated.

Input Files:

list.txt -- ASCII. A simple list, created by Notepad (for example) of the file names of the RINEX files. This file must be named list.txt. One RINEX observation file name per line. If an asterisk, *, is in column 1 of a line, then that line is skipped.

Example:

colb1890.12o
ohmh1890.12o
stkr1890.12o
wtzz1890.12o

many RINEX file names -- ASCII, RINEX format. These will be the RINEX observation files to be merged. The files must all be present in the same subdirectory/folder as program manyrins.exe and the list file, list.txt. The RINEX files must not be compressed.

manyrins is built to merge single-day files on the same day. Unexpected behaviors will occur if RINEX files spanning two or more days are encountered. manyrins should have correct operation if a file has just a second or two of data in the previous day or the next day. In other words, manyrins merges RINEX files for multiple stations. If you need to merge RINEX files in time, I can heartily recommend TEQC.

manyrins supports RINEX formats up to and including 2.12. manyrins does not currently support RINEX formats of 3.00 or higher.

Output File:

manyrins.txt -- ASCII, "manyrins" format. A single output file containing the merged contents of the input RINEX observation files. The output file name is fixed as manyrins.txt. It will be written into the same subdirectory as the input files.


Program Execution

manyrins takes 3 command line arguments. Each argument is an integer number, in seconds. All 3 arguments are mandatory.

Command Line:

manyrins startTime stopTime interval

Example:

manyrins 0 86400 30

startTime -- The start time of the output data; an integer, expressing seconds-of day, in units of seconds. Allowed range of 0 to 86400. Note that startTime must be less than or equal to stopTime.

stopTime -- The stop time of the output data; an integer, expressing seconds-of day, in units of seconds. Allowed range of 0 to 86400. Note that stopTime must be greater than or equal to startTime.

interval -- The interval of the output data; an integer, expressing time between output epochs, in units of seconds. Allowed range of 0 to 86400. Note that interval must be less than or equal to the difference between stopTime and startTime.

Even if a small startTime or a large stopTime are specified, manyrins will only output epochs that have data, and will adjust the output start and stop times to reflect the input RINEX files.

Discussion:

From the user perspective, the program is pretty straightforward. It reformats data from many different RINEX inputs. It uses list.txt to look for RINEX file names. It opens each file, and reads the data into memory. Then it outputs the data into the manyrins.txt output file. There is a built in limit of 1000 input files. You may encounter the limit sooner depending on how much data is retained in each RINEX file.


RINEX Format

The RINEX formats (2, 2.10, 2.11, 2.12, 3.00, 3.01) can be obtained from the International GNSS Service. Since manyrins supports RINEX format 2.12, that specific link is provided. Note that the codes span 5 different GNSS satellite systems, each with 100 possible PRN's. The codes also span 4 different observation sets (not counting signal strength) with 10 different subdivisions. Not all possible PRN's or observation subdivisions are issued for a given GNSS satellite system.


manyrins.txt Format

This is a simple ASCII, flat file. There is no specific limit on the number of lines, nor on the number of columns in a line. The basic unit of presentation is a two-dimensional array of observations, where the rows refer to markers/antennae and the columns refer to GNSS satellites.

These data arrays are orgainized in a sequential, hierarchical fashion. That is, a "chapter" of data refers to a single epoch. And, a "page" of data refers to a specific observation type, such as a P1 pseudorange or an L2 carrier phase, and its associated two-dimensional array. Just as a "chapter" consists of one or more "pages", an epoch of data consists of one or more observation types.

Every record contains a single-character record identifier in the first column. Record identifiers are detailed below.

The file begins with a set of header records. The first record is always an "a" record. It indicates the time span, interval, and number of processed stations. The "a" record is followed by one or more "b" records, one for each station. The "b" records list the 4-character station identifier, antenna type, H/E/N offsets, and a RINEX code for the GNSS time system.

After the header are multiple chapters of data, corresponding to each epoch. The first record in each chapter is always an "e" record -- "Epoch Record". The epoch records show year, month, day, hour, minutes, and integer seconds in the GPS time system.

Following the "e" Epoch Record are multiple pages of data, each corresponding to a specific observation type. The first record on a page is always an "f" record. The record shows the RINEX code for the observation type, the number of rows (one row per station), and the number of columns (one column per satellite). All the data on the subsequent data array is of the indicated observation type. Note that each array on a data page has been condensed to eliminate extraneous stations and satellites. Hence, the number of rows and columns will vary from observation type-to-observation type and from epoch-to-epoch.

Each "f" record is followed by one or more "t" records. There will be one "t" record for each row in the data array. Each "t" record displays the 4-character station identifier and the logged observation time in the GPS time system.

After the "t" records is a single "s" record. This record shows the GNSS identifier (satellite PRN's) for each column of the data array.

Finally, to conclude a data page, is the data array. The array is made of one or more "o" records. There is one "o" record for every row of the data array. And the records contain sufficient columns to reflect each satellite associated with that specific epoch and observation type. Note that there will be instances where a given receiver did not record a particular observation type from a particular satellite at a particular epoch. These will be expressed in the data array as a NULL observation. NULL observations are always displayed as 9999999999.999.

Example output file fragment:

a      0 86400    30     4
b COLB  TRM55971.00     NONE         0.0000         0.0000         0.0000  G
b OHMH  TRM41249.00     TZGD         0.0000         0.0000         0.0000  G
b STKR  ASH700718B      NONE         0.0000         0.0000         0.0000  G
b WTZZ  LEIAR25.R3      LEIT         0.0450         0.0000         0.0000  G
e 2012  7  7  0  0  0
f L1    3   10
t COLB  0.0000000
t OHMH  0.0000000
t STKR  0.0000000
s G08 G28 G02 G17 G20 G01 G32 G27 G04 G09
o  130855378.398  109586065.006  127858133.628  108341421.594  118047569.266  126304371.331  126941433.849  121926585.532  110436740.390  119411809.591
o 9999999999.999  -24410420.567   -3294338.751  -23625890.891  -14829513.218   -7924981.183   -6940537.565  -15315852.458  -18454639.554  -14028603.325
o 9999999999.999  -34431150.717   -6116081.646  -32877602.556  -14152549.942  -15375044.007   -7045731.299  -12370580.212  -20383884.530   -8201353.866
f L2    3   10

   ... and so on ...

Detailed manyrins.txt Formats with Fixed Column Output:

a Record -- file header
--------
01-01  a
04-08  start, seconds of day, GPS time system
10-14  stop, seconds of day, GPS time system
16-20  interval, seconds
22-26  number of stations (total for the entire file)

b Record -- station/antenna 
--------
01-01  b
03-06  4-character marker name
09-28  antenna type
30-43  antenna delta H (meters)
45-58  antenna delta E (meters)
60-73  antenna delta N (meters)
76-76  GNSS time system code (G,R,S,E,C)

e Record -- epoch header  (GPS time system)
--------
01-01  e
03-06  year
08-09  month
11-12  day
14-15  hours
17-18  minutes
20-21  seconds

f Record -- obseration type header
--------
01-01  f
03-04  observation type code
06-09  number of rows (stations)
11-14  number of columns (satellites)

t Record -- measured time
--------
01-01  t
03-06  4-character marker name
08-17  seconds of measured time (GPS time system)

s Record -- satellite list
--------
01-01  s
03-05  satellite identifier
07-09  satellite identifier
.....    continue for all columns specified in "f" record

o Record -- observations for a given station
--------
01-01  s
03-16  observation
18-31  observation
.....    continue for all columns specified in "f" record



Memory Usage

Recall from above that manyrins opens each RINEX file, reads the data into memory, and outputs the data into the manyrins.txt file. System memory is a constraint on the amount of input data that can be merged by manyrins. To support this constraint, manyrins outputs a console message indicating the percentage of available memory space used to process the input data. For example:

program memory use:  1.03596 precent

Program manyrins is efficient. It only stores observations that fit the "start time/stop time/interval" profile supplied on the command line. Depending upon the number of satellites, data spans in the RINEX files, desired output data span, and observation types that were collected, it is literally possible for manyrins to merge hundreds of RINEX files into a single output file. A software limit of 1000 input RINEX files is (currently) used. The work array sizes in manyrins are tuned to fit a WIN32 limit. The source code is available (below) and can be ported to other computer systems.


GPS Time System

All times output from manyrins are in a nominal GPS time system.

Times from SBAS (S), Galileo (E), and Compass (C), are already in a nominal GPS time system. Program manyrins does not alter those times.

Times from GLONASS (R), however, might be expressed in the GLONASS time system. The GLONASS time system is nominally aligned with UTC. Program manyrins detects the presence of the "R" time system code (typically found only in "pure" GLONASS-only RINEX files), and converts the times into nominal GPS time.

Conversion is performed by algebraically adding the leap seconds offset from the "LEAP SECONDS" record in the RINEX header to the GLONASS times. It is important that a "LEAP SECONDS" record be present in one of the input RINEX file headers supplied to manyrins when pure GLONASS files are processed. If not present, manyrins will issue a warning message, and will not convert the GLONASS times. It is not recommended that the output file be used if the warning message is issued.

Depending upon the application, the user may wish to apply finer time system corrections to the observed times. To support this option, the time system identity of each input RINEX file is supplied in the manyrins.txt "b" records.


Shortcomings

This is "no frills" software. There are no warranties of any sort. No Windows GUI. Just the core function.

manyrins is built to merge single-day files on the same day. Unexpected behaviors will occur if RINEX files spanning two or more days are encountered.


Source Code and Binary Executable

The Fortran source code is manyrins.for.

The compiled executable (zipped) is manyrins.exe.


Links to Other Pages

Sources of RINEX GPS base station data

Merge GPS data in time




Acknowledgement

This work is dedicated to Dr. Clyde Goad, a retired National Geodetic Survey colleague, who outlined the concept of this program.


To Contact Me

My e-mail user name is the first initial of my first name followed by all the letters of my last name (see above). My ISP is "comcast", and it is a "dot-net", not a "dot-com". Sorry for not spelling out my e-mail address, but I try to keep the spam-bots from fingering me. But, just so the spam-bots don't feel left out, they can always go to abuse@comcast.net


Back To Home