Skip to content

Commit

Permalink
Merge pull request #22 from daavid00/deb
Browse files Browse the repository at this point in the history
Improving faults and wells maps
  • Loading branch information
daavid00 authored Oct 14, 2024
2 parents 6e2bdaa + 334488d commit 87acc3f
Show file tree
Hide file tree
Showing 12 changed files with 258 additions and 100 deletions.
Binary file modified docs/_images/norne_faults.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/norne_wells.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 12 additions & 3 deletions docs/_sources/examples.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,24 @@ In order to reduce the white space outside the active cells, as well as to rotat
.. image:: ./figs/norne_transformed.png

To show the faults on the top layer and the ones connected all along the z direction, this can be achieved by:
To show all faults in the model and to only show the ones connected all along the z direction, this can be achieved by:

.. code-block:: bash
plopm -i NORNE_ATW2013 -v faults -s ,,1 -rotate 65 -translate '[6456835.5,-3474500]' -x '[0,6200]' -y '[0,13000]'
plopm -i NORNE_ATW2013 -v faults -s ,,1:22 -rotate 65 -translate '[6456835.5,-3474500]' -x '[0,6200]' -y '[0,13000]'
plopm -i NORNE_ATW2013 -v faults -s ,,1 -rotate 65 -translate '[6456335.5,-3476500]' -x '[0,5600]' -y '[0,8800]' -f 8 -global 1
plopm -i NORNE_ATW2013 -v faults -s ,,1:22 -rotate 65 -translate '[6456335.5,-3476500]' -x '[0,5600]' -y '[0,8800]' -f 8
.. image:: ./figs/norne_faults.png

To show all wells in the model and to only show the ones with at least one perforation on the top layer, this can be achieved by:

.. code-block:: bash
plopm -i NORNE_ATW2013 -v wells -s ,,1 -rotate 65 -translate '[6456335.5,-3476500]' -x '[0,5600]' -y '[0,8800]' -f 8 -global 1
plopm -i NORNE_ATW2013 -v wells -s ,,1 -rotate 65 -translate '[6456335.5,-3476500]' -x '[0,5600]' -y '[0,8800]' -f 8
.. image:: ./figs/norne_wells.png

.. note::

