def test_getsetsurface_from_clipboard():
    """Get and set a surface from a RMS project, from the clipboard container."""

    if not os.path.isdir(proj[roxver]):
        raise RuntimeError(
            'RMS test project is missing for roxar version {}'.format(roxver))

    rox = RoxUtils(proj[roxver], readonly=False)
    roxproj = rox.project

    # direct initiate an instance from Roxar import
    x = xtgeo.surface_from_roxar(roxproj,
                                 'basereek_rota',
                                 'maps',
                                 stype='clipboard')

    x.to_file(os.path.join(td, 'upperreek_from_rms.gri'))

    tsetup.assert_equal(x.ncol, 554, 'NCOL of from RMS')

    # values from mean are read from statistics in RMS
    tsetup.assert_almostequal(x.values.mean(), 1742.3574, 0.001)

    # add and write to folder
    x.values += 100
    x.to_roxar(roxproj, 'somenew', 'maps', stype='clipboard')

    rox.project.save()
    # read again
    y = xtgeo.surface_from_roxar(roxproj, 'somenew', 'maps', stype='clipboard')

    tsetup.assert_almostequal(y.values.mean(), 1842.3574, 0.001)

    rox.safe_close()
Example #2
0
def test_rox_surfaces():
    """Various get set on surfaces in RMS."""
    srf = xtgeo.surface_from_roxar(PRJ, "TopReek", SURFCAT1)
    srf2 = xtgeo.surface_from_roxar(PRJ, "MidReek", SURFCAT1)
    assert srf.ncol == 554
    assert srf.values.mean() == pytest.approx(1698.648, abs=0.01)

    srf.to_roxar(PRJ, "TopReek_copy", "SomeFolder", stype="clipboard")

    # open project and do save explicit
    rox = xtgeo.RoxUtils(PRJ)
    prj = rox.project
    iso = srf2 - srf
    rox.create_zones_category("IS_isochore")
    prj.zones.create("UpperReek", prj.horizons["TopReek"],
                     prj.horizons["MidReek"])
    iso.to_roxar(prj, "UpperReek", "IS_isochore", stype="zones")

    iso2 = xtgeo.surface_from_roxar(prj,
                                    "UpperReek",
                                    "IS_isochore",
                                    stype="zones")
    assert iso2.values.mean() == pytest.approx(20.79, abs=0.01)

    prj.save()
    prj.close()
def test_getsurface_from_zones():
    """Get a surface from a RMS project, from the zones container."""

    if not os.path.isdir(proj[roxver]):
        raise RuntimeError(
            'RMS test project is missing for roxar version {}'.format(roxver))

    logger.info('Simple case, reading a surface from a Horizons category')

    # direct initiate an instance from Roxar import
    x = xtgeo.surface_from_roxar(proj[roxver],
                                 'UpperReek',
                                 'IS_calculated',
                                 stype='zones')

    x.to_file(os.path.join(td, 'upperreek_from_rms.gri'))

    tsetup.assert_equal(x.ncol, 99, 'NCOL of from RMS')

    # values from mean and stddev are read from statistics in RMS
    tsetup.assert_almostequal(x.values.mean(), 20.8205, 0.001)
    tsetup.assert_almostequal(x.values.std(), 1.7867, 0.001)
    print(x.values.std())

    # write to folder
    x.to_roxar(proj[roxver], 'UpperReek', 'IS_jriv', stype='zones')
def test_qcreset():
    """Test qcreset metod in roxapi."""
    # ==================================================================================
    # pylint: disable=invalid-name
    from fmu.tools.rms import qcreset

    rox = xtgeo.RoxUtils(project=PRJ)

    SETUP1 = {
        "project": rox._project,
        "horizons": {
            "DS_whatever": ["TopReek", "MidReek"],
        },
        "grid_models": {
            "Simgrid": ["PORO"],
        },
        "value": 0.088,
    }

    SETUP2 = {
        "project": rox._project,
        "horizons": {
            "DS_whatever": ["TopReek", "MidReek"],
        },
        "grid_models": {
            "Simgrid": ["PORO"],
        },
    }

    qcreset.set_data_constant(SETUP1)

    topr = xtgeo.surface_from_roxar(rox._project, "TopReek", "DS_whatever")
    assert topr.values.mean() == pytest.approx(0.088)

    poro = xtgeo.gridproperty_from_roxar(rox._project, "Simgrid", "PORO")
    assert poro.values.mean() == pytest.approx(0.088)

    qcreset.set_data_empty(SETUP2)

    top = rox._project.horizons["TopReek"]["DS_whatever"]

    assert top.is_empty() is True