Skip to content

Commit

Permalink
When is_observation is true, output to share/observations
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrivenaes authored Oct 22, 2021
1 parent 55f163a commit 3779b8b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/fmu/dataio/_export_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,9 @@ def _construct_filename_fmustandard1(self):
"""
stem = "unset"
outroot = self.dataio.runpath / "share" / "results"
if self.dataio.is_observation:
outroot = self.dataio.runpath / "share" / "observations"

loc = self.efolder

stem = self.name.lower()
Expand Down
3 changes: 2 additions & 1 deletion src/fmu/dataio/dataio.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ class ExportData:
timedata: If given, a list of lists with dates, .e.g.
[[20200101, "monitor"], [20180101, "base"]] or just [[20210101]]
is_prediction: True (default) of model prediction data
is_observation: Default is False.
is_observation: Default is False. If True, then disk storage will be on the
"share/observations" folder
workflow: Short tag desciption of workflow (as description)
name: The name of the object. If not set it is tried to be inferred from
Expand Down
17 changes: 12 additions & 5 deletions tests/test_fmu_dataio_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,13 @@ def test_cube_io_larger_case_ertrun(tmp_path):
runfolder = current / "mycase" / "realization-0" / "iter-0" / "rms" / "model"
runfolder.mkdir(parents=True, exist_ok=True)
out = (
current / "mycase" / "realization-0" / "iter-0" / "share" / "results" / "cubes"
current
/ "mycase"
/ "realization-0"
/ "iter-0"
/ "share"
/ "observations"
/ "cubes"
)

# alternative 1, set inside_rms True (developer setting for testing)
Expand All @@ -124,9 +130,9 @@ def test_cube_io_larger_case_ertrun(tmp_path):
content="depth",
unit="m",
vertical_domain={"depth": "msl"},
timedata=None,
timedata=[[20290101, "monitor"], [19990601, "base"]],
is_prediction=True,
is_observation=False,
is_observation=True,
tagname="what Descr",
verbosity="INFO",
runfolder=runfolder.resolve(),
Expand All @@ -137,7 +143,7 @@ def test_cube_io_larger_case_ertrun(tmp_path):
cube = xtgeo.Cube(ncol=23, nrow=12, nlay=5)
exp1.export(cube, verbosity="INFO")

metadataout = out / ".volantis--what_descr.segy.yml"
metadataout = out / ".volantis--what_descr--20290101_19990601.segy.yml"

assert metadataout.is_file() is True

Expand All @@ -146,7 +152,8 @@ def test_cube_io_larger_case_ertrun(tmp_path):
meta = yaml.safe_load(mstream)
assert (
meta["file"]["relative_path"]
== "realization-0/iter-0/share/results/cubes/volantis--what_descr.segy"
== "realization-0/iter-0/share/observations/cubes/volantis--what_descr"
+ "--20290101_19990601.segy"
)
assert meta["fmu"]["model"]["name"] == "ff"
assert meta["fmu"]["iteration"]["name"] == "iter-0"
Expand Down

0 comments on commit 3779b8b

Please sign in to comment.