For plotting the faults and wells, they must be specified in the input deck (no via include files).
Expand Down
12 changes: 9 additions & 3 deletions docs/examples.html
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,18 @@ <h2>Rotation, translation, and zoom<a class="headerlink" href="#rotation-transla
</pre></div>
</div>
<img alt="_images/norne_transformed.png" src="_images/norne_transformed.png" />
<p>To show the faults on the top layer and the ones connected all along the z direction, this can be achieved by:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>plopm<span class="w"> </span>-i<span class="w"> </span>NORNE_ATW2013<span class="w"> </span>-v<span class="w"> </span>faults<span class="w"> </span>-s<span class="w"> </span>,,1<span class="w"> </span>-rotate<span class="w"> </span><span class="m">65</span><span class="w"> </span>-translate<span class="w"> </span><span class="s1">&#39;[6456835.5,-3474500]&#39;</span><span class="w"> </span>-x<span class="w"> </span><span class="s1">&#39;[0,6200]&#39;</span><span class="w"> </span>-y<span class="w"> </span><span class="s1">&#39;[0,13000]&#39;</span>
plopm<span class="w"> </span>-i<span class="w"> </span>NORNE_ATW2013<span class="w"> </span>-v<span class="w"> </span>faults<span class="w"> </span>-s<span class="w"> </span>,,1:22<span class="w"> </span>-rotate<span class="w"> </span><span class="m">65</span><span class="w"> </span>-translate<span class="w"> </span><span class="s1">&#39;[6456835.5,-3474500]&#39;</span><span class="w"> </span>-x<span class="w"> </span><span class="s1">&#39;[0,6200]&#39;</span><span class="w"> </span>-y<span class="w"> </span><span class="s1">&#39;[0,13000]&#39;</span>
<p>To show all faults in the model and to only show the ones connected all along the z direction, this can be achieved by:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>plopm<span class="w"> </span>-i<span class="w"> </span>NORNE_ATW2013<span class="w"> </span>-v<span class="w"> </span>faults<span class="w"> </span>-s<span class="w"> </span>,,1<span class="w"> </span>-rotate<span class="w"> </span><span class="m">65</span><span class="w"> </span>-translate<span class="w"> </span><span class="s1">&#39;[6456335.5,-3476500]&#39;</span><span class="w"> </span>-x<span class="w"> </span><span class="s1">&#39;[0,5600]&#39;</span><span class="w"> </span>-y<span class="w"> </span><span class="s1">&#39;[0,8800]&#39;</span><span class="w"> </span>-f<span class="w"> </span><span class="m">8</span><span class="w"> </span>-global<span class="w"> </span><span class="m">1</span>
plopm<span class="w"> </span>-i<span class="w"> </span>NORNE_ATW2013<span class="w"> </span>-v<span class="w"> </span>faults<span class="w"> </span>-s<span class="w"> </span>,,1:22<span class="w"> </span>-rotate<span class="w"> </span><span class="m">65</span><span class="w"> </span>-translate<span class="w"> </span><span class="s1">&#39;[6456335.5,-3476500]&#39;</span><span class="w"> </span>-x<span class="w"> </span><span class="s1">&#39;[0,5600]&#39;</span><span class="w"> </span>-y<span class="w"> </span><span class="s1">&#39;[0,8800]&#39;</span><span class="w"> </span>-f<span class="w"> </span><span class="m">8</span>
</pre></div>
</div>
<img alt="_images/norne_faults.png" src="_images/norne_faults.png" />
<p>To show all wells in the model and to only show the ones with at least one perforation on the top layer, this can be achieved by:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>plopm<span class="w"> </span>-i<span class="w"> </span>NORNE_ATW2013<span class="w"> </span>-v<span class="w"> </span>wells<span class="w"> </span>-s<span class="w"> </span>,,1<span class="w"> </span>-rotate<span class="w"> </span><span class="m">65</span><span class="w"> </span>-translate<span class="w"> </span><span class="s1">&#39;[6456335.5,-3476500]&#39;</span><span class="w"> </span>-x<span class="w"> </span><span class="s1">&#39;[0,5600]&#39;</span><span class="w"> </span>-y<span class="w"> </span><span class="s1">&#39;[0,8800]&#39;</span><span class="w"> </span>-f<span class="w"> </span><span class="m">8</span><span class="w"> </span>-global<span class="w"> </span><span class="m">1</span>
plopm<span class="w"> </span>-i<span class="w"> </span>NORNE_ATW2013<span class="w"> </span>-v<span class="w"> </span>wells<span class="w"> </span>-s<span class="w"> </span>,,1<span class="w"> </span>-rotate<span class="w"> </span><span class="m">65</span><span class="w"> </span>-translate<span class="w"> </span><span class="s1">&#39;[6456335.5,-3476500]&#39;</span><span class="w"> </span>-x<span class="w"> </span><span class="s1">&#39;[0,5600]&#39;</span><span class="w"> </span>-y<span class="w"> </span><span class="s1">&#39;[0,8800]&#39;</span><span class="w"> </span>-f<span class="w"> </span><span class="m">8</span>
</pre></div>
</div>
<img alt="_images/norne_wells.png" src="_images/norne_wells.png" />
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>For plotting the faults and wells, they must be specified in the input deck (no via include files).</p>
Expand Down
2 changes: 1 addition & 1 deletion docs/searchindex.js

Large diffs are not rendered by default.

15 changes: 12 additions & 3 deletions docs/text/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,24 @@ In order to reduce the white space outside the active cells, as well as to rotat
.. image:: ./figs/norne_transformed.png

To show the faults on the top layer and the ones connected all along the z direction, this can be achieved by:
To show all faults in the model and to only show the ones connected all along the z direction, this can be achieved by:

.. code-block:: bash
plopm -i NORNE_ATW2013 -v faults -s ,,1 -rotate 65 -translate '[6456835.5,-3474500]' -x '[0,6200]' -y '[0,13000]'
plopm -i NORNE_ATW2013 -v faults -s ,,1:22 -rotate 65 -translate '[6456835.5,-3474500]' -x '[0,6200]' -y '[0,13000]'
plopm -i NORNE_ATW2013 -v faults -s ,,1 -rotate 65 -translate '[6456335.5,-3476500]' -x '[0,5600]' -y '[0,8800]' -f 8 -global 1
plopm -i NORNE_ATW2013 -v faults -s ,,1:22 -rotate 65 -translate '[6456335.5,-3476500]' -x '[0,5600]' -y '[0,8800]' -f 8
.. image:: ./figs/norne_faults.png

To show all wells in the model and to only show the ones with at least one perforation on the top layer, this can be achieved by:

