Changing run options on command line program
Adding options to TPS2RIN.exe file to convert Topcon .tps file to RINEX
This post discusses software used with navigational satellite systems (e.g., GPS, GLONASS), but the concept of using runtime options to modify default behavior can be applied to many other programs as well.
Changing how a program runs by default can be useful for various reasons. If you frequently use the same runtime options, creating a shortcut with those custom settings can save time. This allows you to choose between running the program with either its default settings or with your customized options. However, this method only works if the program supports runtime options.
In surveying, one common task involves setting up a receiver at a specific location to log satellite data over several hours. This data is then processed for Precise Point Positioning (PPP) to refine the coordinates for accuracy. For example, I often use the NRCAN PPP service in Canada, which can be accessed here: Precise Point Positioning (NRCAN PPP Service).
After uploading your satellite data, the PPP system processes the logs and provides precise coordinates, often with accuracy down to a few centimetres.
Satellite receivers usually store data in proprietary formats, unique to each manufacturer. To submit data to a PPP system, it must be converted into the standardized RINEX (Receiver Independent Exchange) format. RINEX allows satellite navigation data to be shared between different systems and software. To convert Topcon's proprietary files to RINEX, I use a program called TPS2RIN.exe.
Before proceeding, it’s important to note that several independent navigation satellite systems exist. The major ones are GPS (USA), GLONASS (Russia), GALILEO (EU), and BeiDou (China).
When you drag and dropped Topcon files onto the TPS2RIN.exe program, it would generate two types of RINEX files: an observation file, which logs which satellites were observed and when, and a navigation file, which contains orbital data for each satellite. Navigation files were grouped by satellite system (e.g., GPS, GLONASS).
In the older versions of TPS2RIN.exe, the output included one observation file and separate navigation files for each satellite system observed. For example, if GPS, GLONASS, and GALILEO data was collected, three navigation files would be created. If only GPS was tracked, a single GPS navigation file was generated.
However, in newer versions, while a single observation file is still produced, the navigation file now combines data from all observed satellite systems into one file.
In most cases, this is not a problem, since PPP services usually only require the observation file. However, if you want the satellite-specific navigation files for validation or troubleshooting, the combined file can be limiting. For instance, if you expect to see GPS, GLONASS, and GALILEO navigation files but only get a GPS file, it could indicate a problem with the data collection. While this doesn’t guarantee the data is perfect, it’s a quick way to confirm if something went wrong.
Now that we've covered the background, let’s explore how to create a shortcut with custom output options for TPS2RIN.exe.
The first thing to do is see what runtime options are available. Open up the file explorer window where you have the TPS2RIN.exe program. Once that is open hold the SHIFT key and right click on any open space in the file explorer window. This will display a popup. In that popup menu select Open PowerShell window here. You will be presented with a PowerShell window which is similar but different from the command line.
In the PowerShell window type in
.\TPS2RIN.exe
You will be presented with the following output.
Nothing happened because the program was expecting some additional run time options. To get a list of run time options type the following into the PowerShell window.
.\TPS2RIN.exe -?
By scrolling up and down you can view all the options but sometimes it's useful to have all the information in a file for future reference. To save the output to a text file enter in the following command.
.\TPS2RIN.exe -? > TPS2RIN_Help.txt
There will now be a text file in the current directory called TPS2RIN_Help.txt which can be opened with any text editor. Double clicking on the TPS2RIN_Help.txt file should open it up in the default program.
The contents of the TPS2RIN_Help.txt is below. As you can see there are a bunch of run time options that can be used.
TPS2RIN 1.0.28.3459 Win64 build Jun 01, 2022 (c) Topcon Positioning Systems
Conversion of TPS file to RINEX.
Usage : TPS2RIN [<sw> [ <sw>]] <input file name> [<sw> [ <sw>]]
<Switches(sw)>:
-h, -?, --help Display help screen.
-v <version> Set RINEX version. Valid are 2.10, 2.11, 2.12, 3.00, 3.01, 3.02, 3.03, 3.04, 3.05, 4.00 versions.
Default version is 3.05.
-o <output dir> Output directory. Current directory used by default.
-p <Profile name> For detailed help type 'TPS2RIN -p ?'.
-i <input file> Specify input file name. Required if <input file> starts with '-' or '+'.
-s <StartTime> Start date/time. For detailed help type 'TPS2RIN -s ?'.
-f <FinishTime> Finish date/time. For detailed help type 'TPS2RIN -f ?'.
--date <CurrTime> Current date/time. For detailed help type 'TPS2RIN --date ?'.
-G Exclude all GPS satellites.
-G<nn>,-g <nn> Exclude GPS satellite G##.
+G<nn>,+g <nn> Include GPS satellite G## (used after -G).
-R Exclude all GLONASS satellites.
-R<nn>,-r <nn> Exclude GLONASS satellite R##.
+R<nn>,+r <nn> Include GLONASS satellite R## (used after -R).
-E Exclude all GALILEO satellites.
-E<nn> Exclude GALILEO satellite E##.
+E<nn> Include GALILEO satellite E## (used after -E).
-C Exclude all BeiDou satellites.
-C<nn> Exclude BeiDou satellite C##.
+C<nn> Include BeiDou satellite C## (used after -C).
-W Exclude all SBAS (WAAS) satellites, including QZSS 183-192.
-W<nn>,-S<nn>,-w <nn> Exclude SBAS (WAAS) satellite. Use Rinex ID or PRN: S20-S58 or S120-S158.
+W<nn>,+S<nn>,+w <nn> Include SBAS (WAAS) satellite (used after -W). Use Rinex ID or PRN: S20-S58 or S120-S158.
-J Exclude all QZSS satellites.
-J<nn> Exclude QZSS satellite J##. Use Rinex ID or PRN: J01-J10, J193-J202, J183-J192.
+J<nn> Include QZSS satellite J## (used after -J). Use Rinex ID or PRN: J01-J10, J193-J202, J183-J192.
-IRN Exclude all IRNSS satellites.
-IRN7 7 IRNSS satellites support only.
-I<nn> Exclude IRNSS satellite I##.
+I<nn> Include IRNSS satellite I## (used after -IRN).
-1,-2,..,-5, ..,-9 Exclude all selected band measurements from output RINEX. (For example, -1 exludes C1, L1, P1, D1, S1).
-C2 Ignore all L2C channel measurements (GPS/GLONASS only).
--no-L1C Ignore L1-C/A carrier phase/doppler/SNR (GPS/GLONASS only).
--no-L1P Ignore L1-P carrier phase/doppler/SNR (GPS/GLONASS only).
--no-L2C Ignore L2-C/A carrier phase/doppler/SNR (GPS/GLONASS only).
--no-L2P Ignore L2-P carrier phase/doppler/SNR (GPS/GLONASS only).
--no-C1C Ignore L1-C/A pseudorange (GPS/GLONASS only).
--no-C1P Ignore L1-P pseudorange (GPS/GLONASS only).
--no-C2C Ignore L2-C/A pseudorange (GPS/GLONASS only).
--no-C2P Ignore L2-P pseudorange (GPS/GLONASS only).
--no-rM Skip rM messages. Same as --skip rM.
--no-rD Skip rD messages. Same as --skip rD.
--no-rL Skip rL messages. Same as --skip rL.
--no-rS Skip rS messages. Same as --skip rS.
--use-rM Ignore all regular TPS messages, use rM messages.
--use-rD Ignore all regular TPS messages, use rD messages.
--skip <Id[,Id]> Skip list of TPS messages.
-I <sec> Interval in seconds. Floating point value is OK.
-L <n> If Leap Seconds information is missing, force Leap Seconds to <n>.
-D Exclude Doppler.
-O Include Receiver Clock Offset in epoch header lines.
--apply-clock-bias Apply Receiver Clock Offset to epoch time, carrier phases and pseudoranges.
--keep-epoch-time Option --apply-clock-bias applied to carrier phases and pseudoranges using doppler.
-S Include observation types S1,S2. Units: dB*Hz.
-~ Apply Smoothing to pseudoranges.
-M <Name> Override any Marker Name found in profile or input file.
-m <Number> Override any Marker Number found in profile or input file.
-T <Type> Override any Marker Type found in profile (GEODETIC and NON_GEODETIC mean static survey mode).
-A <Name> Override Antenna type name. For details type 'TPS2RIN -A ?'.
-a <Number> Override Antenna Serial # found in profile or input file.
--slant <r>,<v> Convert antenna height from SLANT to VERTICAL: r - radius, mm; v - C1-A1, mm.
--meteo-model <model>
-Met.Model <model> Override Meteo Device Model found in profile.
--meteo-type <type>
-Met.Type <type> Override Meteo Device Type found in profile.
--sn Prefer to output receiver serial number instead of receiver id.
-= Ignore User Events. For details type .TPS2RIN -= ?'.
-XYZ <X> <Y> <Z> Override approximate XYZ calculated from raw position or given in profile.
-c Use Hatanaka Compression.
-N <ABCD> Short Marker Name alias for Marker Name.
--lfn <R,CAN,00> Use long file name format. R is data source, CAN - country code,
00 - station code (monument 0-9 and receiver 0-9 numbers).
--file-period <n> Rotation File period in seconds for file name generation.
--doi Digital Object Identifier (DOI) for data citation.
--license Name of the license or link to the specific version of the license.
--station-info The link to persistent URL with the station metadata.
--no-cnav Don't use common navigational file for RINEX 3.0.
--no-obs Don't create observation file.
--no-eph Don't create ephemeris files.
--no-meteo Don't create meteo file.
--no-tilt Don't create angular file.
--no-extra Don't create any extra files except observation and ephemeris.
--sort Sort satellites in epochs.
--keep-eph Keep all present ephemeris.
--sort-eph Sort ephemeris by satellites and time.
--binex Input stream contains BINEX messages.
--binex-use <##> Select measurements from given subrecord ## of record 7F.
Subrecords 00, 02, 03 and 05 are supported.
--binex-skip <##> Skip record ##. May use several times.
--binex-7F05-fmt Format for record 7F subrecord 05 RxClkOff field.
Valid values are "s+21b" or "2c22b" (default).
--log <log file> Write log file. Use '-' for writing to stdout.
--preview Scan the file and print a short summary.
--print Print all TPS messages to the log file.
--utf8 Log file has UTF-8 charset.
The option to output individual navigation files is
--no-cnav Don't use common navigational file for RINEX 3.0.
To review the available options in the future open the TPS2RIN_Help.txt file.
The next step is to create a shortcut with the --no-cnav
option. In the file explorer where the TPS2RIN.exe program is located right click on the TPS2RIN.exe program and select create shortcut.
This will create a shortcut in the current directory. Both the TPS2RIN.exe
program and the shortcut will have the same name, but you can differentiate between them based on the icon and file size.
Now, let’s modify the options used by the shortcut. Right-click the TPS2RIN.exe
shortcut and select Properties.
In the Properties window, focus on two key fields:
Target: This is where you will add the command line options.
Start In: This is used to specify the directory where the output files will be saved.
To add the --no-cnav
option, append it to the end of the command in the Target field. Make sure to place it outside of the quotation marks ("
).
If you mistakenly place --no-cnav
inside the quotation marks, you’ll encounter an error because the system will look for a program named tps2rin.exe --no-cnav
, which doesn’t exist.
After adding the command-line option to the Target field, the next step is to specify where the output files should be saved. There are two ways to achieve this: by using an additional command-line option or by modifying the Start In field in the shortcut. Since we're already working with the shortcut, we'll use the second method and update the Start In field.
Before modifying the Start In field, ensure the directory where the files will be saved exists. If it doesn’t, you’ll receive an error stating that the directory does not exist.
To create the directory, right-click inside the current folder where the shortcut is located, select New -> Folder
.
This will create a new folder in the current directory which I'm going to rename to Output
Once the folder is created, go back to the shortcut's properties and modify the Start In field to include the newly created \Output
folder. Make sure the path is placed inside the quotation marks. If there's a typo in the directory name, you'll see the "directory does not exist" error.
After entering values in the Target and Start In fields, click 'OK.' If everything is correct, the properties window will close without any errors."
To test the setup, drag and drop a .tps
file onto the newly created shortcut. A command window will briefly appear, and you can verify success by checking the Output
folder for the .g
, .n
, and .o
files.
You now have two options to run the TPS2RIN.exe program. With default settings by dragging the .tps
file onto tps2rin.exe
, or dragging the .tps
file onto the shortcut to run the program with custom options.