Skip to content

Commit d8a8c63

Browse files
committed
fix: adding groupname to save option to geoh5
1 parent 39b694b commit d8a8c63

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

LoopStructural/datatypes/_point.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def plot(self, pyvista_kwargs={}):
4949
except ImportError:
5050
logger.error("pyvista is required for vtk")
5151

52-
def save(self, filename: Union[str, io.StringIO], ext=None):
52+
def save(self, filename: Union[str, io.StringIO], *, group='Loop',ext=None):
5353
if isinstance(filename, io.StringIO):
5454
if ext is None:
5555
raise ValueError('Please provide an extension for StringIO')
@@ -68,7 +68,7 @@ def save(self, filename: Union[str, io.StringIO], ext=None):
6868
elif ext == 'geoh5':
6969
from LoopStructural.export.geoh5 import add_points_to_geoh5
7070

71-
add_points_to_geoh5(filename, self)
71+
add_points_to_geoh5(filename, self, groupname=group)
7272
elif ext == 'pkl':
7373
import pickle
7474

@@ -189,7 +189,7 @@ def plot(self, pyvista_kwargs={}):
189189
except ImportError:
190190
logger.error("pyvista is required for vtk")
191191

192-
def save(self, filename):
192+
def save(self, filename,*, group='Loop'):
193193
filename = str(filename)
194194
ext = filename.split('.')[-1]
195195
if ext == 'json':
@@ -203,7 +203,7 @@ def save(self, filename):
203203
elif ext == 'geoh5':
204204
from LoopStructural.export.geoh5 import add_points_to_geoh5
205205

206-
add_points_to_geoh5(filename, self)
206+
add_points_to_geoh5(filename, self, groupname=group)
207207
elif ext == 'pkl':
208208
import pickle
209209

LoopStructural/datatypes/_structured_grid.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def merge(self, other):
104104
for name, data in other.properties.items():
105105
self.properties[name] = data
106106

107-
def save(self, filename):
107+
def save(self, filename, *,group='Loop'):
108108
filename = str(filename)
109109
ext = filename.split('.')[-1]
110110
if ext == 'json':
@@ -118,7 +118,7 @@ def save(self, filename):
118118
elif ext == 'geoh5':
119119
from LoopStructural.export.geoh5 import add_structured_grid_to_geoh5
120120

121-
add_structured_grid_to_geoh5(filename, self)
121+
add_structured_grid_to_geoh5(filename, self, groupname=group)
122122
elif ext == 'pkl':
123123
import pickle
124124

LoopStructural/datatypes/_surface.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def from_dict(cls, d, flatten=False):
192192
d.get('cell_properties', None),
193193
)
194194

195-
def save(self, filename, replace_spaces=True, ext=None):
195+
def save(self, filename, *, group='Loop',replace_spaces=True, ext=None):
196196
filename = filename.replace(' ', '_') if replace_spaces else filename
197197
if isinstance(filename, (io.StringIO, io.BytesIO)):
198198
if ext is None:
@@ -225,7 +225,7 @@ def save(self, filename, replace_spaces=True, ext=None):
225225
elif ext == 'geoh5':
226226
from LoopStructural.export.geoh5 import add_surface_to_geoh5
227227

228-
add_surface_to_geoh5(filename, self)
228+
add_surface_to_geoh5(filename, self, groupname=group)
229229

230230
elif ext == 'pkl':
231231
import pickle

0 commit comments

Comments
 (0)