Skip to content

Commit a14fe18

Browse files
authored
Merge pull request #158 from daavid00/dev
Adding check_cmdargs for illegal CLI combinations and making FAIR the docs
2 parents 97b2698 + b3881ba commit a14fe18

18 files changed

Lines changed: 268 additions & 19 deletions

docs/_sources/examples.rst.txt

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,29 @@ The following are some of the figures generated in the compare folder:
5454

5555
The immiscible and isothermal simulations run faster since they have less dof.
5656

57-
The `plopm <https://github.com/cssr-tools/plopm>`_ tool facilitates the visualization of selected results, and can be installed by:
57+
.. note::
5858

59-
.. code-block:: bash
60-
61-
pip install git+https://github.com/cssr-tools/plopm.git
59+
`plopm <https://github.com/cssr-tools/plopm>`_ facilitates the visualization of selected results, and can be installed by:
60+
61+
.. code-block:: bash
62+
63+
pip install git+https://github.com/cssr-tools/plopm.git
6264
63-
For example, the following figures are generated with the commands:
65+
For example, the following figures are generated using `plopm <https://github.com/cssr-tools/plopm>`_ with the commands:
6466

6567
.. code-block:: bash
6668
6769
plopm -i isothermal/flow/ISOTHERMAL -v sgas -t 'Isothermal simulation (end of simulation)'
68-
plopm -i 'immiscible/data/spe11b_time_series convective/data/spe11b_time_series' -csv 1,4 -labels "Immiscible Convective" -tunits y -ylabel 'mobA [kg]' -xformat .0f -x '[0,25]' -xlnum 6 -f 20 -d 10,5 -yformat .1e -e 'solid,solid' -lw 4
70+
plopm -i 'immiscible/data/spe11b_time_series convective/data/spe11b_time_series' -csv 1,4 -labels "Immiscible Convective" -tunits y -ylabel 'mobA [kg]' -xformat .0f -x '[0,25]' -xlnum 6 -f 20 -d 10,5 -yformat .1e -e 'solid,solid' -lw 4 -step 1
6971
7072
.. figure:: figs/plopm_hello_world.png
7173

74+
All previous commands can be executed from the main repository location as (`docs_hello_world.sh <https://github.com/OPM/pyopmspe11/blob/main/tests/scripts/docs_hello_world.sh>`_):
75+
76+
.. code-block:: bash
77+
78+
. ./tests/scripts/docs_hello_world.sh
79+
7280
.. tip::
7381

