Main Classes
Case class
Overview
Access to case information. Inherits PdmObjectBase and all its members.
Can be accessed with the case() and cases() methods on rips.Project
# Import module
import rips
# Connect to running instance
resinsight = rips.Instance.find()
# Get a list of cases
cases = resinsight.project.cases()
In practise each object is of the sub-classes rips.EclipseCase and rips.GeoMechCase. See Project Tree Classes for a description of them.
API Documentation
- class rips.Case(pb2_object: PdmObject | None = None, channel: Channel | None = None)
Bases:
PdmObjectBase
The ResInsight base class for Cases
- file_path
Case File Name
- Type:
Optional[str]
- id
Case ID
- Type:
int
- name
Case Name
- Type:
str
- name_setting
One of [FULL_CASE_NAME, SHORT_CASE_NAME, CUSTOM_NAME]
- Type:
str
- D = ~D
- O = ~O
- Value
alias of
bool
|str
|float
|int
|ValueArray
- ValueArray
alias of
List
[bool
|str
|float
|int
|ValueArray
]
- X = ~X
- active_cell_centers(porosity_model: str = 'MATRIX_MODEL')
Get a cell centers for all active cells. Synchronous, so returns a list.
- Parameters:
porosity_model (str) -- string enum. See available()
- Returns:
A list of Vec3d
- active_cell_centers_async(porosity_model: str = 'MATRIX_MODEL')
Get a cell centers for all active cells. Async, so returns an iterator
- Parameters:
porosity_model (str) -- string enum. See available()
- Returns:
An iterator to a chunk object containing an array of Vec3d values. Loop through the chunks and then the values within the chunk to get all values.
- active_cell_corners(porosity_model: str = 'MATRIX_MODEL')
Get a cell corners for all active cells. Synchronous, so returns a list.
- Arguments:
porosity_model(str): string enum. See available()
CellCorner class description:
Parameter | Description | Type ----------- | ------------ | ----- c0 | | Vec3d c1 | | Vec3d c2 | | Vec3d c3 | | Vec3d c4 | | Vec3d c5 | | Vec3d c6 | | Vec3d c7 | | Vec3d
- active_cell_corners_async(porosity_model: str = 'MATRIX_MODEL')
Get a cell corners for all active cells. Async, so returns an iterator
- Parameters:
porosity_model (str) -- string enum. See available()
- Returns:
An iterator to a chunk object containing an array of CellCorners (which is eight Vec3d values). Loop through the chunks and then the values within the chunk to get all values.
- active_cell_property(property_type, property_name, time_step, porosity_model: str = 'MATRIX_MODEL')
Get a cell property for all active cells. Sync, so returns a list. For argument details, see Result Definition
- Parameters:
property_type (str) -- string enum
property_name (str) -- name of an Eclipse property
time_step (int) -- the time step for which to get the property for
porosity_model (str) -- string enum
- Returns:
A list containing double values Loop through the chunks and then the values within the chunk to get all values.
- active_cell_property_async(property_type, property_name, time_step, porosity_model: str = 'MATRIX_MODEL')
Get a cell property for all active cells. Async, so returns an iterator. For argument details, see Result Definition
- Parameters:
property_type (str) -- string enum
property_name (str) -- name of an Eclipse property
time_step (int) -- the time step for which to get the property for
porosity_model (str) -- string enum
- Returns:
An iterator to a chunk object containing an array of double values Loop through the chunks and then the values within the chunk to get all values.
- add_new_object(class_definition: Type[D], child_field: str = '') D | None
Create and add an object to the specified child field :param class_definition[class]: Class definition of the object to create :param child_field[str]: The keyword for the field to create a new object in. If empty, the first child array field is used.
- Returns:
The created PdmObject inside the child_field
- address() Any
Get the unique address of the PdmObject
- Returns:
A 64-bit unsigned integer address
- ancestor(class_definition: Type[D]) D | None
Find the first ancestor that matches the provided class_keyword :param class_definition[class]: A class definition matching the type of class wanted
- available_nnc_properties()
Get a list of available NNC properties
NNCConnection class description:
Parameter | Description | Type ------------------------| --------------------------------------------- | ----- cell_grid_index1 | Reservoir Cell Index to cell 1 | int32 cell_grid_index2 | Reservoir Cell Index to cell 2 | int32 cell1 | Reservoir Cell IJK to cell 1 | Vec3i cell2 | Reservoir Cell IJK to cell 1 | Vec3i
- available_properties(property_type, porosity_model: str = 'MATRIX_MODEL')
Get a list of available properties
For argument details, see Result Definition
- Parameters:
property_type (str) -- string corresponding to property_type enum.
porosity_model (str) -- 'MATRIX_MODEL' or 'FRACTURE_MODEL'.
- cell_count(porosity_model: str = 'MATRIX_MODEL') int
Get a cell count object containing number of active cells and total number of cells
- Parameters:
porosity_model (str) -- String representing an enum. must be 'MATRIX_MODEL' or 'FRACTURE_MODEL'.
- Returns:
active_cell_count: number of active cells reservoir_cell_count: total number of reservoir cells
- Return type:
Cell Count object with the following integer attributes
CellCount class description:
Parameter | Description | Type ----------------------- | ------------------------- | ----- active_cell_count | Number of active cells | Integer reservoir_cell_count | Total number of cells | Integer
- cell_info_for_active_cells(porosity_model: str = 'MATRIX_MODEL')
Get list of cell info objects for current case
- Parameters:
porosity_model (str) -- String representing an enum. must be 'MATRIX_MODEL' or 'FRACTURE_MODEL'.
- Returns:
List of CellInfo objects
CellInfo class description:
Parameter | Description | Type ------------------------- | --------------------------------------------- | ----- grid_index | Index to grid | Integer parent_grid_index | Index to parent grid | Integer coarsening_box_index | Index to coarsening box | Integer local_ijk | Cell index in IJK directions of local grid | Vec3i parent_ijk | Cell index in IJK directions of parent grid | Vec3i
Vec3i class description:
Parameter | Description | Type ---------------- | -------------------------------------------- | ----- i | I grid index | Integer j | J grid index | Integer k | K grid index | Integer
- cell_info_for_active_cells_async(porosity_model: str = 'MATRIX_MODEL')
Get Stream of cell info objects for current case
- Parameters:
porosity_model (str) -- String representing an enum. must be 'MATRIX_MODEL' or 'FRACTURE_MODEL'.
- Returns:
Stream of CellInfo objects
See
rips.case.cell_info_for_active_cells()
for detalis on the CellInfo class.
- channel() Channel
Private method
- children(child_field: str, class_definition: Type[D]) List[D]
Get a list of all direct project tree children inside the provided child_field :param child_field[str]: A field name
- Returns:
A list of PdmObjects inside the child_field
- coarsening_info()
Get a coarsening information for all grids in the case.
- Returns:
A list of CoarseningInfo objects with two Vec3i min and max objects for each entry.
- copy_from(obj: object) None
Copy attribute values from object to self
- create_lgr_for_completion(time_step, well_path_names, refinement_i, refinement_j, refinement_k, split_type)
Create a local grid refinement for the completions on the given well paths
Parameters:
Parameter | Description | Type --------------- | -------------------------------------- | ----- time_steps | Time step index | Integer well_path_names | List of well path names | List of Strings refinement_i | Refinment in x-direction | Integer refinement_j | Refinment in y-direction | Integer refinement_k | Refinment in z-direction | Integer split_type | Defines how to split LGRS | String enum
Enum split_type:
Option | Description ------------------------| ------------ "LGR_PER_CELL" | One LGR for each completed cell "LGR_PER_COMPLETION" | One LGR for each completion (fracture, perforation, ...) "LGR_PER_WELL" | One LGR for each well
- create_multiple_fractures(template_id, well_path_names, min_dist_from_well_td, max_fractures_per_well, top_layer, base_layer, spacing, action)
Create Multiple Fractures in one go
Parameters:
Parameter | Description | Type -----------------------| ----------------------------------------- | ----- template_id | Id of the template | Integer well_path_names | List of well path names | List of Strings min_dist_from_well_td | Minimum distance from well TD | Double max_fractures_per_well | Max number of fractures per well | Integer top_layer | Top grid k-level for fractures | Integer base_layer | Base grid k-level for fractures | Integer spacing | Spacing between fractures | Double action | 'APPEND_FRACTURES' or 'REPLACE_FRACTURES' | String enum
- create_saturation_pressure_plots()
Create saturation pressure plots for the current case
- create_view()
Create a new view in the current case
- create_well_bore_stability_plot(well_path, time_step, parameters=None)
Create a new well bore stability plot
- Parameters:
well_path (str) -- well path name
time_step (int) -- time step
- Returns:
- days_since_start()
Get a list of decimal values representing days since the start of the simulation
- delete() None
Delete object in ResInsight
- descendants(class_definition: Type[D]) List[D]
Get a list of all project tree descendants matching the class keyword :param class_definition[class]: A class definition matching the type of class wanted
- Returns:
A list of PdmObjects matching the class_definition
- export_flow_characteristics(time_steps, injectors, producers, file_name, minimum_communication=0.0, aquifer_cell_threshold=0.1)
Export Flow Characteristics data to text file in CSV format
Parameters:
Parameter | Description | Type ------------------------- | --------------------------------------------- | ----- time_steps | Time step indices | List of Integer injectors | Injector names | List of Strings producers | Producer names | List of Strings file_name | Export file name | Integer minimum_communication | Minimum Communication, defaults to 0.0 | Integer aquifer_cell_threshold | Aquifer Cell Threshold, defaults to 0.1 | Integer
- export_msw(well_path)
Export Eclipse Multi-segment-well model to file
- Parameters:
well_path (str) -- Well path name
- export_property(time_step, property_name, eclipse_keyword=<class 'property'>, undefined_value=0.0, export_file=<class 'property'>)
Export an Eclipse property
- Parameters:
time_step (int) -- time step index
property_name (str) -- property to export
eclipse_keyword (str) -- Keyword used in export header. Defaults: value of property
undefined_value (double) -- Value to use for undefined values. Defaults to 0.0
export_file (str) -- File name for export. Defaults to the value of property parameter
- export_snapshots_of_all_views(prefix='', export_folder='')
Export snapshots for all views in the case
- Parameters:
prefix (str) -- Exported file name prefix
export_folder (str) -- The path to export to. By default will use the global export folder
- export_well_path_completions(time_step, well_path_names, file_split, compdat_export='TRANSMISSIBILITIES', include_perforations=True, include_fishbones=True, fishbones_exclude_main_bore=True, combination_mode='INDIVIDUALLY', export_welspec=True, export_comments=True, custom_file_name='')
Export well path completions for the current case to file
Parameters:
Parameter | Description | Type ----------------------------| ------------------------------------------------ | ----- time_step | Time step to export for | Integer well_path_names | List of well path names | List file_split | Controls how export data is split into files | String enum compdat_export | Compdat export type | String enum include_perforations | Export perforations? | bool include_fishbones | Export fishbones? | bool fishbones_exclude_main_bore | Exclude main bore when exporting fishbones? | bool combination_mode | Settings for multiple completions in same cell | String Enum export_welspec | Export WELSPEC keyword | bool export_comments | Export completion data source as comment | bool custom_file_name | Custom filename when file_split is "UNIFIED_FILE"| String
Enum file_split:
Option | Description ----------------------------------- | ------------ "UNIFIED_FILE" | A single file with all combined transmissibilities "SPLIT_ON_WELL" | One file for each well with combined transmissibilities "SPLIT_ON_WELL_AND_COMPLETION_TYPE" | One file for each completion type for each well
Enum compdat_export:
Option | Description ------------------------------------------- | ------------ "TRANSMISSIBILITIES" | Direct export of transmissibilities "WPIMULT_AND_DEFAULT_CONNECTION_FACTORS" | Include WPIMULT in addition to transmissibilities
Enum combination_mode:
Option | Description ------------------- | ------------ "INDIVIDUALLY" | Exports the different completion types into separate sections "COMBINED" | Export one combined transmissibility for each cell
- grid(index: int = 0) Grid
Get Grid of a given index
- Parameters:
index (int) -- The grid index
- Returns:
- grid_property(property_type, property_name, time_step, grid_index=0, porosity_model: str = 'MATRIX_MODEL')
Get a cell property for all grid cells. Synchronous, so returns a list. For argument details, see Result Definition
- Parameters:
property_type (str) -- string enum
property_name (str) -- name of an Eclipse property
time_step (int) -- the time step for which to get the property for
grid_index (int) -- index to the grid we're getting values for
porosity_model (str) -- string enum
- Returns:
A list of double values
- grid_property_async(property_type, property_name, time_step, grid_index=0, porosity_model: str = 'MATRIX_MODEL')
Get a cell property for all grid cells. Async, so returns an iterator. For argument details, see Result Definition
- Parameters:
property_type (str) -- string enum
property_name (str) -- name of an Eclipse property
time_step (int) -- the time step for which to get the property for
gridIndex (int) -- index to the grid we're getting values for
porosity_model (str) -- string enum
- Returns:
An iterator to a chunk object containing an array of double values Loop through the chunks and then the values within the chunk to get all values.
- grids() List[Grid]
Get a list of all rips Grid objects in the case
- Returns:
List of
rips.grid.Grid
- has_warnings() bool
- import_formation_names(formation_files=None)
Import formation names into project and apply it to the current case
- Parameters:
formation_files (list) -- list of files to import
- nnc_connections()
Get the NNC connection. Synchronous, so returns a list.
- Returns:
A list of NNCConnection objects.
- nnc_connections_async()
Get the NNC connections. Async, so returns an iterator.
- Returns:
An iterator to a chunk object containing an array NNCConnection objects. Loop through the chunks and then the connection within the chunk to get all connections.
- nnc_connections_dynamic_values(property_name, time_step)
Get the dynamic NNC values.
- Returns:
A list of doubles. The order of the list matches the list from nnc_connections, i.e. the nth object of nnc_connections() refers to nth value in this list.
- nnc_connections_dynamic_values_async(property_name, time_step)
Get the dynamic NNC values. Async, so returns an iterator.
- Returns:
An iterator to a chunk object containing an list of doubles. Loop through the chunks and then the values within the chunk to get values for all the connections. The order of the list matches the list from nnc_connections, i.e. the nth object of nnc_connections() refers to nth value in this list.
- nnc_connections_generated_values(property_name, time_step)
Get the generated NNC values.
- Returns:
A list of doubles. The order of the list matches the list from nnc_connections, i.e. the nth object of nnc_connections() refers to nth value in this list.
- nnc_connections_generated_values_async(property_name, time_step)
Get the generated NNC values. Async, so returns an iterator.
- Returns:
An iterator to a chunk object containing an list of doubles. Loop through the chunks and then the values within the chunk to get values for all the connections. The order of the list matches the list from nnc_connections, i.e. the nth object of nnc_connections() refers to nth value in this list.
- nnc_connections_static_values(property_name)
Get the static NNC values.
- Returns:
A list of doubles. The order of the list matches the list from nnc_connections, i.e. the nth object of nnc_connections() refers to nth value in this list.
- nnc_connections_static_values_async(property_name)
Get the static NNC values. Async, so returns an iterator.
- Returns:
An iterator to a chunk object containing an list of doubles. Loop through the chunks and then the values within the chunk to get values for all the connections. The order of the list matches the list from nnc_connections, i.e. the nth object of nnc_connections() refers to nth value in this list.
- pb2_object() PdmObject
Private method
- print_object_info() None
Print the structure and data content of the PdmObject
- replace(new_grid_file)
Replace the current case grid with a new grid loaded from file
- Parameters:
new_egrid_file (str) -- Path to EGRID file
- reservoir_boundingbox()
Get the reservoir bounding box
- Returns:
BoundingBox
BoundingBox class description:
Type | Name --------- | ---------- int | min_x int | max_x int | min_y int | max_y int | min_z int | max_z
- reservoir_depth_range() Tuple[float, float]
Get the reservoir depth range
- Returns:
A tuple with two members. The first is the minimum depth, the second is the maximum depth
- selected_cell_property(property_type, property_name, time_step, porosity_model: str = 'MATRIX_MODEL')
Get a cell property for all selected cells. Sync, so returns a list. For argument details, see Result Definition
- Parameters:
property_type (str) -- string enum
property_name (str) -- name of an Eclipse property
time_step (int) -- the time step for which to get the property for
porosity_model (str) -- string enum
- Returns:
A list containing double values Loop through the chunks and then the values within the chunk to get all values.
- selected_cell_property_async(property_type, property_name, time_step, porosity_model: str = 'MATRIX_MODEL')
Get a cell property for all selected cells. Async, so returns an iterator. For argument details, see Result Definition
- Parameters:
property_type (str) -- string enum
property_name (str) -- name of an Eclipse property
time_step (int) -- the time step for which to get the property for
porosity_model (str) -- string enum
- Returns:
An iterator to a chunk object containing an array of double values Loop through the chunks and then the values within the chunk to get all values.
- selected_cells()
Get the selected cells. Synchronous, so returns a list.
- Returns:
A list of Cells.
- selected_cells_async()
Get the selected cells. Async, so returns an iterator.
- Returns:
An iterator to a chunk object containing an array of cells. Loop through the chunks and then the cells within the chunk to get all cells.
- set_active_cell_property(values, property_type, property_name, time_step, porosity_model: str = 'MATRIX_MODEL')
Set a cell property for all active cells. For argument details, see Result Definition
- Parameters:
values (list) -- a list of double precision floating point numbers
property_type (str) -- string enum
property_name (str) -- name of an Eclipse property
time_step (int) -- the time step for which to get the property for
porosity_model (str) -- string enum
- set_active_cell_property_async(values_iterator, property_type, property_name, time_step, porosity_model: str = 'MATRIX_MODEL')
Set cell property for all active cells Async. Takes an iterator to the input values. For argument details, see Result Definition
- Parameters:
values_iterator (iterator) -- an iterator to the properties to be set
property_type (str) -- string enum
property_name (str) -- name of an Eclipse property
time_step (int) -- the time step for which to get the property for
porosity_model (str) -- string enum
- set_grid_property(values, property_type, property_name, time_step, grid_index=0, porosity_model: str = 'MATRIX_MODEL')
Set a cell property for all grid cells. For argument details, see Result Definition
- Parameters:
values (list) -- a list of double precision floating point numbers
property_type (str) -- string enum
property_name (str) -- name of an Eclipse property
time_step (int) -- the time step for which to get the property for
grid_index (int) -- index to the grid we're setting values for
porosity_model (str) -- string enum
- set_nnc_connections_values(values, property_name, time_step, porosity_model: str = 'MATRIX_MODEL')
Set nnc connection values for all connections..
- Parameters:
values (list) -- a list of double precision floating point numbers
property_name (str) -- name of an Eclipse property
time_step (int) -- the time step for which to get the property for
porosity_model (str) -- string enum. See available()
- set_value(snake_keyword: str, value: object) None
Set the value associated with the provided keyword and updates ResInsight
- Parameters:
keyword (str) -- A string containing the parameter keyword
value (varying) -- A value matching the type of the parameter. See keyword documentation and/or print_object_info() to find the correct data type.
- set_visible(visible: bool) None
Set the visibility of the object in the ResInsight project tree
- simulation_wells()
Get a list of all simulation wells for a case
- time_steps()
Get a list containing all time steps
The time steps are defined by the class TimeStepDate
TimeStepDate class description:
Type | Name --------- | ---------- int | year int | month int | day int | hour int | minute int | second
- update() None
Sync all fields from the Python Object to ResInsight
- view(view_id)
Get a particular view belonging to a case by providing view id
- Parameters:
view_id (int) -- view id
- Returns:
- views()
Get all views of a case
- Returns:
- visible() bool
Get the visibility of the object in the ResInsight project tree
- warnings() List[str]
Detailed documentation rips.Case
Examples
See All Cases, Load Case and Selected Cases.
Result Definition
When working with grid case results, the following two arguments are used in many functions to identify a result
Result Definition enums:
property_type | | porosity_model
(str enum) | | (str enum)
----------------------- | ----- | --------------
DYNAMIC_NATIVE | | MATRIX_MODEL
STATIC_NATIVE | | FRACTURE_MODEL
SOURSIMRL | |
GENERATED | |
INPUT_PROPERTY | |
FORMATION_NAMES | |
FLOW_DIAGNOSTICS | |
INJECTION_FLOODING | |
Grid class
Overview
Access to grid geometry and size information. Can be accessed with the grid() and grids() methods on rips.Case.
API Documentation
- class rips.Grid(index: int, case: Case, channel: Channel)
Bases:
object
Grid Information. Created by methods in Case
rips.case.grid()
rips.case.grids()
- cell_centers() List[Vec3d]
The cell center for all cells in given grid
- Returns:
class with double attributes x, y, x giving cell centers
- Return type:
List of Vec3d
- cell_centers_async()
The cells center for all cells in given grid async.
- Returns:
class with double attributes x, y, x giving cell centers
- Return type:
Iterator to a list of Vec3d
- cell_corners()
The cell corners for all cells in given grid
- Returns:
a class with Vec3d for each corner (c0, c1.., c7)
- Return type:
list of CellCorners
- cell_corners_async()
The cell corners for all cells in given grid, async.
- Returns:
a class with Vec3d for each corner (c0, c1.., c7)
- Return type:
iterator to a list of CellCorners
- cell_count() int
Cell count in grid
- Returns:
Cell count in grid
- Return type:
int
- dimensions() Vec3i | None
The dimensions in i, j, k direction
- Returns:
class with integer attributes i, j, k giving extent in all three dimensions.
- Return type:
Vec3i
- property_data_index_from_ijk(i: int, j: int, k: int) int
Compute property index from 1-based IJK cell address. Cell Property Result data is organized by I, J and K.
property_data_index = dims.i * dims.j * (k - 1) + dims.i * (j - 1) + (i - 1)
- Returns:
Cell property result index from IJK
- Return type:
int
Detailed documentation rips.Grid
Examples
See Grid Information.
Instance - the main starting point
Overview
The basic access class to ResInsight. Use to find or launch a running instance of ResInsight
import rips
# Connect to ResInsight instance
resinsight = rips.Instance.find()
# Get the ResInsight project
project = resinsight.project
API Documentation
- class rips.Instance(port: int = 50051, launched: bool = False)
Bases:
object
The ResInsight Instance class. Use to launch or find existing ResInsight instances
- launched
Tells us whether the application was launched as a new process. If the application was launched we may need to close it when exiting the script.
- Type:
bool
- commands
Command executor. Set when creating an instance.
- Type:
Commands
- project
Current project in ResInsight. Set when creating an instance and updated when opening/closing projects.
- Type:
- client_version_string() str
Get a full version string, i.e. 2019.04.01
- exit()
Tell ResInsight instance to quit
- static find(start_port: int = 50051, end_port: int = 50071) Instance | None
Search for an existing Instance of ResInsight by testing ports.
By default we search from port 50051 to 50071 or if the environment variable RESINSIGHT_GRPC_PORT is set we search RESINSIGHT_GRPC_PORT to RESINSIGHT_GRPC_PORT+20
- Parameters:
start_port (int) -- start searching from this port
end_port (int) -- search up to but not including this port
- is_console() bool
Returns true if the connected ResInsight instance is a console app
- is_gui() bool
Returns true if the connected ResInsight instance is a GUI app
- static launch(resinsight_executable: str = '', console: bool = False, launch_port: int = 0, init_timeout: int = 300, command_line_parameters: List[str] = []) Instance | None
Launch a new Instance of ResInsight. This requires the environment variable RESINSIGHT_EXECUTABLE to be set or the parameter resinsight_executable to be provided. The RESINSIGHT_GRPC_PORT environment variable can be set to an alternative port number.
- Parameters:
resinsight_executable (str) -- Path to a valid ResInsight executable. If set will take precedence over what is provided in the RESINSIGHT_EXECUTABLE environment variable.
console (bool) -- If True, launch as console application, without GUI.
launch_port (int) -- If 0, GRPC will find an available port. If -1, use the default port 50051 or RESINSIGHT_GRPC_PORT If anything else, ResInsight will try to launch with the specified portnumber.
init_timeout -- Number of seconds to wait for initialization before timing out.
command_line_parameters (list) -- Additional parameters as string entries in the list.
- Returns:
an instance object if it worked. None if not.
- Return type:
- major_version() int
Get an integer with the major version number
- minor_version() int
Get an integer with the minor version number
- patch_version() int
Get an integer with the patch version number
- set_export_folder(export_type: str, path: str, create_folder: bool = False)
Set the export folder used for all export functions
Parameters:
Parameter | Description | Type ---------------- | -------------------------------------------- | ----- export_type | String specifying what to export | String path | Path to folder | String create_folder | Create folder if it doesn't exist? | Boolean
Enum export_type:
Option | Description --------------- | ------------ "COMPLETIONS" | "SNAPSHOTS" | "PROPERTIES" | "STATISTICS" |
- set_main_window_size(width: int, height: int)
Set the main window size in pixels
Parameters:
Parameter | Description | Type --------- | ---------------- | ----- width | Width in pixels | Integer height | Height in pixels | Integer
- set_plot_window_size(width: int, height: int)
Set the plot window size in pixels
Parameters:
Parameter | Description | Type --------- | ---------------- | ----- width | Width in pixels | Integer height | Height in pixels | Integer
- set_start_dir(path: str)
Set current start directory
- Parameters:
path (str) -- path to directory
- version_string() str
Get a full version string, i.e. 2019.04.01
Detailed documentation rips.Instance
Examples
PdmObjectBase class
Overview
The base class of all data classes in ResInsight. Not used directly but all attributes and methods are available in the other ResInsight data classes.
For any object based on PdmObjectBase you can access ancestors and descendants using the methods ancestors(), children() and descendants() using a class name as the argument
import rips
# Connect to ResInsight instance
resinsight = rips.Instance.find()
# Get a list of all plot windows
plot_windows = resinsight.project.descendants(rips.PlotWindow)
See Project Tree Classes for all classes based on PdmObjectBase.
API Documentation
Detailed documentation rips.PdmObjectBase
Project class
Overview
The ResInsight project. Inherits PdmObjectBase and all its members. Always available as an object member "project" on the rips.Instance
# Import the module
import rips
# Connect to a ResInsight instance
resinsight = rips.Instance.find()
# Get the project
project = resinsight.project
API Documentation
- class rips.Project(pb2_object: PdmObject | None = None, channel: Channel | None = None)
Bases:
PdmObjectBase
The ResInsight Project
- D = ~D
- O = ~O
- Value
alias of
bool
|str
|float
|int
|ValueArray
- ValueArray
alias of
List
[bool
|str
|float
|int
|ValueArray
]
- X = ~X
- add_new_object(class_definition: Type[D], child_field: str = '') D | None
Create and add an object to the specified child field :param class_definition[class]: Class definition of the object to create :param child_field[str]: The keyword for the field to create a new object in. If empty, the first child array field is used.
- Returns:
The created PdmObject inside the child_field
- address() Any
Get the unique address of the PdmObject
- Returns:
A 64-bit unsigned integer address
- ancestor(class_definition: Type[D]) D | None
Find the first ancestor that matches the provided class_keyword :param class_definition[class]: A class definition matching the type of class wanted
- case(case_id: int) Reservoir | None
Get a specific grid case from the provided case Id
- Parameters:
id (int) -- case id
- Returns:
rips.generated.resinsight_classes.Case
- cases() List[Reservoir]
Get a list of all grid cases in the project
- Returns:
A list of
rips.generated.generated_classes.Case
- channel() Channel
Private method
- children(child_field: str, class_definition: Type[D]) List[D]
Get a list of all direct project tree children inside the provided child_field :param child_field[str]: A field name
- Returns:
A list of PdmObjects inside the child_field
- close() None
Close the current project (and open new blank project)
- copy_from(obj: object) None
Copy attribute values from object to self
- create() Project
- create_grid_case_group(case_paths)
Create a Grid Case Group from a list of cases
- Parameters:
case_paths (list) -- list of file path strings
- Returns:
rips.generated.resinsight_classes.GridCaseGroup
- delete() None
Delete object in ResInsight
- descendants(class_definition: Type[D]) List[D]
Get a list of all project tree descendants matching the class keyword :param class_definition[class]: A class definition matching the type of class wanted
- Returns:
A list of PdmObjects matching the class_definition
- export_multi_case_snapshots(grid_list_file)
Export snapshots for a set of cases
- Parameters:
grid_list_file (str) -- Path to a file containing a list of grids to export snapshot for
- export_snapshots(snapshot_type='ALL', prefix='', plot_format='PNG')
Export all snapshots of a given type
- Parameters:
snapshot_type (str) -- Enum string ('ALL', 'VIEWS' or 'PLOTS')
prefix (str) -- Exported file name prefix
plot_format (str) -- Enum string, 'PNG' or 'PDF'
- export_well_paths(well_paths=None, md_step_size=5.0)
Export a set of well paths
- Parameters:
well_paths (list) -- List of strings of well paths. If none, export all.
md_step_size (double) -- resolution of the exported well path
- grid_case_group(group_id)
Get a particular grid case group belonging to a project
- Parameters:
groupId (int) -- group id
- Returns:
- grid_case_groups()
Get a list of all grid case groups in the project
- Returns:
- has_warnings() bool
- import_formation_names(formation_files=None)
Import formation names into project
- Parameters:
formation_files (list) -- list of files to import
- import_summary_case(file_name: str = '') FileSummaryCase | None
Import Summary Case
- Parameters:
file_name (str)
- Returns:
FileSummaryCase
- import_well_log_files(well_log_files=None, well_log_folder='')
Import well log files into project
- Parameters:
well_log_files (list) -- List of file paths to import
well_log_folder (str) -- A folder path containing files to import
- Returns:
A list of well path names (strings) that had logs imported
- import_well_paths(well_path_files=None, well_path_folder='')
Import well paths into project
- Parameters:
well_path_files (list) -- List of file paths to import
well_path_folder (str) -- A folder path containing files to import
- Returns:
- load_case(path: str, grid_only: bool = False) Reservoir
Load a new grid case from the given file path
- Parameters:
path (str) -- file path to case
- Returns:
- open(path)
Open a new project from the given path
- Parameters:
path (str) -- path to project file
- pb2_object() PdmObject
Private method
- plot(view_id)
Get a particular plot by providing view id
- Parameters:
view_id (int) -- view id
- Returns:
- plots()
Get a list of all plots belonging to a project
- Returns:
- print_object_info() None
Print the structure and data content of the PdmObject
- replace_source_cases(grid_list_file, case_group_id=0)
Replace all source grid cases within a case group
- Parameters:
grid_list_file (str) -- path to file containing a list of cases
case_group_id (int) -- id of the case group to replace
- save(path='')
Save the project to the existing project file, or to a new file
- Parameters:
path (str) -- File path to the file to save the project to. If empty, saves to the active project file
- scale_fracture_template(template_id, half_length, height, d_factor, conductivity)
Scale fracture template parameters
- Parameters:
template_id (int) -- ID of fracture template
half_length (double) -- Half Length scale factor
height (double) -- Height scale factor
d_factor (double) -- D-factor scale factor
conductivity (double) -- Conductivity scale factor
- selected_cases() List[Case]
Get a list of all grid cases selected in the project tree
- Returns:
A list of
rips.generated.generated_classes.Case
- set_fracture_containment(template_id, top_layer, base_layer)
Set fracture template containment parameters
- Parameters:
template_id (int) -- ID of fracture template
top_layer (int) -- Top layer containment
base_layer (int) -- Base layer containment
- set_value(snake_keyword: str, value: object) None
Set the value associated with the provided keyword and updates ResInsight
- Parameters:
keyword (str) -- A string containing the parameter keyword
value (varying) -- A value matching the type of the parameter. See keyword documentation and/or print_object_info() to find the correct data type.
- set_visible(visible: bool) None
Set the visibility of the object in the ResInsight project tree
- summary_case(case_id: int = -1) FileSummaryCase | None
Find Summary Case
- Parameters:
case_id (int)
- Returns:
FileSummaryCase
- summary_cases()
Get a list of all summary cases in the Project
Returns: A list of
rips.generated.resinsight_classes.SummaryCase
- surface_folder(folder_name: str = '') SurfaceCollection | None
Get Surface Folder
- Parameters:
folder_name (str)
- Returns:
SurfaceCollection
- update() None
Sync all fields from the Python Object to ResInsight
- view(view_id)
Get a particular view belonging to a case by providing view id
- Parameters:
view_id (int) -- view id
- Returns:
- views()
Get a list of views belonging to a project
- visible() bool
Get the visibility of the object in the ResInsight project tree
- warnings() List[str]
- well_path_by_name(well_path_name)
Get a specific well path by name from the project
- well_paths()
Get a list of all well paths in the project
- Returns:
Detailed documentation rips.Project
Examples
See Open Project
View class
Overview
The base class of all views in ResInsight. Inherits PdmObjectBase and all its members
API Documentation
- class rips.View(pb2_object: PdmObject | None = None, channel: Channel | None = None)
Bases:
ViewWindow
- background_color
Background
- Type:
str
- current_time_step
Current Time Step
- Type:
int
- disable_lighting
Disable Results Lighting
- Type:
bool
- grid_z_scale
Z Scale
- Type:
float
- id
View ID
- Type:
int
- perspective_projection
Perspective Projection
- Type:
bool
- show_grid_box
Show Grid Box
- Type:
bool
- show_z_scale
Show Z Scale Label
- Type:
bool
- D = ~D
- O = ~O
- Value
alias of
bool
|str
|float
|int
|ValueArray
- ValueArray
alias of
List
[bool
|str
|float
|int
|ValueArray
]
- X = ~X
- add_new_object(class_definition: Type[D], child_field: str = '') D | None
Create and add an object to the specified child field :param class_definition[class]: Class definition of the object to create :param child_field[str]: The keyword for the field to create a new object in. If empty, the first child array field is used.
- Returns:
The created PdmObject inside the child_field
- address() Any
Get the unique address of the PdmObject
- Returns:
A 64-bit unsigned integer address
- ancestor(class_definition: Type[D]) D | None
Find the first ancestor that matches the provided class_keyword :param class_definition[class]: A class definition matching the type of class wanted
- apply_cell_result(result_type, result_variable)
Apply a regular cell result
- Parameters:
result_type (str) --
- String representing the result category. The valid values are::
DYNAMIC_NATIVE
STATIC_NATIVE
SOURSIMRL
GENERATED
INPUT_PROPERTY
FORMATION_NAMES
FLOW_DIAGNOSTICS
INJECTION_FLOODING
result_variable (str) -- String representing the result variable.
- apply_flow_diagnostics_cell_result(result_variable='TOF', selection_mode='FLOW_TR_BY_SELECTION', injectors=None, producers=None)
Apply a flow diagnostics cell result
Parameters:
Parameter | Description | Type ------------------- | ------------------------------------------------------ | ----- result_variable | String representing the result value | String selection_mode | String specifying which tracers to select | String injectors | List of injector names, used by 'FLOW_TR_BY_SELECTION' | String List producers | List of injector names, used by 'FLOW_TR_BY_SELECTION' | String List
Enum compdat_export:
Option | Description ------------------------| ------------ "TOF" | Time of flight "Fraction" | Fraction "MaxFractionTracer" | Max Fraction Tracer "Communication" | Communication
- case()
Get the case the view belongs to
- channel() Channel
Private method
- children(child_field: str, class_definition: Type[D]) List[D]
Get a list of all direct project tree children inside the provided child_field :param child_field[str]: A field name
- Returns:
A list of PdmObjects inside the child_field
- clone()
Clone the current view
- copy_from(obj: object) None
Copy attribute values from object to self
- delete() None
Delete object in ResInsight
- descendants(class_definition: Type[D]) List[D]
Get a list of all project tree descendants matching the class keyword :param class_definition[class]: A class definition matching the type of class wanted
- Returns:
A list of PdmObjects matching the class_definition
- export_property(undefined_value=0.0)
Export the current Eclipse property from the view
- Parameters:
undefined_value (double) -- Value to use for undefined values. Defaults to 0.0
- export_sim_well_fracture_completions(time_step, simulation_well_names, file_split, compdat_export)
Export fracture completions for simulation wells
Parameters:
Parameter | Description | Type ----------------------------| ------------------------------------------------ | ----- time_step | Time step to export for | Integer simulation_well_names | List of simulation well names | List file_split | Controls how export data is split into files | String enum compdat_export | Compdat export type | String enum
Enum file_split:
Option | Description ----------------------------------- | ------------ "UNIFIED_FILE" <b>Default Option</b>| A single file with all transmissibilities "SPLIT_ON_WELL" | One file for each well transmissibilities "SPLIT_ON_WELL_AND_COMPLETION_TYPE" | One file for each completion type for each well
Enum compdat_export:
Option | Description -----------------------------------------| ------------ "TRANSMISSIBILITIES"<b>Default Option</b>| Direct export of transmissibilities "WPIMULT_AND_DEFAULT_CONNECTION_FACTORS" | Include export of WPIMULT
- export_snapshot(prefix='', export_folder='')
Export snapshot for the current view
- Parameters:
prefix (str) -- Exported file name prefix
export_folder (str) -- The path to export to. By default will use the global export folder
- export_visible_cells(export_keyword='FLUXNUM', visible_active_cells_value=1, hidden_active_cells_value=0, inactive_cells_value=0)
Export special properties for all visible cells.
- Parameters:
export_keyword (string) -- The keyword to export.
Choices -- 'FLUXNUM' or 'MULTNUM'. Default: 'FLUXNUM'
visible_active_cells_value (int) -- Value to export forvisible active cells. Default: 1
hidden_active_cells_value (int) -- Value to export for hidden active cells. Default: 0
inactive_cells_value (int) -- Value to export for inactive cells. Default: 0
- has_warnings() bool
- pb2_object() PdmObject
Private method
- print_object_info() None
Print the structure and data content of the PdmObject
- set_time_step(time_step)
Set the time step for current view
- set_value(snake_keyword: str, value: object) None
Set the value associated with the provided keyword and updates ResInsight
- Parameters:
keyword (str) -- A string containing the parameter keyword
value (varying) -- A value matching the type of the parameter. See keyword documentation and/or print_object_info() to find the correct data type.
- set_visible(visible: bool) None
Set the visibility of the object in the ResInsight project tree
- update() None
Sync all fields from the Python Object to ResInsight
- visible() bool
Get the visibility of the object in the ResInsight project tree
- warnings() List[str]
Detailed documentation rips.View
Examples
See View Example and Set Cell Result.