Skip to content

OpenAgriTech/rinex-merger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RINEX Merger

A Python tool for merging multiple RINEX (Receiver Independent Exchange Format) observation files into a single file. Supports both RINEX version 2 and version 3 observation files, including compressed RINEX format (.crx).

Features

  • Merge multiple RINEX files into a single output file
  • Automatic version detection for RINEX v2 and v3 files
  • Chronological sorting of epochs (configurable)
  • Duplicate timestamp handling with multiple strategies
  • Header merging with proper time range updates
  • Compressed RINEX support (.crx files)

Requirements

  • Python 3.12 or higher
  • uv (recommended for dependency management)
  • georinex (dependency)

Installation

Using uv (Recommended)

This project uses uv for dependency management. If you have uv installed, simply run:

uv sync

This will install all required dependencies as specified in pyproject.toml.

Manual Installation

If you prefer not to use uv, you can install the dependency manually:

pip install georinex>=1.16.2

Usage

Basic Usage

Merge multiple RINEX files into one:

uv run merge_rinex.py -i file1.rnx file2.rnx file3.rnx -o merged.obs

Using Glob Patterns

On Linux/macOS, you can use shell glob patterns:

uv run merge_rinex.py -i /path/to/rinex/dir/*.rnx -o merged.obs

On Windows, use PowerShell's Get-Item:

uv run merge_rinex.py -i (get-item rinex\*.crx) -o merged.obs

Command-Line Options

Option Description
-i, --input Input RINEX files (required). Accepts multiple files.
-o, --output Output merged RINEX file path (required).
--no-sort Preserve original epoch order instead of sorting chronologically.
--duplicates Strategy for duplicate timestamps: keep_first (default), keep_last, or keep_all.
-q, --quiet Suppress progress output.

Examples

Merge with default settings (sorted, keep first duplicate):

uv run merge_rinex.py -i file1.crx file2.crx file3.crx -o merged.obs

Merge without sorting epochs:

uv run merge_rinex.py -i file1.rnx file2.rnx -o merged.rnx --no-sort

Merge keeping last occurrence of duplicates:

uv run merge_rinex.py -i *.crx -o merged.obs --duplicates keep_last

Merge in quiet mode (no progress output):

uv run merge_rinex.py -i file1.rnx file2.rnx -o merged.obs -q

Important Notes

  • File compatibility: Input files must share the same marker name, receiver, and antenna for a clean merge.
  • Epoch sorting: Epochs are sorted chronologically by default. Use --no-sort to preserve the original order.
  • Duplicate epochs: Duplicate timestamps (same epoch time) are handled based on the --duplicates strategy:
    • keep_first: Keep the first occurrence (default)
    • keep_last: Keep the last occurrence
    • keep_all: Keep every occurrence
  • Mixed versions: The tool will warn if mixed RINEX major versions (v2 and v3) are detected. The output may not be spec-compliant in such cases. Consider converting all files to the same version first.

Project Structure

rinex-merger/
├── merge_rinex.py      # Main script
├── pyproject.toml      # Project configuration and dependencies
├── uv.lock             # Dependency lock file
├── README.md           # This file
└── test_data/          # Sample RINEX files for testing

License

See LICENSE file for details.

About

A basic python script to merge RINEX files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages