mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4736 Properties renames
This commit is contained in:
@@ -30,7 +30,7 @@ class Properties:
|
||||
self.chunkSize = 8160
|
||||
|
||||
|
||||
def __generatePropertyInputIterator(self, values_iterator, parameters):
|
||||
def __generate_property_input_iterator(self, values_iterator, parameters):
|
||||
chunk = Properties_pb2.PropertyInputChunk()
|
||||
chunk.params.CopyFrom(parameters)
|
||||
yield chunk
|
||||
@@ -40,7 +40,7 @@ class Properties:
|
||||
chunk.values.CopyFrom(valmsg)
|
||||
yield chunk
|
||||
|
||||
def __generatePropertyInputChunks(self, array, parameters):
|
||||
def __generate_property_input_chunks(self, array, parameters):
|
||||
|
||||
index = -1
|
||||
while index < len(array):
|
||||
@@ -49,20 +49,20 @@ class Properties:
|
||||
chunk.params.CopyFrom(parameters)
|
||||
index += 1
|
||||
else:
|
||||
actualChunkSize = min(len(array) - index + 1, self.chunkSize)
|
||||
chunk.values.CopyFrom(Properties_pb2.PropertyChunk(values = array[index:index+actualChunkSize]))
|
||||
index += actualChunkSize
|
||||
actual_chunk_size = min(len(array) - index + 1, self.chunkSize)
|
||||
chunk.values.CopyFrom(Properties_pb2.PropertyChunk(values = array[index:index+actual_chunk_size]))
|
||||
index += actual_chunk_size
|
||||
|
||||
yield chunk
|
||||
# Final empty message to signal completion
|
||||
chunk = Properties_pb2.PropertyInputChunk()
|
||||
yield chunk
|
||||
|
||||
def available(self, propertyType, porosityModel = 'MATRIX_MODEL'):
|
||||
def available(self, property_type, porosity_model = 'MATRIX_MODEL'):
|
||||
"""Get a list of available properties
|
||||
|
||||
Arguments:
|
||||
propertyType (str): string corresponding to propertyType enum. Can be one of the following:
|
||||
property_type (str): string corresponding to property_type enum. Can be one of the following:
|
||||
- DYNAMIC_NATIVE
|
||||
- STATIC_NATIVE
|
||||
- SOURSIMRL
|
||||
@@ -72,167 +72,167 @@ class Properties:
|
||||
- FLOW_DIAGNOSTICS
|
||||
- INJECTION_FLOODING
|
||||
|
||||
porosityModel(str): 'MATRIX_MODEL' or 'FRACTURE_MODEL'.
|
||||
porosity_model(str): 'MATRIX_MODEL' or 'FRACTURE_MODEL'.
|
||||
"""
|
||||
|
||||
propertyTypeEnum = Properties_pb2.PropertyType.Value(propertyType)
|
||||
porosityModelEnum = Case_pb2.PorosityModelType.Value(porosityModel)
|
||||
property_type_enum = Properties_pb2.PropertyType.Value(property_type)
|
||||
porosity_model_enum = Case_pb2.PorosityModelType.Value(porosity_model)
|
||||
request = Properties_pb2.AvailablePropertiesRequest (case_request = Case_pb2.CaseRequest(id=self.case.id),
|
||||
property_type = propertyTypeEnum,
|
||||
porosity_model = porosityModelEnum)
|
||||
property_type = property_type_enum,
|
||||
porosity_model = porosity_model_enum)
|
||||
return self.propertiesStub.GetAvailableProperties(request).property_names
|
||||
|
||||
def activeCellPropertyAsync(self, propertyType, propertyName, timeStep, porosityModel = 'MATRIX_MODEL'):
|
||||
def active_cell_property_async(self, property_type, property_name, time_step, porosity_model = 'MATRIX_MODEL'):
|
||||
"""Get a cell property for all active cells. Async, so returns an iterator
|
||||
|
||||
Arguments:
|
||||
propertyType(str): string enum. See available()
|
||||
propertyName(str): name of an Eclipse property
|
||||
timeStep(int): the time step for which to get the property for
|
||||
porosityModel(str): string enum. See available()
|
||||
property_type(str): string enum. See available()
|
||||
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()
|
||||
|
||||
Returns:
|
||||
An iterator to a chunk object containing an array of double values
|
||||
You first loop through the chunks and then the values within the chunk to get all values.
|
||||
"""
|
||||
propertyTypeEnum = Properties_pb2.PropertyType.Value(propertyType)
|
||||
porosityModelEnum = Case_pb2.PorosityModelType.Value(porosityModel)
|
||||
property_type_enum = Properties_pb2.PropertyType.Value(property_type)
|
||||
porosity_model_enum = Case_pb2.PorosityModelType.Value(porosity_model)
|
||||
request = Properties_pb2.PropertyRequest(case_request = Case_pb2.CaseRequest(id=self.case.id),
|
||||
property_type = propertyTypeEnum,
|
||||
property_name = propertyName,
|
||||
time_step = timeStep,
|
||||
porosity_model = porosityModelEnum)
|
||||
property_type = property_type_enum,
|
||||
property_name = property_name,
|
||||
time_step = time_step,
|
||||
porosity_model = porosity_model_enum)
|
||||
for chunk in self.propertiesStub.GetActiveCellProperty(request):
|
||||
yield chunk
|
||||
|
||||
def activeCellProperty(self, propertyType, propertyName, timeStep, porosityModel = 'MATRIX_MODEL'):
|
||||
def active_cell_property(self, property_type, property_name, time_step, porosity_model = 'MATRIX_MODEL'):
|
||||
"""Get a cell property for all active cells. Sync, so returns a list
|
||||
|
||||
Arguments:
|
||||
propertyType(str): string enum. See available()
|
||||
propertyName(str): name of an Eclipse property
|
||||
timeStep(int): the time step for which to get the property for
|
||||
porosityModel(str): string enum. See available()
|
||||
property_type(str): string enum. See available()
|
||||
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()
|
||||
|
||||
Returns:
|
||||
A list containing double values
|
||||
You first loop through the chunks and then the values within the chunk to get all values.
|
||||
"""
|
||||
allValues = []
|
||||
generator = self.activeCellPropertyAsync(propertyType, propertyName, timeStep, porosityModel)
|
||||
all_values = []
|
||||
generator = self.active_cell_property_async(property_type, property_name, time_step, porosity_model)
|
||||
for chunk in generator:
|
||||
for value in chunk.values:
|
||||
allValues.append(value)
|
||||
return allValues
|
||||
all_values.append(value)
|
||||
return all_values
|
||||
|
||||
def gridPropertyAsync(self, propertyType, propertyName, timeStep, gridIndex = 0, porosityModel = 'MATRIX_MODEL'):
|
||||
def grid_property_async(self, property_type, property_name, time_step, gridIndex = 0, porosity_model = 'MATRIX_MODEL'):
|
||||
"""Get a cell property for all grid cells. Async, so returns an iterator
|
||||
|
||||
Arguments:
|
||||
propertyType(str): string enum. See available()
|
||||
propertyName(str): name of an Eclipse property
|
||||
timeStep(int): the time step for which to get the property for
|
||||
property_type(str): string enum. See available()
|
||||
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
|
||||
porosityModel(str): string enum. See available()
|
||||
porosity_model(str): string enum. See available()
|
||||
|
||||
Returns:
|
||||
An iterator to a chunk object containing an array of double values
|
||||
You first loop through the chunks and then the values within the chunk to get all values.
|
||||
"""
|
||||
propertyTypeEnum = Properties_pb2.PropertyType.Value(propertyType)
|
||||
porosityModelEnum = Case_pb2.PorosityModelType.Value(porosityModel)
|
||||
property_type_enum = Properties_pb2.PropertyType.Value(property_type)
|
||||
porosity_model_enum = Case_pb2.PorosityModelType.Value(porosity_model)
|
||||
request = Properties_pb2.PropertyRequest(case_request = self.case.request,
|
||||
property_type = propertyTypeEnum,
|
||||
property_name = propertyName,
|
||||
time_step = timeStep,
|
||||
property_type = property_type_enum,
|
||||
property_name = property_name,
|
||||
time_step = time_step,
|
||||
grid_index = gridIndex,
|
||||
porosity_model = porosityModelEnum)
|
||||
porosity_model = porosity_model_enum)
|
||||
for chunk in self.propertiesStub.GetGridProperty(request):
|
||||
yield chunk
|
||||
|
||||
def gridProperty(self, propertyType, propertyName, timeStep, gridIndex = 0, porosityModel = 'MATRIX_MODEL'):
|
||||
def grid_property(self, property_type, property_name, time_step, grid_index = 0, porosity_model = 'MATRIX_MODEL'):
|
||||
"""Get a cell property for all grid cells. Synchronous, so returns a list
|
||||
|
||||
Arguments:
|
||||
propertyType(str): string enum. See available()
|
||||
propertyName(str): name of an Eclipse property
|
||||
timeStep(int): the time step for which to get the property for
|
||||
gridIndex(int): index to the grid we're getting values for
|
||||
porosityModel(str): string enum. See available()
|
||||
property_type(str): string enum. See available()
|
||||
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. See available()
|
||||
|
||||
Returns:
|
||||
A list of double values
|
||||
"""
|
||||
allValues = []
|
||||
generator = self.gridPropertyAsync(propertyType, propertyName, timeStep, gridIndex, porosityModel)
|
||||
all_values = []
|
||||
generator = self.grid_property_async(property_type, property_name, time_step, grid_index, porosity_model)
|
||||
for chunk in generator:
|
||||
for value in chunk.values:
|
||||
allValues.append(value)
|
||||
return allValues
|
||||
all_values.append(value)
|
||||
return all_values
|
||||
|
||||
def setActiveCellPropertyAsync(self, values_iterator, propertyType, propertyName, timeStep, porosityModel = 'MATRIX_MODEL'):
|
||||
def set_active_cell_property_async(self, values_iterator, property_type, property_name, time_step, porosity_model = 'MATRIX_MODEL'):
|
||||
"""Set a cell property for all active cells. Async, and so takes an iterator to the input values
|
||||
|
||||
Arguments:
|
||||
values_iterator(iterator): an iterator to the properties to be set
|
||||
propertyType(str): string enum. See available()
|
||||
propertyName(str): name of an Eclipse property
|
||||
timeStep(int): the time step for which to get the property for
|
||||
porosityModel(str): string enum. See available()
|
||||
property_type(str): string enum. See available()
|
||||
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()
|
||||
"""
|
||||
propertyTypeEnum = Properties_pb2.PropertyType.Value(propertyType)
|
||||
porosityModelEnum = Case_pb2.PorosityModelType.Value(porosityModel)
|
||||
property_type_enum = Properties_pb2.PropertyType.Value(property_type)
|
||||
porosity_model_enum = Case_pb2.PorosityModelType.Value(porosity_model)
|
||||
request = Properties_pb2.PropertyRequest(case_request = self.case.request,
|
||||
property_type = propertyTypeEnum,
|
||||
property_name = propertyName,
|
||||
time_step = timeStep,
|
||||
porosity_model = porosityModelEnum)
|
||||
property_type = property_type_enum,
|
||||
property_name = property_name,
|
||||
time_step = time_step,
|
||||
porosity_model = porosity_model_enum)
|
||||
|
||||
request_iterator = self.__generatePropertyInputIterator(values_iterator, request)
|
||||
request_iterator = self.__generate_property_input_iterator(values_iterator, request)
|
||||
self.propertiesStub.SetActiveCellProperty(request_iterator)
|
||||
|
||||
def setActiveCellProperty(self, values, propertyType, propertyName, timeStep, porosityModel = 'MATRIX_MODEL'):
|
||||
def set_active_cell_property(self, values, property_type, property_name, time_step, porosity_model = 'MATRIX_MODEL'):
|
||||
"""Set a cell property for all active cells.
|
||||
|
||||
Arguments:
|
||||
values(list): a list of double precision floating point numbers
|
||||
propertyType(str): string enum. See available()
|
||||
propertyName(str): name of an Eclipse property
|
||||
timeStep(int): the time step for which to get the property for
|
||||
porosityModel(str): string enum. See available()
|
||||
property_type(str): string enum. See available()
|
||||
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()
|
||||
"""
|
||||
propertyTypeEnum = Properties_pb2.PropertyType.Value(propertyType)
|
||||
porosityModelEnum = Case_pb2.PorosityModelType.Value(porosityModel)
|
||||
property_type_enum = Properties_pb2.PropertyType.Value(property_type)
|
||||
porosity_model_enum = Case_pb2.PorosityModelType.Value(porosity_model)
|
||||
request = Properties_pb2.PropertyRequest(case_request = self.case.request,
|
||||
property_type = propertyTypeEnum,
|
||||
property_name = propertyName,
|
||||
time_step = timeStep,
|
||||
porosity_model = porosityModelEnum)
|
||||
request_iterator = self.__generatePropertyInputChunks(values, request)
|
||||
property_type = property_type_enum,
|
||||
property_name = property_name,
|
||||
time_step = time_step,
|
||||
porosity_model = porosity_model_enum)
|
||||
request_iterator = self.__generate_property_input_chunks(values, request)
|
||||
reply = self.propertiesStub.SetActiveCellProperty(request_iterator)
|
||||
if reply.accepted_value_count < len(values):
|
||||
raise IndexError
|
||||
|
||||
def setGridProperty(self, values, propertyType, propertyName, timeStep, gridIndex = 0, porosityModel = 'MATRIX_MODEL'):
|
||||
def set_grid_property(self, values, property_type, property_name, time_step, grid_index = 0, porosity_model = 'MATRIX_MODEL'):
|
||||
"""Set a cell property for all grid cells.
|
||||
|
||||
Arguments:
|
||||
values(list): a list of double precision floating point numbers
|
||||
propertyType(str): string enum. See available()
|
||||
propertyName(str): name of an Eclipse property
|
||||
timeStep(int): the time step for which to get the property for
|
||||
gridIndex(int): index to the grid we're setting values for
|
||||
porosityModel(str): string enum. See available()
|
||||
property_type(str): string enum. See available()
|
||||
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. See available()
|
||||
"""
|
||||
propertyTypeEnum = Properties_pb2.PropertyType.Value(propertyType)
|
||||
porosityModelEnum = Case_pb2.PorosityModelType.Value(porosityModel)
|
||||
property_type_enum = Properties_pb2.PropertyType.Value(property_type)
|
||||
porosity_model_enum = Case_pb2.PorosityModelType.Value(porosity_model)
|
||||
request = Properties_pb2.PropertyRequest(case_request = self.case.request,
|
||||
property_type = propertyTypeEnum,
|
||||
property_name = propertyName,
|
||||
time_step = timeStep,
|
||||
grid_index = gridIndex,
|
||||
porosity_model = porosityModelEnum)
|
||||
request_iterator = self.__generatePropertyInputChunks(values, request)
|
||||
property_type = property_type_enum,
|
||||
property_name = property_name,
|
||||
time_step = time_step,
|
||||
grid_index = grid_index,
|
||||
porosity_model = porosity_model_enum)
|
||||
request_iterator = self.__generate_property_input_chunks(values, request)
|
||||
reply = self.propertiesStub.SetGridProperty(request_iterator)
|
||||
if reply.accepted_value_count < len(values):
|
||||
raise IndexError
|
||||
|
||||
@@ -18,12 +18,12 @@ except grpc.RpcError as e:
|
||||
|
||||
case = resinsight.project.case(id=0)
|
||||
if case is not None:
|
||||
results = case.properties.activeCellProperty('STATIC_NATIVE', 'PORO', 0)
|
||||
results = case.properties.active_cell_property('STATIC_NATIVE', 'PORO', 0)
|
||||
activeCellCount = len(results)
|
||||
|
||||
# Send the results back to ResInsight inside try / except construct
|
||||
try:
|
||||
case.properties.setActiveCellProperty(results, 'GENERATED', 'POROAPPENDED', 0)
|
||||
case.properties.set_active_cell_property(results, 'GENERATED', 'POROAPPENDED', 0)
|
||||
print("Everything went well as expected")
|
||||
except: # Match any exception, but it should not happen
|
||||
print("Ooops!")
|
||||
@@ -33,7 +33,7 @@ if case is not None:
|
||||
|
||||
# This time we should get a grpc.RpcError exception, which is a server side error.
|
||||
try:
|
||||
case.properties.setActiveCellProperty(results, 'GENERATED', 'POROAPPENDED', 0)
|
||||
case.properties.set_active_cell_property(results, 'GENERATED', 'POROAPPENDED', 0)
|
||||
print("Everything went well??")
|
||||
except grpc.RpcError as e:
|
||||
print("Expected Server Exception Received: ", e)
|
||||
@@ -46,7 +46,7 @@ if case is not None:
|
||||
case.properties.chunkSize = activeCellCount
|
||||
|
||||
try:
|
||||
case.properties.setActiveCellProperty(results, 'GENERATED', 'POROAPPENDED', 0)
|
||||
case.properties.set_active_cell_property(results, 'GENERATED', 'POROAPPENDED', 0)
|
||||
print("Everything went well??")
|
||||
except grpc.RpcError as e:
|
||||
print("Got unexpected server exception", e, "This should not happen now")
|
||||
|
||||
@@ -22,14 +22,14 @@ start = time.time()
|
||||
case = resinsight.project.case(id=0)
|
||||
|
||||
# Get a generator for the poro results. The generator will provide a chunk each time it is iterated
|
||||
poroChunks = case.properties.activeCellPropertyAsync('STATIC_NATIVE', 'PORO', 0)
|
||||
poroChunks = case.properties.active_cell_property_async('STATIC_NATIVE', 'PORO', 0)
|
||||
# Get a generator for the permx results. The generator will provide a chunk each time it is iterated
|
||||
permxChunks = case.properties.activeCellPropertyAsync('STATIC_NATIVE', 'PERMX', 0)
|
||||
permxChunks = case.properties.active_cell_property_async('STATIC_NATIVE', 'PERMX', 0)
|
||||
|
||||
# Send back the result with the result provided by a generator object.
|
||||
# Iterating the result generator will cause the script to read from the poro and permx generators
|
||||
# And return the result of each iteration
|
||||
case.properties.setActiveCellPropertyAsync(createResult(poroChunks, permxChunks),
|
||||
case.properties.set_active_cell_property_async(createResult(poroChunks, permxChunks),
|
||||
'GENERATED', 'POROPERMXAS', 0)
|
||||
|
||||
end = time.time()
|
||||
|
||||
@@ -12,9 +12,9 @@ start = time.time()
|
||||
case = resinsight.project.case(id=0)
|
||||
|
||||
# Read poro result into list
|
||||
poroResults = case.properties.activeCellProperty('STATIC_NATIVE', 'PORO', 0)
|
||||
poroResults = case.properties.active_cell_property('STATIC_NATIVE', 'PORO', 0)
|
||||
# Read permx result into list
|
||||
permxResults = case.properties.activeCellProperty('STATIC_NATIVE', 'PERMX', 0)
|
||||
permxResults = case.properties.active_cell_property('STATIC_NATIVE', 'PERMX', 0)
|
||||
|
||||
# Generate output result
|
||||
results = []
|
||||
@@ -23,7 +23,7 @@ for (poro, permx) in zip(poroResults, permxResults):
|
||||
|
||||
try:
|
||||
# Send back output result
|
||||
case.properties.setActiveCellProperty(results, 'GENERATED', 'POROPERMXSY', 0)
|
||||
case.properties.set_active_cell_property(results, 'GENERATED', 'POROPERMXSY', 0)
|
||||
except grpc.RpcError as e:
|
||||
print("Exception Received: ", e)
|
||||
|
||||
|
||||
@@ -13,5 +13,5 @@ for i in range(0, totalCellCount):
|
||||
values.append(i % 2 * 0.75);
|
||||
|
||||
print("Applying values to full grid")
|
||||
case.properties.setGridProperty(values, 'DYNAMIC_NATIVE', 'SOIL', 0)
|
||||
case.properties.set_grid_property(values, 'DYNAMIC_NATIVE', 'SOIL', 0)
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ averages = []
|
||||
for i in range(0, len(timeSteps)):
|
||||
# Get the results from time step i asynchronously
|
||||
# It actually returns a generator object almost immediately
|
||||
resultChunks = case.properties.activeCellPropertyAsync('DYNAMIC_NATIVE', 'SOIL', i)
|
||||
resultChunks = case.properties.active_cell_property_async('DYNAMIC_NATIVE', 'SOIL', i)
|
||||
mysum = 0.0
|
||||
count = 0
|
||||
# Loop through and append the average. each time we loop resultChunks
|
||||
|
||||
@@ -19,7 +19,7 @@ timeSteps = case.time_steps()
|
||||
averages = []
|
||||
for i in range(0, len(timeSteps)):
|
||||
# Get a list of all the results for time step i
|
||||
results = case.properties.activeCellProperty('DYNAMIC_NATIVE', 'SOIL', i)
|
||||
results = case.properties.active_cell_property('DYNAMIC_NATIVE', 'SOIL', i)
|
||||
mysum = sum(results)
|
||||
averages.append(mysum/len(results))
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ case = resinsight.project.case(id=0)
|
||||
timeStepInfo = case.time_steps()
|
||||
|
||||
# Get a generator for the porv results. The generator will provide a chunk each time it is iterated
|
||||
porvChunks = case.properties.activeCellPropertyAsync('STATIC_NATIVE', 'PORV', 0)
|
||||
porvChunks = case.properties.active_cell_property_async('STATIC_NATIVE', 'PORV', 0)
|
||||
|
||||
# Read the static result into an array, so we don't have to transfer it for each iteration
|
||||
# Note we use the async method even if we synchronise here, because we need the values chunked
|
||||
@@ -33,11 +33,11 @@ for porvChunk in porvChunks:
|
||||
|
||||
for i in range (0, len(timeStepInfo)):
|
||||
# Get a generator object for the SOIL property for time step i
|
||||
soilChunks = case.properties.activeCellPropertyAsync('DYNAMIC_NATIVE', 'SOIL', i)
|
||||
soilChunks = case.properties.active_cell_property_async('DYNAMIC_NATIVE', 'SOIL', i)
|
||||
# Create the generator object for the SOIL * PORV derived result
|
||||
result_generator = createResult(soilChunks, iter(porvArray))
|
||||
# Send back the result asynchronously with a generator object
|
||||
case.properties.setActiveCellPropertyAsync(result_generator, 'GENERATED', 'SOILPORVAsync', i)
|
||||
case.properties.set_active_cell_property_async(result_generator, 'GENERATED', 'SOILPORVAsync', i)
|
||||
|
||||
end = time.time()
|
||||
print("Time elapsed: ", end - start)
|
||||
|
||||
@@ -10,12 +10,12 @@ start = time.time()
|
||||
case = resinsight.project.case(id=0)
|
||||
|
||||
# Read the full porv result
|
||||
porvResults = case.properties.activeCellProperty('STATIC_NATIVE', 'PORV', 0)
|
||||
porvResults = case.properties.active_cell_property('STATIC_NATIVE', 'PORV', 0)
|
||||
timeStepInfo = case.time_steps()
|
||||
|
||||
for i in range (0, len(timeStepInfo)):
|
||||
# Read the full SOIl result for time step i
|
||||
soilResults = case.properties.activeCellProperty('DYNAMIC_NATIVE', 'SOIL', i)
|
||||
soilResults = case.properties.active_cell_property('DYNAMIC_NATIVE', 'SOIL', i)
|
||||
|
||||
# Generate the result by looping through both lists in order
|
||||
results = []
|
||||
@@ -23,7 +23,7 @@ for i in range (0, len(timeStepInfo)):
|
||||
results.append(soil * porv)
|
||||
|
||||
# Send back result
|
||||
case.properties.setActiveCellProperty(results, 'GENERATED', 'SOILPORVSync', i)
|
||||
case.properties.set_active_cell_property(results, 'GENERATED', 'SOILPORVSync', i)
|
||||
|
||||
end = time.time()
|
||||
print("Time elapsed: ", end - start)
|
||||
|
||||
@@ -12,7 +12,7 @@ def test_10kAsync(rips_instance, initialize_test):
|
||||
casePath = dataroot.PATH + "/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID"
|
||||
case = rips_instance.project.load_case(path=casePath)
|
||||
|
||||
resultChunks = case.properties.activeCellPropertyAsync('DYNAMIC_NATIVE', 'SOIL', 1)
|
||||
resultChunks = case.properties.active_cell_property_async('DYNAMIC_NATIVE', 'SOIL', 1)
|
||||
mysum = 0.0
|
||||
count = 0
|
||||
for chunk in resultChunks:
|
||||
@@ -27,7 +27,7 @@ def test_10kSync(rips_instance, initialize_test):
|
||||
casePath = dataroot.PATH + "/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID"
|
||||
case = rips_instance.project.load_case(path=casePath)
|
||||
|
||||
results = case.properties.activeCellProperty('DYNAMIC_NATIVE', 'SOIL', 1)
|
||||
results = case.properties.active_cell_property('DYNAMIC_NATIVE', 'SOIL', 1)
|
||||
mysum = sum(results)
|
||||
average = mysum / len(results)
|
||||
assert(mysum == pytest.approx(621.768, abs=0.001))
|
||||
@@ -38,27 +38,27 @@ def test_10k_set(rips_instance, initialize_test):
|
||||
casePath = dataroot.PATH + "/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID"
|
||||
case = rips_instance.project.load_case(path=casePath)
|
||||
|
||||
results = case.properties.activeCellProperty('DYNAMIC_NATIVE', 'SOIL', 1)
|
||||
case.properties.setActiveCellProperty(results, 'GENERATED', 'SOIL', 1)
|
||||
results = case.properties.active_cell_property('DYNAMIC_NATIVE', 'SOIL', 1)
|
||||
case.properties.set_active_cell_property(results, 'GENERATED', 'SOIL', 1)
|
||||
|
||||
def test_10k_set_out_of_bounds(rips_instance, initialize_test):
|
||||
casePath = dataroot.PATH + "/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID"
|
||||
case = rips_instance.project.load_case(path=casePath)
|
||||
|
||||
results = case.properties.activeCellProperty('DYNAMIC_NATIVE', 'SOIL', 1)
|
||||
results = case.properties.active_cell_property('DYNAMIC_NATIVE', 'SOIL', 1)
|
||||
results.append(5.0)
|
||||
with pytest.raises(grpc.RpcError):
|
||||
assert case.properties.setActiveCellProperty(results, 'GENERATED', 'SOIL', 1)
|
||||
assert case.properties.set_active_cell_property(results, 'GENERATED', 'SOIL', 1)
|
||||
|
||||
def test_10k_set_out_of_bounds_client(rips_instance, initialize_test):
|
||||
casePath = dataroot.PATH + "/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID"
|
||||
case = rips_instance.project.load_case(path=casePath)
|
||||
|
||||
results = case.properties.activeCellProperty('DYNAMIC_NATIVE', 'SOIL', 1)
|
||||
results = case.properties.active_cell_property('DYNAMIC_NATIVE', 'SOIL', 1)
|
||||
case.properties.chunkSize = len(results)
|
||||
results.append(5.0)
|
||||
with pytest.raises(IndexError):
|
||||
assert case.properties.setActiveCellProperty(results, 'GENERATED', 'SOIL', 1)
|
||||
assert case.properties.set_active_cell_property(results, 'GENERATED', 'SOIL', 1)
|
||||
|
||||
def createResult(poroChunks, permxChunks):
|
||||
for (poroChunk, permxChunk) in zip(poroChunks, permxChunks):
|
||||
@@ -76,14 +76,14 @@ def test_10k_PoroPermX(rips_instance, initialize_test):
|
||||
casePath = dataroot.PATH + "/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID"
|
||||
case = rips_instance.project.load_case(path=casePath)
|
||||
|
||||
poroChunks = case.properties.activeCellPropertyAsync('STATIC_NATIVE', 'PORO', 0)
|
||||
permxChunks = case.properties.activeCellPropertyAsync('STATIC_NATIVE', 'PERMX', 0)
|
||||
poroChunks = case.properties.active_cell_property_async('STATIC_NATIVE', 'PORO', 0)
|
||||
permxChunks = case.properties.active_cell_property_async('STATIC_NATIVE', 'PERMX', 0)
|
||||
|
||||
case.properties.setActiveCellPropertyAsync(createResult(poroChunks, permxChunks), 'GENERATED', 'POROPERMXAS', 0)
|
||||
case.properties.set_active_cell_property_async(createResult(poroChunks, permxChunks), 'GENERATED', 'POROPERMXAS', 0)
|
||||
|
||||
poro = case.properties.activeCellProperty('STATIC_NATIVE', 'PORO', 0)
|
||||
permx = case.properties.activeCellProperty('STATIC_NATIVE', 'PERMX', 0)
|
||||
poroPermX = case.properties.activeCellProperty('GENERATED', 'POROPERMXAS', 0)
|
||||
poro = case.properties.active_cell_property('STATIC_NATIVE', 'PORO', 0)
|
||||
permx = case.properties.active_cell_property('STATIC_NATIVE', 'PERMX', 0)
|
||||
poroPermX = case.properties.active_cell_property('GENERATED', 'POROPERMXAS', 0)
|
||||
|
||||
checkResults(poro, permx, poroPermX)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user