Python utilities for Fullwave3D VTR model files
Project description
VTRTool
=======
maintainer: Tim Lin <tim.lin@sub-salt.com>, 2017
Python utilities for Fullwave3D VTR model files
The package contains a `vtrtool` executable, as well as a `vtrtool.py` python package
## `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 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
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
vtrtool.arrays[0]
# model property 2 (if it exists) will be available as numpy ndarray in
vtrtool.arrays[1]
# etc...
```
The following instance properties exist for VTRModel:
- `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 `(nx3, nx2, nx1)`
- `shape_fortran`: (tuple of ints) shape (fortran-based) of the models in the order `(nx1, nx2, nx3)`
- `nx1`: (int) number of cells in the 1st (fastest, usually z) dimension
- `nx2`: (int) number of cells in the 2nd (usually y) dimension
- `nx3`: (int) number of cells in the 3rd (usually x) 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 `shape` and with the number of dimensions in `num_dimensions`
Some convenience functions:
- `vtrtool.vtrfile_to_ndarray(filename, prop_index=0)` quickly takes a vtr file and returns the property specified by `prop_index` as an ndarray
- `vtrtool.print_vtr_metadata(vtrmodel_object)` takes a VTRModel object and prints dimension information to stdout
=======
maintainer: Tim Lin <tim.lin@sub-salt.com>, 2017
Python utilities for Fullwave3D VTR model files
The package contains a `vtrtool` executable, as well as a `vtrtool.py` python package
## `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 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
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
vtrtool.arrays[0]
# model property 2 (if it exists) will be available as numpy ndarray in
vtrtool.arrays[1]
# etc...
```
The following instance properties exist for VTRModel:
- `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 `(nx3, nx2, nx1)`
- `shape_fortran`: (tuple of ints) shape (fortran-based) of the models in the order `(nx1, nx2, nx3)`
- `nx1`: (int) number of cells in the 1st (fastest, usually z) dimension
- `nx2`: (int) number of cells in the 2nd (usually y) dimension
- `nx3`: (int) number of cells in the 3rd (usually x) 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 `shape` and with the number of dimensions in `num_dimensions`
Some convenience functions:
- `vtrtool.vtrfile_to_ndarray(filename, prop_index=0)` quickly takes a vtr file and returns the property specified by `prop_index` as an ndarray
- `vtrtool.print_vtr_metadata(vtrmodel_object)` takes a VTRModel object and prints dimension information to stdout
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
vtrtool-0.1.0.tar.gz
(4.6 kB
view hashes)
Built Distribution
Close
Hashes for vtrtool-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd488ff09b96fdedeadcb959a53d94b02872b255fcab0ac2f2dbae9adee30fac |
|
MD5 | 5da303a4baf303dfb24eaca2a3502cd2 |
|
BLAKE2b-256 | 98df6fedc1a4ef41782616c793ba00d549b0e19f5d33abd9b69af3e7abd598e1 |