I/O for ISIS files in Python
Project description
IOISIS - I/O tools for converting ISIS data in Python
This is a Python library with command line interface intended to access data from ISIS database files and convert file formats.
Command Line Interface (CLI)
To use the CLI command, use ioisis
or python -m ioisis
.
Examples:
# Read file.mst (and file.xrf) to a JSONL in the standard output stream
ioisis mst2jsonl file.mst
# Convert file.iso to an ASCII file.jsonl
ioisis iso2jsonl --jenc ascii file.iso file.jsonl
# Convert file.jsonl to file.iso where the JSON lines are like
# {"tag": ["field", ...], ...}
ioisis jsonl2iso file.jsonl file.iso
# Indirectly, convert file.mst to file.iso using jq
ioisis mst2jsonl file.mst \
| jq -c 'del(.active) | del(.mfn)' \
| ioisis jsonl2iso - file.iso
By default, the input and output are the standard streams, but for MST+XRF input, where the MST must be given and the matching XRF will be found based on the file name.
Try ioisis --help
for more information.
Library
To load ISIS data, you can use the iter_records
function
of the respective module:
from ioisis import iso, mst
# For MST files, you must use the filename
for record_dict in mst.iter_records("file.mst"):
...
# For ISO files, you can either use a file name
# or any file-like object open in "rb" mode
with open("file.iso", "rb") as raw_iso_file:
for record_dict in iso.iter_records(raw_iso_file):
...
One can generate a single ISO record from a dict of data:
>>> from ioisis import iso
>>> iso.dict2bytes({"1": ["testing"], "8": ["it"]})
b'000610000000000490004500001000800000008000300008#testing#it##\n'
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
ioisis-0.1.0.tar.gz
(8.4 kB
view details)
File details
Details for the file ioisis-0.1.0.tar.gz
.
File metadata
- Download URL: ioisis-0.1.0.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb2f4922a0d16b30b56c9d40a228cab108a60ac24a89f1001470451fcf4035b7 |
|
MD5 | 178e5c084114ea778f3b84fe04bd35a5 |
|
BLAKE2b-256 | 37222e8b6022181ad73dbe089c96a7399850d86546322f87689bd1de99051de5 |