ensight-reader


Nameensight-reader JSON
Version 0.12.0 PyPI version JSON
download
home_pagehttps://github.com/tkarabela/ensight-reader
SummaryA pure Python reader for the EnSight Gold format
upload_time2025-01-10 21:30:36
maintainerNone
docs_urlNone
authorTomas Karabela
requires_python>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements numpy
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![CI - build](https://img.shields.io/github/actions/workflow/status/tkarabela/ensight-reader/main.yml?branch=master)](https://github.com/tkarabela/ensight-reader/actions)
[![CI - coverage](https://img.shields.io/codecov/c/github/tkarabela/ensight-reader)](https://app.codecov.io/github/tkarabela/ensight-reader)
[![MyPy & Ruffle checked](https://img.shields.io/badge/MyPy%20%26%20Ruffle-checked-blue?style=flat)](https://github.com/tkarabela/pysubs2/actions)
![PyPI - Version](https://img.shields.io/pypi/v/ensight-reader.svg?style=flat)
![PyPI - Status](https://img.shields.io/pypi/status/ensight-reader.svg?style=flat)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ensight-reader.svg?style=flat)
![License](https://img.shields.io/pypi/l/ensight-reader.svg?style=flat)

# 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`](https://vtk.org/doc/nightly/html/classvtkEnSightGoldBinaryReader.html)
from the VTK library ([see docs for comparison](https://ensight-reader.readthedocs.io/en/latest/design-howto.html#comparison-with-vtk-library)).

### Requirements

- Python 3.9+
- NumPy 1.21+

### Installation

```sh
pip install ensight-reader
```

### Example – Python API

```python
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

```sh
# 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](https://ensight-reader.readthedocs.io).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/tkarabela/ensight-reader",
    "name": "ensight-reader",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Tomas Karabela",
    "author_email": "tkarabela@seznam.cz",
    "download_url": "https://files.pythonhosted.org/packages/9a/78/9d8f40a40adba260531fb100413b75c092b4a578fc7e6ededd1851c51926/ensight_reader-0.12.0.tar.gz",
    "platform": null,
    "description": "[![CI - build](https://img.shields.io/github/actions/workflow/status/tkarabela/ensight-reader/main.yml?branch=master)](https://github.com/tkarabela/ensight-reader/actions)\n[![CI - coverage](https://img.shields.io/codecov/c/github/tkarabela/ensight-reader)](https://app.codecov.io/github/tkarabela/ensight-reader)\n[![MyPy & Ruffle checked](https://img.shields.io/badge/MyPy%20%26%20Ruffle-checked-blue?style=flat)](https://github.com/tkarabela/pysubs2/actions)\n![PyPI - Version](https://img.shields.io/pypi/v/ensight-reader.svg?style=flat)\n![PyPI - Status](https://img.shields.io/pypi/status/ensight-reader.svg?style=flat)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ensight-reader.svg?style=flat)\n![License](https://img.shields.io/pypi/l/ensight-reader.svg?style=flat)\n\n# ensight-reader\n\nThis library provides a pure Python reader (with some writing capability) for the EnSight Gold data format,\na common format for results of computational fluid dynamics (CFD) simulations.\nIt also comes with a few CLI tools, notably `ensight_transform` which\nallows you to perform in-place scaling/translation/etc. of the geometry in your case.\n\nThe library designed for efficient, selective, memory-mapped access to data from EnSight Gold case \u2013\nsomething that would be useful when importing the data into other systems. If you're looking for a more \"batteries included\" solution, look at\n[`vtkEnSightGoldBinaryReader`](https://vtk.org/doc/nightly/html/classvtkEnSightGoldBinaryReader.html)\nfrom the VTK library ([see docs for comparison](https://ensight-reader.readthedocs.io/en/latest/design-howto.html#comparison-with-vtk-library)).\n\n### Requirements\n\n- Python 3.9+\n- NumPy 1.21+\n\n### Installation\n\n```sh\npip install ensight-reader\n```\n\n### Example \u2013 Python API\n\n```python\nimport ensightreader\nimport numpy as np\n\ncase = ensightreader.read_case(\"example.case\")\ngeofile = case.get_geometry_model()\n\npart_names = geofile.get_part_names()           # [\"internalMesh\", ...]\npart = geofile.get_part_by_name(part_names[0])\nN = part.number_of_nodes\n\nwith geofile.open() as fp_geo:\n    node_coordinates = part.read_nodes(fp_geo)  # np.ndarray((N, 3), dtype=np.float32)\n\nvariable = case.get_variable(\"UMean\")\n\nwith variable.mmap_writable() as mm_var:\n    data = variable.read_node_data(mm_var, part.part_id)\n    data[:] = np.sqrt(data)                     # transform variable data in-place\n```\n\n### Example \u2013 CLI\n\n```sh\n# increment X coordinate\nensight_transform --translate 1 0 0 sphere.case\n\n# scale by 1000 (eg. m -> mm conversion)\nensight_transform --scale 1e3 1e3 1e3 sphere.case\n\n# rotation matrix\nensight_transform --matrix \\\n    0 -1  0  0 \\\n    1  0  0  0 \\\n    0  0  1  0 \\\n    0  0  0  1 \\\n    sphere.case\n\n# transform only \"internalMesh\" part\nensight_transform --translate 1 0 0 --only-parts internalMesh motorbike.case\n```\n\nTo learn more, please [see the documentation](https://ensight-reader.readthedocs.io).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A pure Python reader for the EnSight Gold format",
    "version": "0.12.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/tkarabela/ensight-reader/issues",
        "Documentation": "https://ensight-reader.readthedocs.io",
        "Homepage": "https://github.com/tkarabela/ensight-reader"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4615c9545a18ba8a84660803b689359e352909e9b13d1ad455fbaa81a950dd0c",
                "md5": "56cbcde3da426cfd1e306b8d700e8345",
                "sha256": "906f410f8a4bf16bc8d4972a190d72974f9a8c1500c18407a63891f4f96a831f"
            },
            "downloads": -1,
            "filename": "ensight_reader-0.12.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "56cbcde3da426cfd1e306b8d700e8345",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 29957,
            "upload_time": "2025-01-10T21:30:34",
            "upload_time_iso_8601": "2025-01-10T21:30:34.265314Z",
            "url": "https://files.pythonhosted.org/packages/46/15/c9545a18ba8a84660803b689359e352909e9b13d1ad455fbaa81a950dd0c/ensight_reader-0.12.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9a789d8f40a40adba260531fb100413b75c092b4a578fc7e6ededd1851c51926",
                "md5": "720f5aba5e1c4ec83ce179cc0dd8d98d",
                "sha256": "ba48d7cca1ff6e85898d44d95548b4d1e277e515b48f30cfe73512026897141d"
            },
            "downloads": -1,
            "filename": "ensight_reader-0.12.0.tar.gz",
            "has_sig": false,
            "md5_digest": "720f5aba5e1c4ec83ce179cc0dd8d98d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 34051,
            "upload_time": "2025-01-10T21:30:36",
            "upload_time_iso_8601": "2025-01-10T21:30:36.846252Z",
            "url": "https://files.pythonhosted.org/packages/9a/78/9d8f40a40adba260531fb100413b75c092b4a578fc7e6ededd1851c51926/ensight_reader-0.12.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-10 21:30:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tkarabela",
    "github_project": "ensight-reader",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "numpy",
            "specs": [
                [
                    ">=",
                    "1.21"
                ]
            ]
        }
    ],
    "lcname": "ensight-reader"
}
        
Elapsed time: 0.50686s