A pure Python reader for the EnSight Gold format
Project description
ensight-reader
This library provides a pure Python reader (with some writing capability) for the EnSight Gold data format,
a common format for results of computational fluid dynamics (CFD) simulations.
It also comes with a few CLI tools, notably ensight_transform
which
allows you to perform in-place scaling/translation/etc. of the geometry in your case.
The library designed for efficient, selective, memory-mapped access to data from EnSight Gold case –
something that would be useful when importing the data into other systems. If you're looking for a more "batteries included" solution, look at
vtkEnSightGoldBinaryReader
from the VTK library (see docs for comparison).
Requirements
- Python 3.9+
- NumPy 1.21+
Installation
pip install ensight-reader
Example – Python API
import ensightreader
import numpy as np
case = ensightreader.read_case("example.case")
geofile = case.get_geometry_model()
part_names = geofile.get_part_names() # ["internalMesh", ...]
part = geofile.get_part_by_name(part_names[0])
N = part.number_of_nodes
with geofile.open() as fp_geo:
node_coordinates = part.read_nodes(fp_geo) # np.ndarray((N, 3), dtype=np.float32)
variable = case.get_variable("UMean")
with variable.mmap_writable() as mm_var:
data = variable.read_node_data(mm_var, part.part_id)
data[:] = np.sqrt(data) # transform variable data in-place
Example – CLI
# increment X coordinate
ensight_transform --translate 1 0 0 sphere.case
# scale by 1000 (eg. m -> mm conversion)
ensight_transform --scale 1e3 1e3 1e3 sphere.case
# rotation matrix
ensight_transform --matrix \
0 -1 0 0 \
1 0 0 0 \
0 0 1 0 \
0 0 0 1 \
sphere.case
# transform only "internalMesh" part
ensight_transform --translate 1 0 0 --only-parts internalMesh motorbike.case
To learn more, please see the documentation.
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
Built Distribution
File details
Details for the file ensight_reader-0.11.2.tar.gz
.
File metadata
- Download URL: ensight_reader-0.11.2.tar.gz
- Upload date:
- Size: 29.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 364fcc4f8ccf1c195455c62641eaf921ff4ba14994c46eb1c46d305bee8aec63 |
|
MD5 | b2d27d5a1efc8e0d254dd420768c60aa |
|
BLAKE2b-256 | eb23ebc133517894b9b498543da91647b60a78371606a327abf1200732de6b31 |
File details
Details for the file ensight_reader-0.11.2-py3-none-any.whl
.
File metadata
- Download URL: ensight_reader-0.11.2-py3-none-any.whl
- Upload date:
- Size: 25.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b39ece40f29c5fc16cb651cea3dc578911c73e9ee26de25f8518d8d0904dcba5 |
|
MD5 | 8c2f87922fe98689c7272a29eea64099 |
|
BLAKE2b-256 | 998f689f826973cb567e8cf1ebaa6c6ca533513867386f7b985fc61c2838fcff |