Other APIs

Roxar utilities

RoxUtils

class xtgeo.RoxUtils(project, readonly=False)[source]

Bases: object

Class RoxUtils, for accessing project level methods:

import xtgeo

xr = xtgeo.RoxUtils(project)
xr.create_horizon_category('DS_extracted_run3')
xr.delete_horizon_category('DS_extracted_run2')

The project itself can be a reference to an existing project, typically the magic project wording inside RMS python, or a file path to a RMS project (for external access).

Parameters:
  • project (roxar.Project or str) – Reference to a RMS project either an existing instance or a RMS project folder path.

  • readonly (bool) – saved to this project (which is the case for “secondary” projects).

Examples:

import xgeo
path = '/some/path/to/rmsprject.rmsx'

ext = xtgeo.RoxUtils(path, readonly=True)
# ...do something
ext.safe_close()

Public Data Attributes:

roxversion

Roxar API version (read only)

project

The Roxar project instance (read only)

Public Methods:

safe_close()

Close the project but only if roxarapps (external) mode, i.e. not current RMS project.

version_required(targetversion)

Defines a minimum ROXAPI version for some feature (True or False).

rmsversion(apiversion)

Get the actual RMS version(s) given an API version.

create_horizons_category(category[, domain, ...])

Create one or more a Horizons category entries.

create_zones_category(category[, domain, htype])

Create one or more a Horizons category entries.

delete_horizons_category(category)

Delete on or more horizons or zones categories

delete_zones_category(category)

Delete on or more horizons or zones categories.

clear_horizon_category(category)

Clear (or make empty) the content of one or more horizon categories.

clear_zone_category(category)

Clear (or make empty) the content of one or more zone categories.


__init__(project, readonly=False)[source]
clear_horizon_category(category)[source]

Clear (or make empty) the content of one or more horizon categories.

Parameters:

category (str or list) – Name(s) of category to empty, either as a simple string or a list of strings.

Added in version 2.1.

clear_zone_category(category)[source]

Clear (or make empty) the content of one or more zone categories.

Parameters:

category (str or list) – Name(s) of category to empty, either as a simple string or a list of strings.

Added in version 2.1.

create_horizons_category(category, domain='depth', htype='surface')[source]

Create one or more a Horizons category entries.

Parameters:
  • category (str or list) – Name(s) of category to make, either as a simple string or a list of strings.

  • domain (str) – ‘depth’ (default) or ‘time’

  • htype (str) – Horizon type: surface/lines/points

create_zones_category(category, domain='thickness', htype='surface')[source]

Create one or more a Horizons category entries.

Parameters:
  • category (str or list) – Name(s) of category to make, either as a simple string or a list of strings.

  • domain (str) – ‘thickness’ (default) or …?

  • htype (str) – Horizon type: surface/lines/points

delete_horizons_category(category)[source]

Delete on or more horizons or zones categories

delete_zones_category(category)[source]

Delete on or more horizons or zones categories. See previous

property project

The Roxar project instance (read only)

rmsversion(apiversion)[source]

Get the actual RMS version(s) given an API version.

Parameters:

apiversion (str) – ROXAPI version to ask for

Returns:

A list of RMS version(s) for the given API version, None if

not any match.

Example:

rox = RoxUtils(project)
rmsver = rox.rmsversion('1.5')
print('The supported RMS version are {}'.format(rmsver))
property roxversion

Roxar API version (read only)

safe_close()[source]

Close the project but only if roxarapps (external) mode, i.e. not current RMS project

In case roxar.Project.open() is done explicitly, safe_close() will do nothing.

version_required(targetversion)[source]

Defines a minimum ROXAPI version for some feature (True or False).

Parameters:

targetversion (str) – Minimum version to compare with.

Example:

rox = RoxUtils(project)
if rox.version_required('1.5'):
    somefunction()
else:
    print('Not supported in this version')

Metadata (experimental)

MetadataRegularSurface

class xtgeo.MetaDataRegularSurface[source]

Bases: MetaData

Metadata for RegularSurface() objects.

Docstring.

Public Data Attributes:

REQUIRED

required

Get of set required metadata.

Inherited from MetaData

optional

Return or set optional metadata.

opt

Return the metadata optional instance.

freeform

Get or set the current freeform metadata dictionary.

Public Methods:

Inherited from MetaData

get_metadata()

Get all metadata that are present.

generate_fmu_name()

Generate FMU name on form xxxx--yyyy--date but no suffix.


REQUIRED = {'ncol': 1, 'nrow': 1, 'rotation': 0.0, 'undef': 1e+33, 'xinc': 1.0, 'xori': 0.0, 'yflip': 1, 'yinc': 1.0, 'yori': 0.0}
__init__()[source]

Docstring.

property freeform

Get or set the current freeform metadata dictionary.

generate_fmu_name()

Generate FMU name on form xxxx–yyyy–date but no suffix.

Return type:

str

get_metadata()

Get all metadata that are present.

Return type:

dict[str, Any]

property opt

Return the metadata optional instance.

This makes access to the _OptionalMetaData instance.

Example::
>>> import xtgeo
>>> surf = xtgeo.surface_from_file(surface_dir + "/topreek_rota.gri")
>>> surf.metadata.opt.shortname = "TopValysar"
property optional

Return or set optional metadata.

When setting optional names, it can be done in several ways…

surf.metadata.optional.name = “New name”

property required

Get of set required metadata.

MetaDataRegularCube

class xtgeo.MetaDataRegularCube[source]

Bases: MetaData

Metadata for Cube() objects.

Docstring.

Public Data Attributes:

REQUIRED

required

Get of set required metadata.

Inherited from MetaData

optional

Return or set optional metadata.

opt

Return the metadata optional instance.

freeform

Get or set the current freeform metadata dictionary.