7482
`This example <https://cssr-tools.github.io/plopm/examples.html#reading-from-csv-files>`_ shows how to use `plopm <https://github.com/cssr-tools/plopm>`_ to
@@ -91,6 +99,12 @@ saving the configuration file as spe11b_11-levels.toml, running them (we add the
9199
92100
.. image:: ./figs/11_levels_dz_i,1,k_t5.png
93101

102+
All previous commands can be executed from the main repository location as (`docs_cp_grids.sh <https://github.com/OPM/pyopmspe11/blob/main/tests/scripts/docs_cp_grids.sh>`_):
103+
104+
.. code-block:: bash
105+
106+
. ./tests/scripts/docs_cp_grids.sh
107+
94108
======================
95109
Localized lower domain
96110
======================
@@ -103,4 +117,10 @@ The flag **-n lower** results in the generation of files for the lower part (low
103117
104118
.. image:: ./figs/lower_domain_pvtnum-1-satnum_i,14,k_t5.png
105119

120+
All previous commands can be executed from the main repository location as (`docs_localized_lower_domain.sh <https://github.com/OPM/pyopmspe11/blob/main/tests/scripts/docs_localized_lower_domain.sh>`_):
121+
122+
.. code-block:: bash
123+
124+
. ./tests/scripts/docs_localized_lower_domain.sh
125+
106126
See the :doc:`convergence <./convergence>` for using the localized domain in the SPE11B corner-point grid case.

docs/examples.html

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,24 +128,31 @@ <h2>Hello world<a class="headerlink" href="#hello-world" title="Link to this hea
128128
<figure class="align-default">
129129
<img alt="_images/spe11b_sparse_data.png" src="_images/spe11b_sparse_data.png" />
130130
</figure>
131-
<figure class="align-default" id="id3">
131+
<figure class="align-default" id="id4">
132132
<img alt="_images/spe11b_performance.png" src="_images/spe11b_performance.png" />
133133
<figcaption>
134-
<p><span class="caption-text">The immiscible and isothermal simulations run faster since they have less dof.</span><a class="headerlink" href="#id3" title="Link to this image"></a></p>
134+
<p><span class="caption-text">The immiscible and isothermal simulations run faster since they have less dof.</span><a class="headerlink" href="#id4" title="Link to this image"></a></p>
135135
</figcaption>
136136
</figure>
137-
<p>The <a class="reference external" href="https://github.com/cssr-tools/plopm">plopm</a> tool facilitates the visualization of selected results, and can be installed by:</p>
137+
<div class="admonition note">
138+
<p class="admonition-title">Note</p>
139+
<p><a class="reference external" href="https://github.com/cssr-tools/plopm">plopm</a> facilitates the visualization of selected results, and can be installed by:</p>
138140
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>pip<span class="w"> </span>install<span class="w"> </span>git+https://github.com/cssr-tools/plopm.git
139141
</pre></div>
140142
</div>
141-
<p>For example, the following figures are generated with the commands:</p>
143+
</div>
144+
<p>For example, the following figures are generated using <a class="reference external" href="https://github.com/cssr-tools/plopm">plopm</a> with the commands:</p>
142145
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>plopm<span class="w"> </span>-i<span class="w"> </span>isothermal/flow/ISOTHERMAL<span class="w"> </span>-v<span class="w"> </span>sgas<span class="w"> </span>-t<span class="w"> </span><span class="s1">&#39;Isothermal simulation (end of simulation)&#39;</span>
143-
plopm<span class="w"> </span>-i<span class="w"> </span><span class="s1">&#39;immiscible/data/spe11b_time_series convective/data/spe11b_time_series&#39;</span><span class="w"> </span>-csv<span class="w"> </span><span class="m">1</span>,4<span class="w"> </span>-labels<span class="w"> </span><span class="s2">&quot;Immiscible Convective&quot;</span><span class="w"> </span>-tunits<span class="w"> </span>y<span class="w"> </span>-ylabel<span class="w"> </span><span class="s1">&#39;mobA [kg]&#39;</span><span class="w"> </span>-xformat<span class="w"> </span>.0f<span class="w"> </span>-x<span class="w"> </span><span class="s1">&#39;[0,25]&#39;</span><span class="w"> </span>-xlnum<span class="w"> </span><span class="m">6</span><span class="w"> </span>-f<span class="w"> </span><span class="m">20</span><span class="w"> </span>-d<span class="w"> </span><span class="m">10</span>,5<span class="w"> </span>-yformat<span class="w"> </span>.1e<span class="w"> </span>-e<span class="w"> </span><span class="s1">&#39;solid,solid&#39;</span><span class="w"> </span>-lw<span class="w"> </span><span class="m">4</span>
146+
plopm<span class="w"> </span>-i<span class="w"> </span><span class="s1">&#39;immiscible/data/spe11b_time_series convective/data/spe11b_time_series&#39;</span><span class="w"> </span>-csv<span class="w"> </span><span class="m">1</span>,4<span class="w"> </span>-labels<span class="w"> </span><span class="s2">&quot;Immiscible Convective&quot;</span><span class="w"> </span>-tunits<span class="w"> </span>y<span class="w"> </span>-ylabel<span class="w"> </span><span class="s1">&#39;mobA [kg]&#39;</span><span class="w"> </span>-xformat<span class="w"> </span>.0f<span class="w"> </span>-x<span class="w"> </span><span class="s1">&#39;[0,25]&#39;</span><span class="w"> </span>-xlnum<span class="w"> </span><span class="m">6</span><span class="w"> </span>-f<span class="w"> </span><span class="m">20</span><span class="w"> </span>-d<span class="w"> </span><span class="m">10</span>,5<span class="w"> </span>-yformat<span class="w"> </span>.1e<span class="w"> </span>-e<span class="w"> </span><span class="s1">&#39;solid,solid&#39;</span><span class="w"> </span>-lw<span class="w"> </span><span class="m">4</span><span class="w"> </span>-step<span class="w"> </span><span class="m">1</span>
144147
</pre></div>
145148
</div>
146149
<figure class="align-default">
147150
<img alt="_images/plopm_hello_world.png" src="_images/plopm_hello_world.png" />
148151
</figure>
152+
<p>All previous commands can be executed from the main repository location as (<a class="reference external" href="https://github.com/OPM/pyopmspe11/blob/main/tests/scripts/docs_hello_world.sh">docs_hello_world.sh</a>):</p>
153+
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>.<span class="w"> </span>./tests/scripts/docs_hello_world.sh
154+
</pre></div>
155+
</div>
149156
<div class="admonition tip">
150157
<p class="admonition-title">Tip</p>
151158
<p><a class="reference external" href="https://cssr-tools.github.io/plopm/examples.html#reading-from-csv-files">This example</a> shows how to use <a class="reference external" href="https://github.com/cssr-tools/plopm">plopm</a> to
@@ -165,6 +172,10 @@ <h2>Cp grids (11 and 18 levels)<a class="headerlink" href="#cp-grids-11-and-18-l
165172
</pre></div>
166173
</div>
167174
<img alt="_images/11_levels_dz_i%2C1%2Ck_t5.png" src="_images/11_levels_dz_i%2C1%2Ck_t5.png" />
175+
<p>All previous commands can be executed from the main repository location as (<a class="reference external" href="https://github.com/OPM/pyopmspe11/blob/main/tests/scripts/docs_cp_grids.sh">docs_cp_grids.sh</a>):</p>
176+
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>.<span class="w"> </span>./tests/scripts/docs_cp_grids.sh
177+
</pre></div>
178+
</div>
168179
</section>
169180
<section id="localized-lower-domain">
170181
<h2>Localized lower domain<a class="headerlink" href="#localized-lower-domain" title="Link to this heading"></a></h2>
@@ -174,6 +185,10 @@ <h2>Localized lower domain<a class="headerlink" href="#localized-lower-domain" t
174185
</pre></div>
175186
</div>
176187
<img alt="_images/lower_domain_pvtnum-1-satnum_i%2C14%2Ck_t5.png" src="_images/lower_domain_pvtnum-1-satnum_i%2C14%2Ck_t5.png" />
188+
<p>All previous commands can be executed from the main repository location as (<a class="reference external" href="https://github.com/OPM/pyopmspe11/blob/main/tests/scripts/docs_localized_lower_domain.sh">docs_localized_lower_domain.sh</a>):</p>
189+
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>.<span class="w"> </span>./tests/scripts/docs_localized_lower_domain.sh
190+
</pre></div>
191+
</div>
177192
<p>See the <a class="reference internal" href="convergence.html"><span class="doc">convergence</span></a> for using the localized domain in the SPE11B corner-point grid case.</p>
178193
</section>
179194
</section>

docs/genindex.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ <h2 id="C">C</h2>
176176
</li>
177177
</ul></li>
178178
<li><a href="pyopmspe11.visualization.plotting.html#pyopmspe11.visualization.plotting.CaseConfig">CaseConfig (class in pyopmspe11.visualization.plotting)</a>
179+
</li>
180+
<li><a href="pyopmspe11.core.pyopmspe11.html#pyopmspe11.core.pyopmspe11.check_cmdargs">check_cmdargs() (in module pyopmspe11.core.pyopmspe11)</a>
179181
</li>
180182
<li><a href="pyopmspe11.utils.inputvalues.html#pyopmspe11.utils.inputvalues.check_deck">check_deck() (in module pyopmspe11.utils.inputvalues)</a>
181183
</li>

docs/objects.inv

8 Bytes
Binary file not shown.

docs/pyopmspe11.core.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Link to this headi
9191
<div class="toctree-wrapper compound">
9292
<ul>
9393
<li class="toctree-l1"><a class="reference internal" href="pyopmspe11.core.pyopmspe11.html">pyopmspe11.core.pyopmspe11 module</a><ul>
94+
<li class="toctree-l2"><a class="reference internal" href="pyopmspe11.core.pyopmspe11.html#pyopmspe11.core.pyopmspe11.check_cmdargs"><code class="docutils literal notranslate"><span class="pre">check_cmdargs()</span></code></a></li>
9495
<li class="toctree-l2"><a class="reference internal" href="pyopmspe11.core.pyopmspe11.html#pyopmspe11.core.pyopmspe11.load_parser"><code class="docutils literal notranslate"><span class="pre">load_parser()</span></code></a></li>
9596
<li class="toctree-l2"><a class="reference internal" href="pyopmspe11.core.pyopmspe11.html#pyopmspe11.core.pyopmspe11.main"><code class="docutils literal notranslate"><span class="pre">main()</span></code></a></li>
9697
<li class="toctree-l2"><a class="reference internal" href="pyopmspe11.core.pyopmspe11.html#pyopmspe11.core.pyopmspe11.make_dir"><code class="docutils literal notranslate"><span class="pre">make_dir()</span></code></a></li>

docs/pyopmspe11.core.pyopmspe11.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,23 @@
8888
<section id="module-pyopmspe11.core.pyopmspe11">
8989
<span id="pyopmspe11-core-pyopmspe11-module"></span><h1>pyopmspe11.core.pyopmspe11 module<a class="headerlink" href="#module-pyopmspe11.core.pyopmspe11" title="Link to this heading"></a></h1>
9090
<p>Main script for pyopmspe11</p>
91+
<dl class="py function">
92+
<dt class="sig sig-object py" id="pyopmspe11.core.pyopmspe11.check_cmdargs">
93+
<span class="sig-prename descclassname"><span class="pre">pyopmspe11.core.pyopmspe11.</span></span><span class="sig-name descname"><span class="pre">check_cmdargs</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cmdargs</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">dict</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#pyopmspe11.core.pyopmspe11.check_cmdargs" title="Link to this definition"></a></dt>
94+
<dd><p>Validate command-line arguments and incompatible operations.</p>
95+
<p>The checks cover configuration and output names, spatial resolution,
96+
reporting times and intervals, comparison mode, and options restricted
97+
to data-generation workflows.</p>
98+
<dl class="field-list simple">
99+
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
100+
<dd class="field-odd"><p><strong>cmdargs</strong> – Parsed arguments returned by <a class="reference internal" href="#pyopmspe11.core.pyopmspe11.load_parser" title="pyopmspe11.core.pyopmspe11.load_parser"><code class="xref py py-func docutils literal notranslate"><span class="pre">load_parser()</span></code></a>.</p>
101+
</dd>
102+
<dt class="field-even">Raises<span class="colon">:</span></dt>
103+
<dd class="field-even"><p><strong>SystemExit</strong> – If an argument is invalid or an incompatible combination is requested.</p>
104+
</dd>
105+
</dl>
106+
</dd></dl>
107+
91108
<dl class="py function">
92109
<dt class="sig sig-object py" id="pyopmspe11.core.pyopmspe11.load_parser">
93110
<span class="sig-prename descclassname"><span class="pre">pyopmspe11.core.pyopmspe11.</span></span><span class="sig-name descname"><span class="pre">load_parser</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">argv</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">dict</span></span></span><a class="headerlink" href="#pyopmspe11.core.pyopmspe11.load_parser" title="Link to this definition"></a></dt>

docs/pyopmspe11.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ <h2>Subpackages<a class="headerlink" href="#subpackages" title="Link to this hea
103103
<li class="toctree-l1"><a class="reference internal" href="pyopmspe11.core.html">pyopmspe11.core package</a><ul>
104104
<li class="toctree-l2"><a class="reference internal" href="pyopmspe11.core.html#submodules">Submodules</a><ul>
105105
<li class="toctree-l3"><a class="reference internal" href="pyopmspe11.core.pyopmspe11.html">pyopmspe11.core.pyopmspe11 module</a><ul>
106+
<li class="toctree-l4"><a class="reference internal" href="pyopmspe11.core.pyopmspe11.html#pyopmspe11.core.pyopmspe11.check_cmdargs"><code class="docutils literal notranslate"><span class="pre">check_cmdargs()</span></code></a></li>
106107
<li class="toctree-l4"><a class="reference internal" href="pyopmspe11.core.pyopmspe11.html#pyopmspe11.core.pyopmspe11.load_parser"><code class="docutils literal notranslate"><span class="pre">load_parser()</span></code></a></li>
107108
<li class="toctree-l4"><a class="reference internal" href="pyopmspe11.core.pyopmspe11.html#pyopmspe11.core.pyopmspe11.main"><code class="docutils literal notranslate"><span class="pre">main()</span></code></a></li>
108109
<li class="toctree-l4"><a class="reference internal" href="pyopmspe11.core.pyopmspe11.html#pyopmspe11.core.pyopmspe11.make_dir"><code class="docutils literal notranslate"><span class="pre">make_dir()</span></code></a></li>

docs/searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/text/examples.rst

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,29 @@ The following are some of the figures generated in the compare folder:
5454

5555
The immiscible and isothermal simulations run faster since they have less dof.
5656

57-
The `plopm <https://github.com/cssr-tools/plopm>`_ tool facilitates the visualization of selected results, and can be installed by:
57+
.. note::
5858

59-
.. code-block:: bash
60-
61-
pip install git+https://github.com/cssr-tools/plopm.git
59+
`plopm <https://github.com/cssr-tools/plopm>`_ facilitates the visualization of selected results, and can be installed by:
60+
61+
.. code-block:: bash
62+
63+
pip install git+https://github.com/cssr-tools/plopm.git
6264
63-
For example, the following figures are generated with the commands:
65+
For example, the following figures are generated using `plopm <https://github.com/cssr-tools/plopm>`_ with the commands:
6466

6567
.. code-block:: bash
6668
6769
plopm -i isothermal/flow/ISOTHERMAL -v sgas -t 'Isothermal simulation (end of simulation)'
68-
plopm -i 'immiscible/data/spe11b_time_series convective/data/spe11b_time_series' -csv 1,4 -labels "Immiscible Convective" -tunits y -ylabel 'mobA [kg]' -xformat .0f -x '[0,25]' -xlnum 6 -f 20 -d 10,5 -yformat .1e -e 'solid,solid' -lw 4
70+
plopm -i 'immiscible/data/spe11b_time_series convective/data/spe11b_time_series' -csv 1,4 -labels "Immiscible Convective" -tunits y -ylabel 'mobA [kg]' -xformat .0f -x '[0,25]' -xlnum 6 -f 20 -d 10,5 -yformat .1e -e 'solid,solid' -lw 4 -step 1
6971
7072
.. figure:: figs/plopm_hello_world.png
7173

74+
All previous commands can be executed from the main repository location as (`docs_hello_world.sh <https://github.com/OPM/pyopmspe11/blob/main/tests/scripts/docs_hello_world.sh>`_):
75+
76+
.. code-block:: bash
77+
78+
. ./tests/scripts/docs_hello_world.sh
79+
7280
.. tip::
7381

7482
`This example <https://cssr-tools.github.io/plopm/examples.html#reading-from-csv-files>`_ shows how to use `plopm <https://github.com/cssr-tools/plopm>`_ to
@@ -91,6 +99,12 @@ saving the configuration file as spe11b_11-levels.toml, running them (we add the
9199
92100
.. image:: ./figs/11_levels_dz_i,1,k_t5.png
93101

102+
All previous commands can be executed from the main repository location as (`docs_cp_grids.sh <https://github.com/OPM/pyopmspe11/blob/main/tests/scripts/docs_cp_grids.sh>`_):
103+
104+
.. code-block:: bash
105+
106+
. ./tests/scripts/docs_cp_grids.sh
107+
94108
======================
95109
Localized lower domain
96110
======================
@@ -103,4 +117,10 @@ The flag **-n lower** results in the generation of files for the lower part (low
103117
104118
.. image:: ./figs/lower_domain_pvtnum-1-satnum_i,14,k_t5.png
105119

120+
All previous commands can be executed from the main repository location as (`docs_localized_lower_domain.sh <https://github.com/OPM/pyopmspe11/blob/main/tests/scripts/docs_localized_lower_domain.sh>`_):
121+
122+
.. code-block:: bash
123+
124+
. ./tests/scripts/docs_localized_lower_domain.sh
125+
106126
See the :doc:`convergence <./convergence>` for using the localized domain in the SPE11B corner-point grid case.

src/pyopmspe11/config/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SPDX-FileCopyrightText: 2023-2026 NORCE Research AS
2-
# SPDX-License-Identifier: GPL-3.0
2+
# SPDX-License-Identifier: MIT
33
# pylint: disable=C0103, R0902
44

55
"""Central configuration models for pyopmspe11"""

0 commit comments

Comments
 (0)