.. code-block:: bash
plopm -i NORNE_ATW2013 -v wells -s ,,1 -rotate 65 -translate '[6456335.5,-3476500]' -x '[0,5600]' -y '[0,8800]' -f 8 -global 1
plopm -i NORNE_ATW2013 -v wells -s ,,1 -rotate 65 -translate '[6456335.5,-3476500]' -x '[0,5600]' -y '[0,8800]' -f 8
.. image:: ./figs/norne_wells.png

.. note::

For plotting the faults and wells, they must be specified in the input deck (no via include files).
Expand Down
Binary file modified docs/text/figs/norne_faults.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/text/figs/norne_wells.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion src/plopm/utils/initialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def ini_dic(cmdargs):
dic["translate"] = [var.split(",") for var in dic["translate"]]
dic["restart"] = (cmdargs["restart"].strip()).split(",")
dic["cbsfax"] = [float(val) for val in (cmdargs["cbsfax"].strip()).split(",")]
dic["nwells"], dic["lwells"] = 0, []
for i in ["x", "y"]:
dic[f"{i}units"] = cmdargs[f"{i}units"].strip()
dic[f"{i}label"] = (cmdargs[f"{i}label"].strip()).split(" ")
Expand Down Expand Up @@ -395,7 +396,9 @@ def ini_properties(dic):
elif dic["mask"]:
dic["cmaps"] = ["RdGy_r"]
if dic["vrs"]:
if dic["vrs"][0] == "wells" or dic["vrs"][0] == "faults" and not dic["colors"]:
if (dic["vrs"][0] == "wells" or dic["vrs"][0] == "faults") and not dic[
"colors"
]:
dic["units"] = [" [-]"]
dic["cmaps"] = ["nipy_spectral"]
dic["cformat"] = [".0f"]
Expand Down
115 changes: 92 additions & 23 deletions src/plopm/utils/mapping.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-FileCopyrightText: 2024 NORCE
# SPDX-License-Identifier: GPL-3.0
# pylint: disable=R1702,R0912,C0325
# pylint: disable=R1702,R0912,C0325,R0914

