Skip to main content

A pure Python reader for the EnSight Gold format

Project description

CI - build CI - coverage MyPy & Ruffle checked PyPI - Version PyPI - Status PyPI - Python Version License

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.22+

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

ensight_reader-0.13.1.tar.gz (37.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ensight_reader-0.13.1-py3-none-any.whl (33.2 kB view details)

Uploaded Python 3

File details

Details for the file ensight_reader-0.13.1.tar.gz.

File metadata

  • Download URL: ensight_reader-0.13.1.tar.gz
  • Upload date:
  • Size: 37.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for ensight_reader-0.13.1.tar.gz
Algorithm Hash digest
SHA256 1d4b3c0040345d1f78dc7209a6669e68e8a77c763c7c7c2b7e07678dea41920a
MD5 9aebcc314517632b70650f7e175f345a
BLAKE2b-256 b19e0ea8e1a20d956253fb0a2b30e08a845df19ef5afa6a5c53874ecb5f6d2c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ensight_reader-0.13.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6d04aa3ac12c6b458b955a1af17843b1b21d7402b3272ae2f543c6badaa59151
MD5 027d75ae3a8634b85161596564a9daa6
BLAKE2b-256 424add927eb1f8d68a85cac0f659bdefb8fdde7be23a95281cad31aa049c3015

See more details on using hashes here.

Supported by

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