Skip to content
Snippets Groups Projects
Commit 3007158d authored by Florian Zill's avatar Florian Zill
Browse files

added timeunit to meshseries

parent 4018c834
No related branches found
No related tags found
1 merge request!117Probe Functionality
"""A class to handle Meshseries data.""" """A class to handle Meshseries data."""
from pathlib import Path from pathlib import Path
from typing import Union from typing import Optional, Union
import meshio import meshio
import numpy as np import numpy as np
...@@ -148,9 +148,22 @@ class MeshSeries: ...@@ -148,9 +148,22 @@ class MeshSeries:
Will be replaced by own module in ogstools with similar interface. Will be replaced by own module in ogstools with similar interface.
""" """
def __init__(self, filepath: Union[str, Path]) -> None: def __init__(
self,
filepath: Union[str, Path],
time_unit: Optional[Optional[str]] = None,
  • Tobias Meisel @TobiasMeisel ·
    Maintainer

    Optional[Optional seems unusual. It seems to introduce unnecessary complexity. Isn't Optional[str] sufficient?

  • Author Maintainer

    wasn't intended, fixed

  • Please register or sign in to reply
) -> None:
"""
Initialize a MeshSeries object
:param filepath: Path to the PVD or XDMF file.
:param time_unit: Data unit of the timevalues.
:returns: A MeshSeries object
"""
if isinstance(filepath, Path): if isinstance(filepath, Path):
filepath = str(filepath) filepath = str(filepath)
self.time_unit = time_unit
self._data: dict[int, pv.UnstructuredGrid] = {} self._data: dict[int, pv.UnstructuredGrid] = {}
self._data_type = filepath.split(".")[-1] self._data_type = filepath.split(".")[-1]
if self._data_type == "pvd": if self._data_type == "pvd":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment