Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions simpeg/directives/_save_geoh5.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,22 @@ class BaseSaveGeoH5(InversionDirective, ABC):
def __init__(
self,
h5_object,
*,
dmisfit=None,
label: str | None = None,
channels: list[str] = ("",),
components: list[str] = ("",),
association: str | None = None,
open_geoh5: bool = False,
close_geoh5: bool = False,
**kwargs,
):
self.label = label
self.channels = channels
self.components = components
self.h5_object = h5_object
self.open_geoh5 = open_geoh5
self.close_geoh5 = close_geoh5

if association is not None:
self.association = association
Expand All @@ -61,10 +66,20 @@ def __init__(
)

def initialize(self):
if self.open_geoh5:
self._geoh5.open(mode="r+")

self.write(0)

if self.close_geoh5:
self._geoh5.close()

def endIter(self):
if self.open_geoh5:
self._geoh5.open(mode="r+")
self.write(self.opt.iter)
if self.close_geoh5:
self._geoh5.close()

def get_names(
self, component: str, channel: str, iteration: int
Expand Down