From 3007158d6e22b4893c3257cfd4cf3fa76219e302 Mon Sep 17 00:00:00 2001
From: FZill <florian.zill@ufz.de>
Date: Thu, 8 Feb 2024 10:00:36 +0100
Subject: [PATCH] added timeunit to meshseries

---
 ogstools/meshlib/mesh_series.py | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/ogstools/meshlib/mesh_series.py b/ogstools/meshlib/mesh_series.py
index c2950c341..c72b80b02 100644
--- a/ogstools/meshlib/mesh_series.py
+++ b/ogstools/meshlib/mesh_series.py
@@ -1,7 +1,7 @@
 """A class to handle Meshseries data."""
 
 from pathlib import Path
-from typing import Union
+from typing import Optional, Union
 
 import meshio
 import numpy as np
@@ -148,9 +148,22 @@ class MeshSeries:
     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,
+    ) -> 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):
             filepath = str(filepath)
+        self.time_unit = time_unit
         self._data: dict[int, pv.UnstructuredGrid] = {}
         self._data_type = filepath.split(".")[-1]
         if self._data_type == "pvd":
-- 
GitLab