"""
Utiliy function for the grid and locations in the geological models.
Expand Down Expand Up @@ -148,7 +148,7 @@ def map_xzcoords(dic, var, quan, n):
val = 1
elif var.lower() == "wells":
p_v = 1
val = len(dic["wells"])
val = dic["nwells"]
elif var.lower() == "index_i":
p_v = 1
val = i
Expand All @@ -167,17 +167,40 @@ def map_xzcoords(dic, var, quan, n):
dic[var + "a"][2 * i + 2 * (dic["nz"] - k - 1) * dic["mx"]] = (
np.nan if p_v == 0 else val / p_v
)
for i, well in enumerate(dic["wells"]):
if well:
for k in range(well[2], well[3] + 1):
dic["wellsa"][2 * well[0] + 2 * (dic["nz"] - k - 1) * dic["mx"]] = i
for i, wells in enumerate(dic["wells"]):
for well in wells:
if well:
for k in range(well[2], well[3] + 1):
ind = well[0] + well[1] * dic["nx"] + k * dic["nx"] * dic["ny"]
if dic["global"] == 0:
if dic["porv"][ind] > 0 and well[1] in range(
dic["slide"][n][1][0], dic["slide"][n][1][1]
):
dic["wellsa"][
2 * well[0] + 2 * (dic["nz"] - k - 1) * dic["mx"]
] = i
else:
if dic["porv"][ind] > 0:
dic["wellsa"][
2 * well[0] + 2 * (dic["nz"] - k - 1) * dic["mx"]
] = i
for i, faults in enumerate(dic["faults"]):
for fault in faults:
if fault:
for k in range(fault[2], fault[3] + 1):
dic["faultsa"][
2 * fault[0] + 2 * (dic["nz"] - k - 1) * dic["mx"]
] = (i + 1)
ind = fault[0] + fault[1] * dic["nx"] + k * dic["nx"] * dic["ny"]
if dic["global"] == 0:
if dic["porv"][ind] > 0 and fault[1] in range(
dic["slide"][n][1][0], dic["slide"][n][1][1]
):
dic["faultsa"][
2 * fault[0] + 2 * (dic["nz"] - k - 1) * dic["mx"]
] = (i + 1)
else:
if dic["porv"][ind] > 0:
dic["faultsa"][
2 * fault[0] + 2 * (dic["nz"] - k - 1) * dic["mx"]
] = (i + 1)


def map_yzcoords(dic, var, quan, n):
Expand Down Expand Up @@ -205,7 +228,7 @@ def map_yzcoords(dic, var, quan, n):
val = 1
elif var.lower() == "wells":
p_v = 1
val = len(dic["wells"])
val = dic["nwells"]
elif var.lower() == "index_i":
p_v = 1
val = sld
Expand All @@ -224,17 +247,40 @@ def map_yzcoords(dic, var, quan, n):
dic[var + "a"][2 * j + 2 * (dic["nz"] - k - 1) * dic["mx"]] = (
np.nan if p_v == 0 else val / p_v
)
for i, well in enumerate(dic["wells"]):
if well:
for k in range(well[2], well[3] + 1):
dic["wellsa"][2 * well[1] + 2 * (dic["nz"] - k - 1) * dic["mx"]] = i
for i, wells in enumerate(dic["wells"]):
for well in wells:
if well:
for k in range(well[2], well[3] + 1):
ind = well[0] + well[1] * dic["nx"] + k * dic["nx"] * dic["ny"]
if dic["global"] == 0:
if dic["porv"][ind] > 0 and well[0] in range(
dic["slide"][n][0][0], dic["slide"][n][0][1]
):
dic["wellsa"][
2 * well[1] + 2 * (dic["nz"] - k - 1) * dic["mx"]
] = (i + 1)
else:
if dic["porv"][ind] > 0:
dic["wellsa"][
2 * well[1] + 2 * (dic["nz"] - k - 1) * dic["mx"]
] = (i + 1)
for i, faults in enumerate(dic["faults"]):
for fault in faults:
if fault:
for k in range(fault[2], fault[3] + 1):
dic["faultsa"][
2 * fault[1] + 2 * (dic["nz"] - k - 1) * dic["mx"]
] = (i + 1)
ind = fault[0] + fault[1] * dic["nx"] + k * dic["nx"] * dic["ny"]
if dic["global"] == 0:
if dic["porv"][ind] > 0 and fault[0] in range(
dic["slide"][n][0][0], dic["slide"][n][0][1]
):
dic["faultsa"][
2 * fault[1] + 2 * (dic["nz"] - k - 1) * dic["mx"]
] = (i + 1)
else:
if dic["porv"][ind] > 0:
dic["faultsa"][
2 * fault[1] + 2 * (dic["nz"] - k - 1) * dic["mx"]
] = (i + 1)


def map_xycoords(dic, var, quan, n):
Expand Down Expand Up @@ -262,7 +308,7 @@ def map_xycoords(dic, var, quan, n):
val = 1
elif var.lower() == "wells":
p_v = 1
val = len(dic["wells"])
val = dic["nwells"]
elif var.lower() == "index_i":
p_v = 1
val = i
Expand All @@ -281,10 +327,33 @@ def map_xycoords(dic, var, quan, n):
dic[var + "a"][2 * i + 2 * j * dic["mx"]] = (
np.nan if p_v == 0 else val / p_v
)
for i, well in enumerate(dic["wells"]):
if well:
dic["wellsa"][2 * well[0] + 2 * well[1] * dic["mx"]] = i
for i, wells in enumerate(dic["wells"]):
for _, well in enumerate(wells):
if well:
for k in range(well[2], well[3] + 1):
ind = well[0] + well[1] * dic["nx"] + k * dic["nx"] * dic["ny"]
if dic["global"] == 0:
if dic["porv"][ind] > 0 and k in range(
dic["slide"][n][2][0], dic["slide"][n][2][1]
):
dic["wellsa"][2 * well[0] + 2 * well[1] * dic["mx"]] = i + 1
else:
if dic["porv"][ind] > 0:
dic["wellsa"][2 * well[0] + 2 * well[1] * dic["mx"]] = i + 1
for i, faults in enumerate(dic["faults"]):
for fault in faults:
for _, fault in enumerate(faults):
if fault:
dic["faultsa"][2 * fault[0] + 2 * fault[1] * dic["mx"]] = i + 1
for k in range(fault[2], fault[3] + 1):
ind = fault[0] + fault[1] * dic["nx"] + k * dic["nx"] * dic["ny"]
if dic["global"] == 0:
if dic["porv"][ind] > 0 and k in range(
dic["slide"][n][2][0], dic["slide"][n][2][1]
):
dic["faultsa"][2 * fault[0] + 2 * fault[1] * dic["mx"]] = (
i + 1
)
else:
if dic["porv"][ind] > 0:
dic["faultsa"][2 * fault[0] + 2 * fault[1] * dic["mx"]] = (
i + 1
)
Loading

0 comments on commit 87acc3f

Please sign in to comment.