mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
* Move case loading commands from Commands to project and case * Major refactor * Fix problems with Python examples * Add ability to export snapshot from just one view + fixup * Case comments and black * Make all modules pass pylint test
This commit is contained in:
33
ApplicationCode/GrpcInterface/Python/rips/grid.py
Normal file
33
ApplicationCode/GrpcInterface/Python/rips/grid.py
Normal file
@@ -0,0 +1,33 @@
|
||||
# pylint: disable=too-few-public-methods
|
||||
|
||||
"""
|
||||
Module containing the Grid class, containing information
|
||||
about Case grids.
|
||||
"""
|
||||
|
||||
import rips.generated.Case_pb2 as Case_pb2
|
||||
import rips.generated.Grid_pb2 as Grid_pb2
|
||||
import rips.generated.Grid_pb2_grpc as Grid_pb2_grpc
|
||||
|
||||
class Grid:
|
||||
"""Grid Information. Not meant to be constructed separately
|
||||
|
||||
Create Grid objects using mathods on Case: Grid() and Grids()
|
||||
"""
|
||||
def __init__(self, index, case, channel):
|
||||
self.__channel = channel
|
||||
self.__stub = Grid_pb2_grpc.GridStub(self.__channel)
|
||||
|
||||
self.case = case
|
||||
self.index = index
|
||||
|
||||
def dimensions(self):
|
||||
"""The dimensions in i, j, k direction
|
||||
|
||||
Returns:
|
||||
Vec3i: class with integer attributes i, j, k giving extent in all three dimensions.
|
||||
"""
|
||||
case_request = Case_pb2.CaseRequest(id=self.case.case_id)
|
||||
return self.__stub.GetDimensions(
|
||||
Grid_pb2.GridRequest(case_request=case_request,
|
||||
grid_index=self.index)).dimensions
|
||||
Reference in New Issue
Block a user