Skip to main content

A pure Python reader for the EnSight Gold format

Project description

PyPI - Version PyPI - Status PyPI - Python Version License

ensight-reader

This library provides a pure Python reader 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_coordinates(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

ensight-reader-0.10.0.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

ensight_reader-0.10.0-py3-none-any.whl (22.7 kB view details)

Uploaded Python 3

File details

Details for the file ensight-reader-0.10.0.tar.gz.

File metadata

  • Download URL: ensight-reader-0.10.0.tar.gz
  • Upload date:
  • Size: 20.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.5

File hashes

Hashes for ensight-reader-0.10.0.tar.gz
Algorithm Hash digest
SHA256 a6bf7e68cc4d2e071ac05abc1c3aedaa60199e629249d638c1672f1b17a6423c
MD5 94e344d4df8ad1870fa7dd3dc4cd5c8b
BLAKE2b-256 cd4bb46f8fc72982503419960e9ec2cf37a4f9e7040e5f0522310be1ed794798

See more details on using hashes here.

File details

Details for the file ensight_reader-0.10.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ensight_reader-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5e817b59fb9fdb11ded999412dc0d4fe9357b06f442683c3072d54fd950f0ec0
MD5 b5522efb139158d9551a2f66b39d777e
BLAKE2b-256 3653bd4a79617c2173fb83e5ea87e46a9e5f56088a4643d588d60e80835f1ed0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page