Skip to main content

Effortlessly compress / decompress any RINEX file

Project description

Hatanaka Build codecov PyPI PyPI - Downloads

Effortless compression / decompression of RINEX files in Python and on the command line.

Supports all compression formats allowed by the RINEX 2, 3 and 4 standards:

  • Hatanaka compression for Observation Data Files,
  • LZW (.Z), gzip (.gz), bzip2 (.bz2) and .zip.

Quick Start

Installation

Wheels are available from PyPI for Linux, MacOS and Windows. Python versions 3.6 and up are supported.

pip install hatanaka

To ensure that everything is working as expected, it is recommended to also run the included tests.

pip install pytest
pytest --pyargs hatanaka

Python

import hatanaka
from pathlib import Path

# decompression
rinex_data = hatanaka.decompress('1lsu0010.21d.Z')
# or
rinex_data = hatanaka.decompress(Path('1lsu0010.21d.Z').read_bytes())
# or, creates '1lsu0010.21o' directly on disk
hatanaka.decompress_on_disk('1lsu0010.21d.Z')

# compression
Path('1lsu0010.21d.gz').write_bytes(hatanaka.compress(rinex_data))
# or
Path('1lsu0010.21d.gz').write_bytes(hatanaka.compress('1lsu0010.21o'))
# or, creates '1lsu0010.21d.gz' directly on disk
hatanaka.compress_on_disk('1lsu0010.21o')

Any errors during Hatanaka compression/decompression will be raised as a HatanakaException and any non-critical problems reported as warnings.

These functions are idempotent – already decompressed / compressed data is returned as is.

CLI

The same functionality is also made available from the command line via rinex-decompress and rinex-compress.

Simply provide a list of RINEX files to compress or decompress. stdin-stdout is used if no files are specified.

To remove the original files after conversion, add -d/--delete. The input file is removed only if conversion succeeds without any errors or warnings.

# creates 1lsu0010.21o
rinex-decompress 1lsu0010.21d.Z

# creates 1lsu0010.21d.gz
rinex-compress 1lsu0010.21o

# stdin-stdout example
rinex-decompress < 1lsu0010.21d.Z | grep 'SYS / # / OBS TYPES'

Additionally, the original rnx2crx and crx2rnx executables are also installed for other tools that might want to make use of them, such as RTKLIB.

Development

Building from source

Installing from source code is also an option, in which case the RNXCMP tools will be built in the process. This assumes a C compiler is available and is usually picked up automatically by Python's setuptools. If that is not the case, you can instead provide a path to one by setting the CC environment variable.

pip install git+https://github.com/valgur/hatanaka

Changes

See CHANGELOG.md.

Attribution

Martin Valgur – this Python library.

RNXCMP software for Hatanaka compression support:
Hatanaka, Y. (2008), A Compression Format and Tools for GNSS Observation Data, Bulletin of the Geospatioal Information Authority of Japan, 55, 21-30. (available at https://www.gsi.go.jp/ENGLISH/Bulletin55.html)

License

This library is provided under the MIT license. Additional license terms apply for the included RNXCMP software – see LICENSE.

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

hatanaka-2.8.1.tar.gz (41.2 kB view hashes)

Uploaded Source

Built Distributions

hatanaka-2.8.1-py3-none-win_arm64.whl (55.3 kB view hashes)

Uploaded Python 3 Windows ARM64

hatanaka-2.8.1-py3-none-win_amd64.whl (55.3 kB view hashes)

Uploaded Python 3 Windows x86-64

hatanaka-2.8.1-py3-none-win32.whl (52.3 kB view hashes)

Uploaded Python 3 Windows x86

hatanaka-2.8.1-py3-none-musllinux_1_1_x86_64.whl (56.4 kB view hashes)

Uploaded Python 3 musllinux: musl 1.1+ x86-64

hatanaka-2.8.1-py3-none-musllinux_1_1_s390x.whl (57.3 kB view hashes)

Uploaded Python 3 musllinux: musl 1.1+ s390x

hatanaka-2.8.1-py3-none-musllinux_1_1_ppc64le.whl (61.5 kB view hashes)

Uploaded Python 3 musllinux: musl 1.1+ ppc64le

hatanaka-2.8.1-py3-none-musllinux_1_1_i686.whl (57.8 kB view hashes)

Uploaded Python 3 musllinux: musl 1.1+ i686

hatanaka-2.8.1-py3-none-musllinux_1_1_aarch64.whl (57.5 kB view hashes)

Uploaded Python 3 musllinux: musl 1.1+ ARM64

hatanaka-2.8.1-py3-none-manylinux_2_17_s390x.whl (53.6 kB view hashes)

Uploaded Python 3 manylinux: glibc 2.17+ s390x

hatanaka-2.8.1-py3-none-manylinux_2_17_ppc64le.whl (57.1 kB view hashes)

Uploaded Python 3 manylinux: glibc 2.17+ ppc64le

hatanaka-2.8.1-py3-none-manylinux_2_17_aarch64.whl (53.9 kB view hashes)

Uploaded Python 3 manylinux: glibc 2.17+ ARM64

hatanaka-2.8.1-py3-none-manylinux_2_5_x86_64.whl (52.7 kB view hashes)

Uploaded Python 3 manylinux: glibc 2.5+ x86-64

hatanaka-2.8.1-py3-none-manylinux_2_5_i686.whl (52.6 kB view hashes)

Uploaded Python 3 manylinux: glibc 2.5+ i686

hatanaka-2.8.1-py3-none-macosx_11_0_arm64.whl (50.7 kB view hashes)

Uploaded Python 3 macOS 11.0+ ARM64

hatanaka-2.8.1-py3-none-macosx_10_9_x86_64.whl (50.1 kB view hashes)

Uploaded Python 3 macOS 10.9+ x86-64

hatanaka-2.8.1-py3-none-macosx_10_9_universal2.whl (74.3 kB view hashes)

Uploaded Python 3 macOS 10.9+ universal2 (ARM64, x86-64)

Supported by

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