Skip to content

Commit

Permalink
Merge pull request #23 from daavid00/deb
Browse files Browse the repository at this point in the history
More options for how to show wells/faults
  • Loading branch information
daavid00 authored Nov 4, 2024
2 parents 87acc3f + ed46f2f commit 9a8c8b8
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 14 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ Run `plopm --help` to see all possible command line argument options.
## Getting started
See the [_examples_](https://cssr-tools.github.io/plopm/examples.html) in the [_documentation_](https://cssr-tools.github.io/plopm/introduction.html).

## Citing
If you would like to cite this repository:

* Landa-Marbán, D. 2024. plopm: Quick generation of PNGs, GIFs, and VTKs from a OPM Flow type model. V2024.04. https://doi.org/10.5281/zenodo.13332415.

## About plopm
The _plopm_ package is being funded by the [_HPC Simulation Software for the Gigatonne Storage Challenge project_](https://www.norceresearch.no/en/projects/hpc-simulation-software-for-the-gigatonne-storage-challenge) [project number 622059] and [_Center for Sustainable Subsurface Resources (CSSR)_](https://cssr.no)
[project no. 331841].
Expand Down
1 change: 1 addition & 0 deletions docs/_sources/introduction.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ where
-rotate Grades to rotate the grid in the 2D maps ('0' by default).
-translate Translate the grid in the 2D maps x,y directions ('[0,0]' by default).
-global Min and max in the colorbars from the current 2D slide values (0) or whole 3D model '1' ('0' by default).
-how Show the cells for the wells/faults when at least one cell contains them ('min') or when all cells are part of the given slides range ('max') ('min' by default).
-ncolor Color for the inactive cells in the 2D maps ('w' by default, i.e., white).
-lw Line width separated by commas if more than one ('1' by default).
-subfigs Generate separated or a single Figure (e.g., '2,2' for four subfigures) ('' by default, i.e., separate figures).
Expand Down
3 changes: 3 additions & 0 deletions docs/introduction.html
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ <h2>Concept<a class="headerlink" href="#concept" title="Link to this heading">
<dt><kbd><span class="option">-g<var>lobal</var></span></kbd></dt>
<dd><p>Min and max in the colorbars from the current 2D slide values (0) or whole 3D model ‘1’ (‘0’ by default).</p>
</dd>
<dt><kbd><span class="option">-h<var>ow</var></span></kbd></dt>
<dd><p>Show the cells for the wells/faults when at least one cell contains them (‘min’) or when all cells are part of the given slides range (‘max’) (‘min’ by default).</p>
</dd>
<dt><kbd><span class="option">-n<var>color</var></span></kbd></dt>
<dd><p>Color for the inactive cells in the 2D maps (‘w’ by default, i.e., white).</p>
</dd>
Expand Down
2 changes: 1 addition & 1 deletion docs/searchindex.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/text/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ where
-rotate Grades to rotate the grid in the 2D maps ('0' by default).
-translate Translate the grid in the 2D maps x,y directions ('[0,0]' by default).
-global Min and max in the colorbars from the current 2D slide values (0) or whole 3D model '1' ('0' by default).
-how Show the cells for the wells/faults when at least one cell contains them ('min') or when all cells are part of the given slides range ('max') ('min' by default).
-ncolor Color for the inactive cells in the 2D maps ('w' by default, i.e., white).
-lw Line width separated by commas if more than one ('1' by default).
-subfigs Generate separated or a single Figure (e.g., '2,2' for four subfigures) ('' by default, i.e., separate figures).
Expand Down
8 changes: 8 additions & 0 deletions src/plopm/core/plopm.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,14 @@ def load_parser():
help="Min and max in the colorbars from the current 2D slide values"
" (0) or whole 3D model '1' ('0' by default).",
)
parser.add_argument(
"-how",
"--how",
default="min",
help="Show the cells for the wells/faults when at least one cell contains them "
"('min') or when all cells are part of the given slide/slides range ('max') "
"('min' by default).",
)
parser.add_argument(
"-ncolor",
"--ncolor",
Expand Down
1 change: 1 addition & 0 deletions src/plopm/utils/initialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def ini_dic(cmdargs):
dic["log"] = (cmdargs["log"].strip()).split(",")
dic["rotate"] = (cmdargs["rotate"].strip()).split(",")
dic["global"] = int(cmdargs["global"])
dic["how"] = cmdargs["how"].strip()
dic["save"] = (cmdargs["save"].strip()).split(" ")
dic["translate"] = (cmdargs["translate"]).split(" ")
dic["translate"] = [var.split(",") for var in dic["translate"]]
Expand Down
78 changes: 66 additions & 12 deletions src/plopm/utils/readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,21 +736,48 @@ def get_wells(dic, n):
if dic["slide"][n][0][0] > -1:
for i, wells in enumerate(dic["wells"]):
for j, well in enumerate(wells):
for sld in range(dic["slide"][n][0][0], dic["slide"][n][0][1]):
if well[0] != sld:
if dic["how"] == "min":
count = 0
for sld in range(dic["slide"][n][0][0], dic["slide"][n][0][1]):
if well[0] == sld:
count = 1
break
if count == 0:
dic["wells"][i][j] = []
else:
for sld in range(dic["slide"][n][0][0], dic["slide"][n][0][1]):
if well[0] != sld:
dic["wells"][i][j] = []
elif dic["slide"][n][1][0] > -1:
for i, wells in enumerate(dic["wells"]):
for j, well in enumerate(wells):
for sld in range(dic["slide"][n][1][0], dic["slide"][n][1][1]):
if well[1] != sld:
if dic["how"] == "min":
count = 0
for sld in range(dic["slide"][n][1][0], dic["slide"][n][1][1]):
if well[1] == sld:
count = 1
break
if count == 0:
dic["wells"][i][j] = []
else:
for sld in range(dic["slide"][n][1][0], dic["slide"][n][1][1]):
if well[1] != sld:
dic["wells"][i][j] = []
else:
for i, wells in enumerate(dic["wells"]):
for j, well in enumerate(wells):
for sld in range(dic["slide"][n][2][0], dic["slide"][n][2][1]):
if sld not in range(well[2], well[3] + 1):
if dic["how"] == "min":
count = 0
for sld in range(dic["slide"][n][2][0], dic["slide"][n][2][1]):
if sld in range(well[2], well[3] + 1):
count = 1
break
if count == 0:
dic["wells"][i][j] = []
else:
for sld in range(dic["slide"][n][2][0], dic["slide"][n][2][1]):
if sld not in range(well[2], well[3] + 1):
dic["wells"][i][j] = []


def get_faults(dic, n):
Expand Down Expand Up @@ -800,18 +827,45 @@ def get_faults(dic, n):
if dic["slide"][n][0][0] > -1:
for i, faults in enumerate(dic["faults"]):
for j, fault in enumerate(faults):
for sld in range(dic["slide"][n][0][0], dic["slide"][n][0][1]):
if fault[0] != sld:
if dic["how"] == "min":
count = 0
for sld in range(dic["slide"][n][0][0], dic["slide"][n][0][1]):
if fault[0] == sld:
count = 1
break
if count == 0:
dic["faults"][i][j] = []
else:
for sld in range(dic["slide"][n][0][0], dic["slide"][n][0][1]):
if fault[0] != sld:
dic["faults"][i][j] = []
elif dic["slide"][n][1][0] > -1:
for i, faults in enumerate(dic["faults"]):
for j, fault in enumerate(faults):
for sld in range(dic["slide"][n][1][0], dic["slide"][n][1][1]):
if fault[1] != sld:
if dic["how"] == "min":
count = 0
for sld in range(dic["slide"][n][1][0], dic["slide"][n][1][1]):
if fault[1] == sld:
count = 1
break
if count == 0:
dic["faults"][i][j] = []
else:
for sld in range(dic["slide"][n][1][0], dic["slide"][n][1][1]):
if fault[1] != sld:
dic["faults"][i][j] = []
else:
for i, faults in enumerate(dic["faults"]):
for j, fault in enumerate(faults):
for sld in range(dic["slide"][n][2][0], dic["slide"][n][2][1]):
if sld not in range(fault[2], fault[3] + 1):
if dic["how"] == "min":
count = 0
for sld in range(dic["slide"][n][2][0], dic["slide"][n][2][1]):
if sld in range(fault[2], fault[3] + 1):
count = 1
break
if count == 0:
dic["faults"][i][j] = []
else:
for sld in range(dic["slide"][n][2][0], dic["slide"][n][2][1]):
if sld not in range(fault[2], fault[3] + 1):
dic["faults"][i][j] = []
2 changes: 1 addition & 1 deletion src/plopm/utils/write.py
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ def handle_well_or_grid_or_fault(dic, imag, divider, vect, n, var):
if dic[f"n{var}"] < 70:
for i, wells in enumerate(dic[f"l{var}"]):
well = dic[var][dic[f"l{var}"].index(wells)]
if well[0]:
if any(well):
plt.text(
0,
i + 1,
Expand Down

0 comments on commit 9a8c8b8

Please sign in to comment.