-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add classes for everest-specific storage logic
- Loading branch information
Showing
4 changed files
with
64 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from .local_ensemble import LocalEnsemble | ||
|
||
|
||
class EverestEnsemble: | ||
def __init__(self, ert_ensemble: LocalEnsemble): | ||
self._ert_ensemble = ert_ensemble | ||
|
||
@property | ||
def ert_ensemble(self) -> LocalEnsemble: | ||
return self._ert_ensemble |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from functools import cached_property | ||
|
||
from ert.storage import LocalExperiment | ||
|
||
from .everest_ensemble import EverestEnsemble | ||
|
||
|
||
class EverestExperiment: | ||
def __init__(self, ert_experiment: LocalExperiment) -> None: | ||
self._ert_experiment = ert_experiment | ||
|
||
@cached_property | ||
def ensembles(self) -> list[EverestEnsemble]: | ||
return [ | ||
EverestEnsemble(ens) | ||
for ens in self._ert_experiment._storage.ensembles | ||
if ens.experiment_id == self._ert_experiment.id | ||
] | ||
|
||
def create_ensemble( | ||
self, | ||
ensemble_size: int, | ||
name: str, | ||
) -> EverestEnsemble: | ||
ert_ensemble = self._ert_experiment.create_ensemble( | ||
ensemble_size=ensemble_size, name=name | ||
) | ||
everest_ensemble = EverestEnsemble(ert_ensemble) | ||
if self.ensembles is not None: | ||
del self.ensembles # Clear cache when a new ensemble is created | ||
return everest_ensemble |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters