Python code linting changes detected by black

This commit is contained in:
jonjenssen
2023-02-01 07:46:46 +00:00
committed by Magne Sjaastad
parent 33e908dd94
commit 21ccd733a8
17 changed files with 22 additions and 26 deletions

View File

@@ -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(

View File

@@ -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,

View File

@@ -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

View File

@@ -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)

View File

@@ -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
)

View File

@@ -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(

View File

@@ -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

View File

@@ -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:

View File

@@ -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

View File

@@ -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

View File

@@ -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