Skip to main content

Read and manipulate Universal Tracking Data Format (UTDF) spacecraft tracking data

Project description

UTDFpy

A Python library for reading and manipulating Universal Tracking Data Format (UTDF) satellite tracking data.

A direct conversion of https://github.com/trwyant/perl-Astro-UTDF. Thanks go to https://github.com/trwyant for creating the Perl module.

Binary Format

UTDF records are 75-byte big-endian binary structures. The library uses explicit big-endian unpacking (struct format >), so it produces identical results on any architecture (arm64, amd64, etc.).

Prerequisites

  • Task (task runner)
  • Docker (or Podman)

Development

All development tasks run inside a Docker container via Taskfile.yaml. To use Podman instead of Docker:

task tests CONTAINER_BIN=podman

Available tasks

task tests          # Run lint, format check, typecheck, then pytest
task tests:cov      # Run tests with coverage report
task lint           # Run ruff linter
task lint:fix       # Run ruff linter with auto-fix (modifies host files)
task format         # Run ruff formatter (modifies host files)
task format:check   # Check formatting without changes
task typecheck      # Run mypy type checking
task check          # Run all checks (lint, format, typecheck, tests)
task build          # Build distribution packages
task publish        # Build and publish package to PyPI
task utdfpy:install            # Install utdfpy from PyPI into local venv
task utdfpy:install:from:local # Install utdfpy from local source (editable)
task example_utdf              # Run read_utdf.py example against test data
task utdf-cli                  # Run interactive UTDF query tool
task github:actions:test       # Run GitHub Actions locally with act (alias: act)
task clean                     # Remove build artifacts and caches
task clean:all                 # Remove everything including Docker image

Task dependency chain

tests depends on lint, format:check, and typecheck, each of which depends on docker:build. Running task tests will automatically build the Docker image, run the linter, check formatting, and run mypy before executing the test suite. publish depends on tests, so it runs the full check suite before uploading to PyPI.

Installation

pip install utdfpy

Or for development:

pip install -e '.[dev]'

Usage

from utdfpy import UTDFRecord

# Read all records from a UTDF file
records = UTDFRecord.slurp("tracking_data.utd")

for record in records:
    print(record.sic, record.vid, record.decode("measurement_time"))
    print(f"  azimuth:  {record.azimuth}")
    print(f"  elevation: {record.elevation}")
    print(f"  range:    {record.range}")

Example script

$ .venv/bin/python examples/read_utdf.py tests/data/data.utd
Read 2 records from tests/data/data.utd

Record 0:
  SIC:             86
  VID:             99
  Time:            2010-03-19T01:01:30+00:00
  Azimuth:         5.839702317578685
  Azimuth (deg):   334.5397498011498
  Elevation:       0.9403839735099665
  Elevation (deg): 53.877694653498
  Range (km):      425.12365727401914

Record 1:
  SIC:             86
  VID:             99
  Time:            2010-03-19T01:01:31+00:00
  Azimuth:         5.852690026751761
  Azimuth (deg):   335.28364953218365
  Elevation:       0.9534989112054779
  Elevation (deg): 54.62862629867479
  Range (km):      421.4236702842119

CLI tool

An interactive query tool is included:

utdf-cli tracking_data.utd

Commands: load, count, select, next, list, or type any field name to inspect it.

Running GitHub Actions locally

You can run the CI jobs locally using act. On macOS, Docker Desktop fails due to its containerd image store, so use Podman instead:

task clean:all act CONTAINER_BIN=podman

This will clean all artifacts, rebuild the container image with Podman, and run the test, lint, and typecheck jobs locally.

To run without a full clean:

task act CONTAINER_BIN=podman

CI/CD

  • GitHub Actions (.github/workflows/ci.yaml): runs lint, tests, and typecheck on push/PR; auto-creates a release and publishes to PyPI when the version in pyproject.toml changes.
  • GitLab CI (.gitlab-ci.yaml): runs lint, tests (Python 3.10-3.13), and typecheck; publishes to PyPI on version tags.

License

Artistic-2.0 OR GPL-1.0-or-later (same as the original Perl module).

Architecture

classDiagram
    class UTDFRecord {
        -bytes _front
        -str _router
        -int _year
        -int _sic
        -int _vid
        -int _seconds_of_year
        -int _microseconds_of_year
        -float _transponder_latency
        -bool _enforce_validity
        -UTDFRecord _prior_record
        -float _factor_K
        -float _factor_M
        +azimuth() float
        +elevation() float
        +range_delay() float
        +doppler_count() float
        +doppler_shift() float
        +range() float
        +range_rate() float
        +measurement_time() float
        +transmit_frequency() int
        +raw_record() bytes
        +hex_record() str
        +clone() UTDFRecord
        +slurp(file) list~UTDFRecord~
        +iter_file(file) Iterator~UTDFRecord~
        +decode(field_name) str
    }

    class UTDFError {
        <<exception>>
    }

    class InvalidRecordError {
        <<exception>>
    }

    class FrequencyBand {
        <<IntEnum>>
        UNSPECIFIED
        VHF
        UHF
        S_BAND
        C_BAND
        X_BAND
        KU_BAND
        VISIBLE
    }

    class TransmissionType {
        <<IntEnum>>
        TEST
        SIMULATED
        RESUBMIT
        REAL_TIME
        PLAYBACK
    }

    class TrackingMode {
        <<IntEnum>>
        AUTOTRACK
        PROGRAM_TRACK
        MANUAL
        SLAVED
    }

    class TrackerType {
        <<IntEnum>>
        C_BAND_PULSE
        SRE
        SGLS
        TDRSS
    }

    class AntennaGeometry {
        <<IntEnum>>
        AZ_EL
        XY_SOUTH
        XY_EAST
        RA_DEC
        HR_DEC
    }

    Exception <|-- UTDFError
    UTDFError <|-- InvalidRecordError
    UTDFRecord --> UTDFRecord : prior_record
    UTDFRecord ..> InvalidRecordError : raises
    UTDFRecord ..> parsing : uses
    UTDFRecord ..> decode : uses

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

utdfpy-0.1.3.tar.gz (31.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

utdfpy-0.1.3-py3-none-any.whl (27.0 kB view details)

Uploaded Python 3

File details

Details for the file utdfpy-0.1.3.tar.gz.

File metadata

  • Download URL: utdfpy-0.1.3.tar.gz
  • Upload date:
  • Size: 31.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for utdfpy-0.1.3.tar.gz
Algorithm Hash digest
SHA256 9e125ca10b31d1f7723ae5b7d443a9dfda92c6cbe1ca00f8cc46c8b59a6e970d
MD5 e564d0c86e22acdb21f326559f632c6d
BLAKE2b-256 5a4a7107e141c4e5ec384570befdc010158b24bfaa3295dd5b045e020d92e83e

See more details on using hashes here.

Provenance

The following attestation bundles were made for utdfpy-0.1.3.tar.gz:

Publisher: ci.yaml on haisamido/UTDFpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file utdfpy-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: utdfpy-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 27.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for utdfpy-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1903eb4067e13be2379362a9c607a8d8d8b2a26215f9cb27ddea917f640402f7
MD5 6683053a6b6ae1592f8e97599728cd14
BLAKE2b-256 34fab0ecfb076db7aacd3ef0e10dbf47f454f409be8f664127601eb78a14cda8

See more details on using hashes here.

Provenance

The following attestation bundles were made for utdfpy-0.1.3-py3-none-any.whl:

Publisher: ci.yaml on haisamido/UTDFpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page