Esempio n. 1
0
def test_process_value1(tmp_path):
    """s03"""

    inp = b"""
    global:
        WELLCONCEPT: REV1_A15 ~ <WELL_CONS>
    """

    target = tmp_path / "generic.yml"
    with target.open("w") as out:
        out.write(inp.decode("utf-8"))

    cfg = fcfg.ConfigParserFMU()
    cfg.parse(str(target.resolve()))

    outfolder = tmp_path
    out = str(outfolder.resolve())

    cfg.to_yaml(rootname="s03", destination=out, template=out)

    actual = ut.yaml_load(join(out, "s03.yml"))

    assert actual["global"]["WELLCONCEPT"] == "REV1_A15"

    tmpl = ut.yaml_load(join(out, "s03.yml.tmpl"))

    assert tmpl["global"]["WELLCONCEPT"] == "<WELL_CONS>"
Esempio n. 2
0
def test_process_value2(tmp_path):
    """s04"""

    inp = b"""
    global:
        WHATEVER: &onx ONX ~ <ONX>
        WHATEVER2: *onx
        NUMBER1: 2.0 ~ <NUM1>
    """

    target = tmp_path / "generic.yml"
    with target.open("w") as out:
        out.write(inp.decode("utf-8"))

    cfg = fcfg.ConfigParserFMU()
    cfg.parse(str(target))

    out = str(tmp_path.resolve())

    cfg.to_yaml(rootname="s04", destination=out, template=out)

    actual = ut.yaml_load(join(out, "s04.yml"))

    assert actual["global"]["WHATEVER"] == "ONX"
    assert actual["global"]["NUMBER1"] == 2.0

    tmpl = ut.yaml_load(join(out, "s04.yml.tmpl"))

    assert tmpl["global"]["WHATEVER"] == "<ONX>"
Esempio n. 3
0
def test_filepath(tmp_path):
    """Test when filepath is present as substitute, s05"""

    inp = b"""
    global:
        MYFILE: /tmp/fil ~ <FILE>
    """

    target = tmp_path / "generic.yml"
    with target.open("w") as out:
        out.write(inp.decode("utf-8"))

    cfg = fcfg.ConfigParserFMU()
    cfg.parse(str(target))

    out = str(tmp_path.resolve())

    cfg.to_yaml(rootname="s05", destination=out, template=out)

    actual = ut.yaml_load(join(out, "s05.yml"))

    assert actual["global"]["MYFILE"] == "/tmp/fil"

    tmpl = ut.yaml_load(join(out, "s05.yml.tmpl"))

    assert tmpl["global"]["MYFILE"] == "<FILE>"
Esempio n. 4
0
"""Export 3D griddata with properties."""

import pathlib

import xtgeo
from fmu.config import utilities as ut

import fmu.dataio as dataio

CFG = ut.yaml_load("../../fmuconfig/output/global_variables.yml")

FOLDER = pathlib.Path("../output/grids")
GFILE = "gg"
GNAME = "geogrid"
PROPS_SEISMIC = ["phit", "sw"]
PROPS_OTHER = ["klogh", "facies"]
VERBOSITY = "WARNING"


def export_geogrid_geometry():
    filename = (FOLDER / GFILE).with_suffix(".roff")
    grd = xtgeo.grid_from_file(filename)

    ed = dataio.ExportData(
        config=CFG,
        name=GNAME,
        content="depth",
        unit="m",
        vertical_domain={"depth": "msl"},
        timedata=None,
        is_prediction=True,
Esempio n. 5
0
def test_basic_tools():
    """Test basic tools behaviour"""

    cfg = utils.yaml_load(REEK)

    assert cfg["global"]["name"] == "Reek"