Skip to content

Command line tool to decode binary UKAEA CuV posvol files and convert the data to UTF-8 or JSON formats.

License

Notifications You must be signed in to change notification settings

repositony/posvol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A posvol file reader (posvol)

Command line tool to inspect and convert UKAEA CuV posvol files.

Usage: posvol <file> [options]

Arguments:
  <file>  Path to posvol binary file

Options:
  -v, --verbose...  Verbose logging (-v, -vv)
  -q, --quiet       Supress all log output (overrules --verbose)
  -h, --help        Print help (see more with '--help')

Conversion options:
  -o, --output <name>  Name of output files [default: posvol]
  -j, --json           Generate a JSON file
  -a, --ascii          Generate an ASCII file
  -p, --pretty         Format the ASCII file for readability

Note: --help shows more information and examples

Help is printed with the -h flag, and --help will show examples, default values, examples, and any important behaviour.

Install

Direct from github:

cargo install --git https://github.com/repositony/posvol.git

All executables are under ~/.cargo/bin/, which should already be in your path after installing Rust.

Click here if you have never used Rust

If you have never used the Rust programming language, the toolchain is easily installed from the official website

Unix (Linux/MacOS)

Run the following to download and run rustup-init.sh, which will install the Rust toolchain for your platform.

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

This should have added source $HOME/.cargo/env to the bash profile, so update your environment with source ~/.bashrc.

Windows

On Windows, download and run rustup-init.exe from the official installs.

Description

Very simple reader for UKAEA CuV posvol binaries, skipping the need to open a special viewer or sort it out manually just to check simple properties.

Allows for conversion to:

  • 1:1 conversion text file
  • Human-readable text file
  • JSON data format

The endian is assumed to be the same as the native type of the system this tool is run on. If needed, an option can be provided in future updates.

Examples

Print a summary

By default, a simple summary of the posvol dimensions is logged when no arguments are provided.

# Print a summary of dimension properties
posvol plot_fmesh_104.bin

Convert 1:1 to ASCII integers

It can be useful just to have something that can be open and read, so --ascii converts the binary to a text file.

# Output a file named 'posvol.txt'
posvol plot_fmesh_104.bin --ascii

Convert to readable text format

For somthing a bit more human-friendly, the dimensions are split up and cells grouped into single voxels separated by blank lines.

# Output a file named 'posvol.txt'
posvol plot_fmesh_104.bin --ascii --pretty

Convert to JSON file

For lovers of python and other languages there is a JSON output option to make the underlying data more portable.

# Output a file named 'posvol.json'
posvol plot_fmesh_104.bin --json

Change the output file names

By default the file names are 'posvol.txt' for ascii file formats, and 'posvol.json' for a json format.

This can be changed by providing --output with a name.

# Output two files named 'myfile.txt' and 'myfile.json'
posvol plot_fmesh_104.bin       \
            --json              \
            --ascii             \
            --output myfile

About

Command line tool to decode binary UKAEA CuV posvol files and convert the data to UTF-8 or JSON formats.

Topics

Resources

License

Stars

Watchers

Forks

Languages