Skip to content

Commit

Permalink
Adjust settings in InitalizeCase
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrivenaes committed Jun 1, 2022
1 parent cfdc226 commit b6b58c4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
14 changes: 10 additions & 4 deletions src/fmu/dataio/dataio.py
Original file line number Diff line number Diff line change
Expand Up @@ -724,8 +724,9 @@ class InitializeCase: # pylint: disable=too-few-public-methods
FMU_GLOBAL_CONFIG pointing to a file is provided, then it will attempt to
parse that file instead.
rootfolder: To override the automatic and actual ``rootpath``. Absolute path to
the case root. If not provided (which is not recommended), the rootpath
will be attempted parsed from the file structure or by other means.
the case root, including case name. If not provided (which is not
recommended), the rootpath will be attempted parsed from the file structure
or by other means.
casename: Name of case (experiment)
caseuser: Username provided
restart_from: ID of eventual restart
Expand Down Expand Up @@ -778,8 +779,8 @@ def _establish_pwd_casepath(self):
"""
self._pwd = Path().absolute()

if self.rootfolder and self.casename:
self._casepath = self.rootfolder / self.casename
if self.rootfolder:
self._casepath = Path(self.rootfolder)
else:
logger.info("Emit UserWarning")
warn(
Expand All @@ -793,6 +794,11 @@ def _establish_pwd_casepath(self):
logger.info("Set rootpath (case): %s", str(self._casepath))

def _check_already_metadata_or_create_folder(self, force=False) -> bool:

if not self._casepath.exists():
self._casepath.mkdir(parents=True, exist_ok=True)
logger.info("Created rootpath (case) %s", self._casepath)

metadata_path = self._casepath / "share/metadata"
self._metafile = metadata_path / "fmu_case.yml"
logger.info("The requested metafile is %s", self._metafile)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_units/test_initialize_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def test_inicase_pwd_basepath_explicit(fmurun, globalconfig2):

logger.info("Casepath is %s", icase._casepath)

assert icase._casepath == myroot / "mycase"
assert icase._casepath == myroot
assert icase._pwd == fmurun


Expand Down Expand Up @@ -136,7 +136,7 @@ def test_inicase_generate_case_metadata_exists_but_force(

icase = InitializeCase(globalconfig2, verbosity="INFO")
icase.export(
rootfolder=casemetafolder.parent,
rootfolder=casemetafolder,
force=True,
casename="ertrun1",
caseuser="guffen",
Expand Down

0 comments on commit b6b58c4

Please sign in to comment.