mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Python code linting changes detected by black
This commit is contained in:
parent
33e908dd94
commit
21ccd733a8
@ -21,7 +21,7 @@ if resinsight is not None:
|
||||
for sim_well in sim_wells:
|
||||
print("Simulation well: " + sim_well.name)
|
||||
|
||||
for (tidx, timestep) in enumerate(timesteps):
|
||||
for tidx, timestep in enumerate(timesteps):
|
||||
status = sim_well.status(tidx)
|
||||
cells = sim_well.cells(tidx)
|
||||
print(
|
||||
|
@ -82,7 +82,6 @@ stim_plan_models = []
|
||||
# Create and export a StimPlan model for each depth
|
||||
measured_depths = [3200.0, 3400.0, 3600.0]
|
||||
for measured_depth in measured_depths:
|
||||
|
||||
# Create stim plan model at a give measured depth
|
||||
stim_plan_model = stim_plan_model_collection.append_stim_plan_model(
|
||||
well_path=well_path,
|
||||
|
@ -29,7 +29,6 @@ def generate_surface_from_file(path):
|
||||
|
||||
|
||||
def export_surface_as_ts_file(surf, point_cloud, properties, path):
|
||||
|
||||
# open text file
|
||||
text_file = open(path, "w")
|
||||
|
||||
@ -93,7 +92,6 @@ temp_folder = tempfile.gettempdir()
|
||||
home_dir = expanduser("~")
|
||||
|
||||
for fracture in fractures:
|
||||
|
||||
fracture_name = fracture.user_description
|
||||
|
||||
# Create the ouput directory
|
||||
|
@ -14,7 +14,7 @@ contour_maps = resInsight.project.descendants(rips.EclipseContourMap)
|
||||
print("Number of eclipse contour maps:", len(contour_maps))
|
||||
|
||||
# Export the contour maps to a text file
|
||||
for (index, contour_map) in enumerate(contour_maps):
|
||||
for index, contour_map in enumerate(contour_maps):
|
||||
filename = "eclipse_contour_map" + str(index) + ".txt"
|
||||
filepath = tmpdir / filename
|
||||
print("Exporting to:", filepath)
|
||||
@ -25,7 +25,7 @@ cases = resInsight.project.cases()
|
||||
for case in cases:
|
||||
contour_maps = case.descendants(rips.GeoMechContourMap)
|
||||
# Export the contour maps to a text file
|
||||
for (index, contour_map) in enumerate(contour_maps):
|
||||
for index, contour_map in enumerate(contour_maps):
|
||||
filename = "geomech_contour_map" + str(index) + ".txt"
|
||||
filepath = tmpdir / filename
|
||||
print("Exporting to:", filepath)
|
||||
|
@ -68,7 +68,7 @@ for path in case_file_paths:
|
||||
well_log_plot = well_log_plot_collection.new_well_log_plot(case, well_path)
|
||||
|
||||
# Create a track for each property
|
||||
for (prop_type, prop_name, time_step) in properties:
|
||||
for prop_type, prop_name, time_step in properties:
|
||||
track = well_log_plot.new_well_log_track(
|
||||
"Track: " + prop_name, case, well_path
|
||||
)
|
||||
|
@ -32,7 +32,6 @@ print("well path:", well_path.name)
|
||||
# Place fracture at given depths
|
||||
measured_depths = [3200.0, 3400.0, 3600.0]
|
||||
for measured_depth in measured_depths:
|
||||
|
||||
print("Placing fracture at {} depth (MD)".format(measured_depth))
|
||||
# Create stim plan at a give measured depth
|
||||
fracture = well_path.add_fracture(
|
||||
|
@ -5,14 +5,15 @@
|
||||
import rips
|
||||
import time
|
||||
|
||||
|
||||
# Internal function for creating a result from a small chunk of poro and permx results
|
||||
# The return value of the function is a generator for the results rather than the result itself.
|
||||
def create_result(poro_chunks, permx_chunks):
|
||||
# Loop through all the chunks of poro and permx in order
|
||||
for (poroChunk, permxChunk) in zip(poro_chunks, permx_chunks):
|
||||
for poroChunk, permxChunk in zip(poro_chunks, permx_chunks):
|
||||
resultChunk = []
|
||||
# Loop through all the values inside the chunks, in order
|
||||
for (poro, permx) in zip(poroChunk.values, permxChunk.values):
|
||||
for poro, permx in zip(poroChunk.values, permxChunk.values):
|
||||
resultChunk.append(poro * permx)
|
||||
# Return a generator object that behaves like a Python iterator
|
||||
yield resultChunk
|
||||
|
@ -18,7 +18,7 @@ permx_results = case.active_cell_property("STATIC_NATIVE", "PERMX", 0)
|
||||
|
||||
# Generate output result
|
||||
results = []
|
||||
for (poro, permx) in zip(poro_results, permx_results):
|
||||
for poro, permx in zip(poro_results, permx_results):
|
||||
results.append(poro * permx)
|
||||
|
||||
try:
|
||||
|
@ -17,7 +17,7 @@ if resinsight is not None:
|
||||
|
||||
time_step_info = case.time_steps()
|
||||
|
||||
for (idx, cell) in enumerate(cells):
|
||||
for idx, cell in enumerate(cells):
|
||||
print(
|
||||
"Selected cell: [{}, {}, {}] grid: {}".format(
|
||||
cell.ijk.i + 1, cell.ijk.j + 1, cell.ijk.k + 1, cell.grid_index
|
||||
@ -56,7 +56,7 @@ if resinsight is not None:
|
||||
print("c6:\n" + str(cell_corners.c6))
|
||||
print("c7:\n" + str(cell_corners.c7))
|
||||
|
||||
for (tidx, timestep) in enumerate(time_step_info):
|
||||
for tidx, timestep in enumerate(time_step_info):
|
||||
# Read the full SOIL result for time step
|
||||
soil_results = case.selected_cell_property(
|
||||
"DYNAMIC_NATIVE", "SOIL", tidx
|
||||
|
@ -5,13 +5,14 @@
|
||||
import rips
|
||||
import time
|
||||
|
||||
|
||||
# Internal function for creating a result from a small chunk of soil and porv results
|
||||
# The return value of the function is a generator for the results rather than the result itself.
|
||||
def create_result(soil_chunks, porv_chunks):
|
||||
for (soil_chunk, porv_chunk) in zip(soil_chunks, porv_chunks):
|
||||
for soil_chunk, porv_chunk in zip(soil_chunks, porv_chunks):
|
||||
resultChunk = []
|
||||
number = 0
|
||||
for (soil_value, porv_value) in zip(soil_chunk.values, porv_chunk.values):
|
||||
for soil_value, porv_value in zip(soil_chunk.values, porv_chunk.values):
|
||||
resultChunk.append(soil_value * porv_value)
|
||||
# Return a Python generator
|
||||
yield resultChunk
|
||||
|
@ -19,7 +19,7 @@ for i in range(0, len(time_step_info)):
|
||||
|
||||
# Generate the result by looping through both lists in order
|
||||
results = []
|
||||
for (soil, porv) in zip(soil_results, porv_results):
|
||||
for soil, porv in zip(soil_results, porv_results):
|
||||
results.append(soil * porv)
|
||||
|
||||
# Send back result
|
||||
|
@ -14,12 +14,10 @@ class RetryOnRpcErrorClientInterceptor(
|
||||
self.status_for_retry = status_for_retry
|
||||
|
||||
def _intercept_call(self, continuation, client_call_details, request_or_iterator):
|
||||
|
||||
for retry_num in range(self.retry_policy.num_retries()):
|
||||
response = continuation(client_call_details, request_or_iterator)
|
||||
|
||||
if isinstance(response, grpc.RpcError):
|
||||
|
||||
# Return if it was last attempt
|
||||
if retry_num == (self.retry_policy.num_retries() - 1):
|
||||
return response
|
||||
|
@ -67,7 +67,7 @@ def test_MultipleCases(rips_instance, initialize_test):
|
||||
|
||||
|
||||
def get_cell_index_with_ijk(cell_info, i, j, k):
|
||||
for (idx, cell) in enumerate(cell_info):
|
||||
for idx, cell in enumerate(cell_info):
|
||||
if cell.local_ijk.i == i and cell.local_ijk.j == j and cell.local_ijk.k == k:
|
||||
return idx
|
||||
return -1
|
||||
@ -216,7 +216,7 @@ def test_selected_cells(rips_instance, initialize_test):
|
||||
assert len(selected_cells) == 0
|
||||
|
||||
time_step_info = case.time_steps()
|
||||
for (tidx, timestep) in enumerate(time_step_info):
|
||||
for tidx, timestep in enumerate(time_step_info):
|
||||
# Try to read for SOIL the time step (will be empty since nothing is selected)
|
||||
soil_results = case.selected_cell_property("DYNAMIC_NATIVE", "SOIL", tidx)
|
||||
assert len(soil_results) == 0
|
||||
|
@ -41,7 +41,7 @@ def test_10kSync(rips_instance, initialize_test):
|
||||
|
||||
# Generate some data
|
||||
new_data = []
|
||||
for (c, _) in enumerate(nnc_connections):
|
||||
for c, _ in enumerate(nnc_connections):
|
||||
new_data.append(float(c))
|
||||
|
||||
property_name = "NEW_PROP"
|
||||
|
@ -68,15 +68,15 @@ def test_10k_set_out_of_bounds_client(rips_instance, initialize_test):
|
||||
|
||||
|
||||
def createResult(poroChunks, permxChunks):
|
||||
for (poroChunk, permxChunk) in zip(poroChunks, permxChunks):
|
||||
for poroChunk, permxChunk in zip(poroChunks, permxChunks):
|
||||
resultChunk = []
|
||||
for (poro, permx) in zip(poroChunk.values, permxChunk.values):
|
||||
for poro, permx in zip(poroChunk.values, permxChunk.values):
|
||||
resultChunk.append(poro * permx)
|
||||
yield resultChunk
|
||||
|
||||
|
||||
def checkResults(poroValues, permxValues, poropermxValues):
|
||||
for (poro, permx, poropermx) in zip(poroValues, permxValues, poropermxValues):
|
||||
for poro, permx, poropermx in zip(poroValues, permxValues, poropermxValues):
|
||||
recalc = poro * permx
|
||||
assert recalc == pytest.approx(poropermx, rel=1.0e-10)
|
||||
|
||||
|
@ -44,7 +44,7 @@ def test_10k(rips_instance, initialize_test):
|
||||
expected_cell_count["GI1"] = 38
|
||||
expected_cell_count["GP2"] = 18
|
||||
for sim_well in sim_wells:
|
||||
for (tidx, timestep) in enumerate(timesteps):
|
||||
for tidx, timestep in enumerate(timesteps):
|
||||
if tidx > 0:
|
||||
cells = sim_well.cells(tidx)
|
||||
print(
|
||||
|
@ -38,7 +38,7 @@ def test_10k_well_log_extraction(rips_instance, initialize_test):
|
||||
well_log_plot = well_log_plot_collection.new_well_log_plot(case, well_path)
|
||||
|
||||
# Create a track for each property
|
||||
for (prop_type, prop_name, time_step) in properties:
|
||||
for prop_type, prop_name, time_step in properties:
|
||||
track = well_log_plot.new_well_log_track("Track: " + prop_name, case, well_path)
|
||||
c = track.add_extraction_curve(case, well_path, prop_type, prop_name, time_step)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user