Public Methods:

Inherited from MetaData

get_metadata()

Get all metadata that are present.

generate_fmu_name()

Generate FMU name on form xxxx--yyyy--date but no suffix.


REQUIRED = {'ncol': 1, 'nlay': 1, 'nrow': 1, 'rotation': 0.0, 'undef': 1e+33, 'xinc': 1.0, 'xori': 0.0, 'yflip': 1, 'yinc': 1.0, 'yori': 0.0, 'zflip': 1, 'zinc': 1.0, 'zori': 0.0}
__init__()[source]

Docstring.

property freeform

Get or set the current freeform metadata dictionary.

generate_fmu_name()

Generate FMU name on form xxxx–yyyy–date but no suffix.

Return type:

str

get_metadata()

Get all metadata that are present.

Return type:

dict[str, Any]

property opt

Return the metadata optional instance.

This makes access to the _OptionalMetaData instance.

Example::
>>> import xtgeo
>>> surf = xtgeo.surface_from_file(surface_dir + "/topreek_rota.gri")
>>> surf.metadata.opt.shortname = "TopValysar"
property optional

Return or set optional metadata.

When setting optional names, it can be done in several ways…

surf.metadata.optional.name = “New name”

property required

Get of set required metadata.

MetaDataCPGeometry

class xtgeo.MetaDataCPGeometry[source]

Bases: MetaData

Metadata for Grid() objects of type simplified CornerPoint Geometry.

Docstring.

Public Data Attributes:

REQUIRED

required

Get of set required metadata.

Inherited from MetaData

optional

Return or set optional metadata.

opt

Return the metadata optional instance.

freeform

Get or set the current freeform metadata dictionary.

Public Methods:

Inherited from MetaData

get_metadata()

Get all metadata that are present.

generate_fmu_name()

Generate FMU name on form xxxx--yyyy--date but no suffix.


REQUIRED = {'ncol': 1, 'nlay': 1, 'nrow': 1, 'xscale': 1.0, 'xshift': 0.0, 'yscale': 1.0, 'yshift': 0.0, 'zscale': 1.0, 'zshift': 0.0}
__init__()[source]

Docstring.

property freeform

Get or set the current freeform metadata dictionary.

generate_fmu_name()

Generate FMU name on form xxxx–yyyy–date but no suffix.

Return type:

str

get_metadata()

Get all metadata that are present.

Return type:

dict[str, Any]

property opt

Return the metadata optional instance.

This makes access to the _OptionalMetaData instance.

Example::
>>> import xtgeo
>>> surf = xtgeo.surface_from_file(surface_dir + "/topreek_rota.gri")
>>> surf.metadata.opt.shortname = "TopValysar"
property optional

Return or set optional metadata.

When setting optional names, it can be done in several ways…

surf.metadata.optional.name = “New name”

property required

Get of set required metadata.

MetaDataCPProperty

class xtgeo.MetaDataCPProperty[source]

Bases: MetaData

Metadata for GridProperty() objects belonging to CPGeometry.

Docstring.

Public Data Attributes:

REQUIRED

required

Get of set required metadata.

Inherited from MetaData

optional

Return or set optional metadata.

opt

Return the metadata optional instance.

freeform

Get or set the current freeform metadata dictionary.

Public Methods:

Inherited from MetaData

get_metadata()

Get all metadata that are present.

generate_fmu_name()

Generate FMU name on form xxxx--yyyy--date but no suffix.


REQUIRED = {'codes': None, 'discrete': False, 'ncol': 1, 'nlay': 1, 'nrow': 1}
__init__()[source]

Docstring.

property freeform

Get or set the current freeform metadata dictionary.

generate_fmu_name()

Generate FMU name on form xxxx–yyyy–date but no suffix.

Return type:

str

get_metadata()

Get all metadata that are present.

Return type:

dict[str, Any]

property opt

Return the metadata optional instance.

This makes access to the _OptionalMetaData instance.

Example::
>>> import xtgeo
>>> surf = xtgeo.surface_from_file(surface_dir + "/topreek_rota.gri")
>>> surf.metadata.opt.shortname = "TopValysar"
property optional

Return or set optional metadata.

When setting optional names, it can be done in several ways…

surf.metadata.optional.name = “New name”

property required

Get of set required metadata.

MetaDataWell

class xtgeo.MetaDataWell[source]

Bases: MetaData

Metadata for single Well() objects.

Initialisation for Well metadata.

Public Data Attributes:

REQUIRED

required

Get of set required metadata.

Inherited from MetaData

optional

Return or set optional metadata.

opt

Return the metadata optional instance.

freeform

Get or set the current freeform metadata dictionary.

Public Methods:

Inherited from MetaData

get_metadata()

Get all metadata that are present.

generate_fmu_name()

Generate FMU name on form xxxx--yyyy--date but no suffix.


REQUIRED = {'mdlogname': None, 'name': 'noname', 'rkb': 0.0, 'wlogs': {}, 'xpos': 0.0, 'ypos': 0.0, 'zonelogname': None}
__init__()[source]

Initialisation for Well metadata.

property freeform

Get or set the current freeform metadata dictionary.

generate_fmu_name()

Generate FMU name on form xxxx–yyyy–date but no suffix.

Return type:

str

get_metadata()

Get all metadata that are present.

Return type:

dict[str, Any]

property opt

Return the metadata optional instance.

This makes access to the _OptionalMetaData instance.

Example::
>>> import xtgeo
>>> surf = xtgeo.surface_from_file(surface_dir + "/topreek_rota.gri")
>>> surf.metadata.opt.shortname = "TopValysar"
property optional

Return or set optional metadata.

When setting optional names, it can be done in several ways…

surf.metadata.optional.name = “New name”

property required

Get of set required metadata.