Effortlessly compress / decompress any RINEX file
Project description
Hatanaka
Effortless compression / decompression of RINEX files in Python and on the command line.
Supports all compression formats allowed by the RINEX 2 and 3 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'
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for hatanaka-2.0.0-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bd73d395af1bc10c8662b0a97b60815073640811dbc7d234d38b55890c03bfd |
|
MD5 | 7cc0b154dfb4e2dc3f91050e2499696c |
|
BLAKE2b-256 | 0ed18e51f959fb6aa9372aee2670ec257a43d64949c376523dd419b40ea8a1a6 |
Hashes for hatanaka-2.0.0-py3-none-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9e663e50f9c82458e1496bcf2d7d7366515eaa9e2d94f8dd6ccad0f844b357e |
|
MD5 | e8267f8dee37636dbe7cc6f20f8deb07 |
|
BLAKE2b-256 | 068a4e7d0eeb55bf99c511625082e8fae072d207812b4bc2524fe7f3679d600e |
Hashes for hatanaka-2.0.0-py3-none-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a02ef20e5c70ef96c2a369b84e1fa4c8d5c9e7a1a165c40c54614706ed8ac39a |
|
MD5 | 9895f0adda01f97dffdda62a9af7be66 |
|
BLAKE2b-256 | ce3315a8d4ddf991ef221d0a5444c055565b2c80a62ac84a901b49099905fbbd |