Python utilities for Fullwave3D VTR model files
Project description
VTRTool
Python utilities for Fullwave3D VTR model files.
The package contains a vtrtool executable, as well as a vtrtool.py python package
Installation
This tool can be obtained from PyPI. Simply do:
pip install vtrtool
vtrtool executable quick usage
vtrtool -h to show usage information
vtrtool info my_model_file.vtr shows metadata info for my_model_file.vtr
vtrtool info nx1 my_model_file.vtr prints out just the size of the 1st (x) dimension for my_model_file.vtr
vtrtool to_binary --property=2 my_model_file.vtr my_model_file.bin to dump the 2nd property from my_model_file.vtr to the float32 raw binary file my_model_file.bin
vtrtool to_stdout my_model_file.vtr to pipe the 1st property (default) from my_model_file.vtr to stdout in raw float32 binary format
vtrtool.py Python module quick usage
The vtrtool.VTRModel class represents a vtr model that lives at a given filename. The file will be parsed on object initialization:
import vtrtool
# read the vtr file `my_model_file.vtr` and construct a new VTRModel object with it
vtr_model = vtrtool.VTRModel("my_model_file.vtr")
# print model properties to stdout
vtrtool.print_vtr_metadata(vtr_model)
# model property 1 will be available as numpy ndarray in
vtr_model.arrays[0]
# model property 2 (if it exists) will be available as numpy ndarray in
vtr_model.arrays[1]
# etc...
Set the optional keyword use_memmap=True if you want the VTRModel object to use a NumPy memmap instead of in-memory representation for holding the model array.
The following instance properties exist for objects of the VTRModel class:
- file: (str) the vtr filename referenced by the VTRModel object
- num_dimensions: (int) number of dimensions in the model
- num_attributes: (int) number of properties in the model
- shape: (tuple of ints) shape (c-based) of numpy ndarray holding the models in the order
(nx1, nx2, nx3) - shape_fortran: (tuple of ints) shape (fortran-based) of the models in the order
(nx3, nx2, nx1) - nx1: (int) number of cells in the 1st (usually x) dimension
- nx2: (int) number of cells in the 2nd (usually y) dimension
- nx3: (int) number of cells in the 3rd (fastest, usually z) dimension
- arrays: (list of ndarrays) holds the model property ndarrays, the length of the list correspond to the number of model properties (i.e., property 1 is in model[0]), and the shape of the ndarray will correspond to
shapeand with the number of dimensions innum_dimensions
Some convenience functions:
vtrtool.vtrfile_to_ndarray(filename, prop_index=0)quickly takes a vtr file and returns the property specified byprop_indexas an ndarrayvtrtool.print_vtr_metadata(vtrmodel_object)takes a VTRModel object and prints dimension information to stdout
Maintained by
Tim Lin tlin@s-cube.com, 2017
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 Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vtrtool-0.7.tar.gz.
File metadata
- Download URL: vtrtool-0.7.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/2.7.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c683cb3ddb957699000b6f7976d8527f0344cc02164085510e3257e302899bf
|
|
| MD5 |
6310edb4b5966cf8d3e6d75b0ff0b40d
|
|
| BLAKE2b-256 |
8d1b251ea8c0c63291cfbf42cddc70eea3cbdc42166bcd7cc90b178a4d70d820
|
File details
Details for the file vtrtool-0.7-py2.py3-none-any.whl.
File metadata
- Download URL: vtrtool-0.7-py2.py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/2.7.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae76c27383c482957d73d6a5274ec3f26931750d0d2c09f09ef5a09ad13e3b4d
|
|
| MD5 |
e689788fcaf0584e022ef70c4609b33f
|
|
| BLAKE2b-256 |
1d4109ed368334d4486da5c96729cb8aa3fe89a31c491f68a083f7de20c6f7fc
|