コード例 #1
0
def _import_grid_roxapi_v2(
    self, projectname, gname, realisation, info
):  # pragma: no cover
    """Import a Grid via ROXAR API spec."""

    rox = RoxUtils(projectname, readonly=True)

    proj = rox.project

    if not rox.version_required("1.3"):
        raise NotImplementedError("Functionality to implemented for Roxar API < 1.3")

    logger.info("Loading grid with realisation %s...", realisation)
    try:
        if gname not in proj.grid_models:
            raise KeyError("No such gridmodel: {}".format(gname))

        logger.info("Get roxgrid...")
        roxgrid = proj.grid_models[gname].get_grid()

        if info:
            _display_roxapi_grid_info(rox, roxgrid)

        _convert_to_xtgeo_grid_v2(self, roxgrid, gname)

    except KeyError as keyerror:
        raise RuntimeError(keyerror)

    if rox._roxexternal:
        rox.safe_close()
コード例 #2
0
def _import_grid_roxapi_v1(
    self, projectname, gname, realisation, dimonly, info
):  # pragma: no cover
    """Import a Grid via ROXAR API spec."""

    rox = RoxUtils(projectname, readonly=True)

    proj = rox.project

    logger.info("Loading grid with realisation %s...", realisation)
    try:
        if gname not in proj.grid_models:
            raise KeyError("No such gridmodel: {}".format(gname))

        logger.info("Get roxgrid...")
        roxgrid = proj.grid_models[gname].get_grid()

        if dimonly:
            corners = None
        else:
            logger.info("Get corners...")
            corners = roxgrid.get_cell_corners_by_index()
            logger.info("Get corners... done")

        if info:
            _display_roxapi_grid_info(rox, roxgrid)

        _convert_to_xtgeo_grid_v1(self, rox, roxgrid, corners, gname)

    except KeyError as keyerror:
        raise RuntimeError(keyerror)

    if rox._roxexternal:
        rox.safe_close()
コード例 #3
0
ファイル: _cube_roxapi.py プロジェクト: oyvindeide/xtgeo
def export_cube_roxapi(self,
                       project,
                       name,
                       folder=None,
                       domain="time",
                       compression=("wavelet", 5)):  # pragma: no cover
    """Export (store) a Seismic cube to RMS via ROXAR API spec."""
    rox = RoxUtils(project, readonly=False)

    logger.debug("TODO: compression %s", compression)

    _roxapi_export_cube(
        self,
        rox.project,
        rox,
        name,
        folder=folder,
        domain=domain,
        compression=compression,
    )

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

    rox.safe_close()
コード例 #4
0
def export_horizon_roxapi(self, project, name, category, stype, realisation):
    """Export (store) a Horizon surface to RMS via ROXAR API spec."""
    rox = RoxUtils(project, readonly=False)

    logger.info("Surface from xtgeo to roxapi...")
    _roxapi_export_surface(self, rox.project, name, category, stype,
                           realisation)

    logger.info("Surface from xtgeo to roxapi... DONE")
    rox.safe_close()
コード例 #5
0
def import_horizon_roxapi(self, project, name, category, stype, realisation):
    """Import a Horizon surface via ROXAR API spec."""

    rox = RoxUtils(project, readonly=True)

    proj = rox.project

    _roxapi_import_surface(self, proj, name, category, stype, realisation)

    rox.safe_close()
コード例 #6
0
def import_horizon_roxapi(project, name, category, stype,
                          realisation):  # pragma: no cover
    """Import a Horizon surface via ROXAR API spec."""
    rox = RoxUtils(project, readonly=True)

    proj = rox.project

    args = _roxapi_import_surface(proj, name, category, stype, realisation)

    rox.safe_close()
    return args
コード例 #7
0
def load_reek():
    """Fixture for loading Reek project"""

    print(roxver)
    if not os.path.isdir(PROJ[roxver]):
        raise RuntimeError(
            'RMS test project is missing for roxar version {}'.format(roxver))
    return RoxUtils(PROJ[roxver])
コード例 #8
0
def export_grid_roxapi(self,
                       projectname,
                       gname,
                       realisation,
                       info=False,
                       method="cpg"):
    """Export (i.e. store in RMS) via ROXAR API spec.

    Using method 'cpg' means that the CPG method is applied (from ROXAPI 1.3).
    This is possible from version ROXAPI ver 1.3, where the CornerPointGeometry
    class is defined.

    An alternative is to use simple roff import (via some /tmp area),
    can be used from version 1.2

    """
    rox = RoxUtils(projectname, readonly=False)

    if method != "cpg" and not rox.version_required("1.2"):
        minimumrms = rox.rmsversion("1.2")
        raise NotImplementedError(
            "Not supported in this ROXAPI version. Grid load/import requires "
            "RMS version {}".format(minimumrms))

    if method == "cpg" and not rox.version_required("1.3"):
        xtg.warn("Export method=cpg is not implemented for ROXAPI "
                 "version {}. Change to workaround...".format(rox.roxversion))
        method = "other"

    if method == "cpg":
        _export_grid_cornerpoint_roxapi(self, rox, gname, realisation, info)
    else:
        _export_grid_viaroff_roxapi(self, rox, gname, realisation)

    rox.safe_close()
コード例 #9
0
def import_cube_roxapi(self, project, name, folder=None):
    """Import (transfer) a Cube via ROXAR API container to XTGeo.

    .. versionadded:: 2.1.0
    """
    rox = RoxUtils(project, readonly=True)

    proj = rox.project

    _roxapi_import_cube(self, proj, name, folder)
コード例 #10
0
def _import_grid_roxapi_v2(
    self, projectname, gname, realisation, info
):  # pragma: no cover
    """Import a Grid via ROXAR API spec."""
    rox = RoxUtils(projectname, readonly=True)

    proj = rox.project

    if not rox.version_required("1.3"):
        raise NotImplementedError("Functionality to implemented for Roxar API < 1.3")

    logger.info("Loading grid with realisation %s...", realisation)
    try:
        if gname not in proj.grid_models:
            raise KeyError("No such gridmodel: {}".format(gname))

        logger.info("Get roxgrid...")
        roxgrid = proj.grid_models[gname].get_grid(realisation=realisation)

        if roxgrid.has_dual_index_system:
            xtg.warnuser(
                f"The roxar grid {gname} has dual index system.\n"
                "XTGeo does not implement extraction of simbox grid\n"
                "and only considers physical index."
            )

        if info:
            _display_roxapi_grid_info(rox, roxgrid)

        _convert_to_xtgeo_grid_v2(self, roxgrid, gname)

    except KeyError as keyerror:
        raise RuntimeError(keyerror)

    if rox._roxexternal:
        rox.safe_close()
コード例 #11
0
def export_cube_roxapi(self,
                       project,
                       name,
                       folder=None,
                       domain="time",
                       compression=("wavelet", 5)):
    """Export (store) a Seismic cube to RMS via ROXAR API spec."""
    rox = RoxUtils(project, readonly=False)

    logger.debug("TODO: compression %s", compression)

    _roxapi_export_cube(self,
                        rox.project,
                        name,
                        folder=folder,
                        domain=domain,
                        compression=compression)