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()
示例#2
0
def import_well_roxapi(
    self,
    project,
    wname,
    trajectory="Drilled trajectory",
    logrun="log",
    lognames="all",
    lognames_strict=False,
    inclmd=False,
    inclsurvey=False,
):  # pragma: no cover
    """Private function for loading project and ROXAPI well import"""

    rox = RoxUtils(project, readonly=True)

    _roxapi_import_well(
        self,
        rox,
        wname,
        trajectory,
        logrun,
        lognames,
        lognames_strict,
        inclmd,
        inclsurvey,
    )

    rox.safe_close()
示例#3
0
def export_bwell_roxapi(self, project, gname, bwname, wname, realisation=0):
    """Private function for loading project and ROXAPI blockwell import"""

    logger.info("Opening RMS project ...")
    rox = RoxUtils(project, readonly=True)

    _roxapi_export_bwell(self, rox, gname, bwname, wname, realisation)

    rox.safe_close()
示例#4
0
def import_bwells_roxapi(self,
                         project,
                         gname,
                         bwname,
                         lognames=None,
                         ijk=True,
                         realisation=0):  # pragma: no cover
    """Private function for loading project and ROXAPI blockwell import"""

    logger.info("Opening RMS project ...")
    rox = RoxUtils(project, readonly=True)

    _roxapi_import_bwells(self, rox, gname, bwname, lognames, ijk, realisation)

    rox.safe_close()
示例#5
0
def export_bwell_roxapi(self,
                        project,
                        gname,
                        bwname,
                        wname,
                        lognames="all",
                        ijk=False,
                        realisation=0):
    """Private function for blockwell export (store in RMS) from XTGeo to RoxarAPI"""

    logger.info("Opening RMS project ...")
    rox = RoxUtils(project, readonly=False)

    _roxapi_export_bwell(self, rox, gname, bwname, wname, lognames, ijk,
                         realisation)

    if rox._roxexternal:
        rox.project.save()

    rox.safe_close()
示例#6
0
def export_well_roxapi(
    self,
    project,
    wname,
    lognames="all",
    logrun="log",
    trajectory="Drilled trajectory",
    realisation=0,
):
    """Private function for well export (store in RMS) from XTGeo to RoxarAPI"""

    logger.info("Opening RMS project ...")
    rox = RoxUtils(project, readonly=False)

    _roxapi_export_well(self, rox, wname, lognames, logrun, trajectory,
                        realisation)

    if rox._roxexternal:
        rox.project.save()

    rox.safe_close()
示例#7
0
def import_xyz_roxapi(self, project, name, category, stype, realisation,
                      attributes):  # pragma: no cover
    """Import a Points or Polygons item via ROXAR API spec.

    'Import' here means transfer of data from Roxar API memory space to
    XTGeo memory space.
    """

    rox = RoxUtils(project)

    if stype == "clipboard" and not rox.version_required("1.2"):
        minimumrms = rox.rmsversion("1.2")
        msg = ("Not supported in this ROXAPI version. Points/polygons access "
               "to clipboard requires RMS {}".format(minimumrms))
        raise NotImplementedError(msg)

    if attributes:
        _roxapi_import_xyz_viafile(self, rox, name, category, stype,
                                   realisation)
    else:
        _roxapi_import_xyz(self, rox.project, name, category, stype,
                           realisation)
示例#8
0
def export_xyz_roxapi(self, project, name, category, stype, pfilter,
                      realisation, attributes):  # pragma: no cover
    """Export (store) a XYZ item from XTGeo to RMS via ROXAR API spec."""

    rox = RoxUtils(project)

    if stype == "clipboard" and not rox.version_required("1.2"):
        minimumrms = rox.rmsversion("1.2")
        msg = ("Not supported in this ROXAPI version. Points/polygons access "
               "to clipboard requires RMS {}".format(minimumrms))
        raise NotImplementedError(msg)

    if stype == "horizon_picks":
        _roxapi_export_xyz_hpicks(self, rox, name, category, stype,
                                  realisation, attributes)

    if attributes:
        _roxapi_export_xyz_viafile(self, rox, name, category, stype, pfilter,
                                   realisation, attributes)
    else:
        _roxapi_export_xyz(self, rox, name, category, stype, pfilter,
                           realisation)
示例#9
0
def import_xyz_roxapi(self, project, name, category, stype, realisation, attributes):
    """Import a Points or Polygons item via ROXAR API spec.

    'Import' here means transfer of data from Roxar API memory space to
    XTGeo memory space.
    """

    rox = RoxUtils(project)

    if attributes:
        _roxapi_import_xyz_viafile(self, rox, name, category, stype, realisation)
    else:
        _roxapi_import_xyz(self, rox.project, name, category, stype, realisation)
示例#10
0
def export_xyz_roxapi(self, project, name, category, stype, pfilter,
                      realisation, attributes):
    """Export (store) a XYZ item to RMS via ROXAR API spec."""

    rox = RoxUtils(project)

    if stype == "horizon_picks":
        _roxapi_export_xyz_hpicks(self, rox, name, category, stype,
                                  realisation, attributes)

    if attributes:
        _roxapi_export_xyz_viafile(self, rox, name, category, stype, pfilter,
                                   realisation, attributes)
    else:
        _roxapi_export_xyz(self, rox, name, category, stype, pfilter,
                           realisation)