Skip to content

Commit 817bb96

Browse files
committed
Usinf ert from mater commit
1 parent 49e970a commit 817bb96

19 files changed

+125
-83
lines changed

docs/_sources/installation.rst.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ While using package managers such as Anaconda, Miniforge, or Mamba might work, t
77
The supported Python versions are 3.11 to 3.13. We will update the documentation when Python3.14 is supported
88
(e.g., the ert Python package is not yet available via pip install in Python 3.14).
99

10+
.. note::
11+
12+
In Ubuntu, one also needs to install freeglut3-dev:
13+
14+
.. code-block:: bash
15+
16+
sudo apt-get install freeglut3-dev
17+
1018
.. _vpycopm:
1119

1220
Python package

docs/installation.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ <h1>Installation<a class="headerlink" href="#installation" title="Link to this h
9595
While using package managers such as Anaconda, Miniforge, or Mamba might work, these are not tested.
9696
The supported Python versions are 3.11 to 3.13. We will update the documentation when Python3.14 is supported
9797
(e.g., the ert Python package is not yet available via pip install in Python 3.14).</p>
98+
<div class="admonition note">
99+
<p class="admonition-title">Note</p>
100+
<p>In Ubuntu, one also needs to install freeglut3-dev:</p>
101+
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>apt-get<span class="w"> </span>install<span class="w"> </span>freeglut3-dev
102+
</pre></div>
103+
</div>
104+
</div>
98105
<section id="python-package">
99106
<span id="vpycopm"></span><h2>Python package<a class="headerlink" href="#python-package" title="Link to this heading"></a></h2>
100107
<p>To install the <strong>pycopm</strong> executable from the development version:</p>

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/installation.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ While using package managers such as Anaconda, Miniforge, or Mamba might work, t
77
The supported Python versions are 3.11 to 3.13. We will update the documentation when Python3.14 is supported
88
(e.g., the ert Python package is not yet available via pip install in Python 3.14).
99

10+
.. note::
11+
12+
In Ubuntu, one also needs to install freeglut3-dev:
13+
14+
.. code-block:: bash
15+
16+
sudo apt-get install freeglut3-dev
17+
1018
.. _vpycopm:
1119

1220
Python package

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ classifiers = [
2424
]
2525
dependencies = [
2626
"alive_progress<=3.3.0",
27-
"ert==16.0.8",
27+
"ert@git+https://github.com/equinor/ert#egg=d79d7c9", # Using master since the latest available version (16.0.8) has a few issues
2828
"h5py<=3.14.0",
2929
"mako<=1.3.10",
3030
"opm<=2025.10"

src/pycopm/core/pycopm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def pycopm():
8080
)
8181
if (
8282
not isinstance(dic["rcijk"], str)
83-
or sum(len(dic[f"{i}ref"]) for i in ["x", "y", "z"]) > 0
83+
or np.sum(len(dic[f"{i}ref"]) for i in ["x", "y", "z"]) > 0
8484
):
8585
dic["refinement"] = True
8686
else:

src/pycopm/template_scripts/common/perm.mako

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
<%!
2+
import numpy as np
3+
%>\
14
{
25
%for j in range(len(dic["actnum_c"])):
36
%if dic["actnum_c"][j] == 1:
47
%if j == last:
5-
"${dic["rock"][i][0]}${sum(dic["actnum_c"][0:j])}": <${dic["rock"][i][0]}${sum(dic["actnum_c"][0:j])}>
8+
"${dic["rock"][i][0]}${np.sum(dic["actnum_c"][0:j])}": <${dic["rock"][i][0]}${np.sum(dic["actnum_c"][0:j])}>
69
%else:
7-
"${dic["rock"][i][0]}${sum(dic["actnum_c"][0:j])}": <${dic["rock"][i][0]}${sum(dic["actnum_c"][0:j])}>,
10+
"${dic["rock"][i][0]}${np.sum(dic["actnum_c"][0:j])}": <${dic["rock"][i][0]}${np.sum(dic["actnum_c"][0:j])}>,
811
%endif
912
%endif
1013
%endfor

src/pycopm/template_scripts/common/perm_eval.mako

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
<%!
2+
import numpy as np
3+
%>\
14
#!/usr/bin/env python3
25
# SPDX-FileCopyrightText: 2024-2025 NORCE Research AS
36
# SPDX-License-Identifier: GPL-3.0
@@ -23,7 +26,7 @@ def perm_evaluation():
2326
% for k in range(len(dic['actnum_c'])):
2427
% if dic['rock'][i][1] > 0 and dic['mode'] in ["files","ert"]:
2528
% if dic['actnum_c'][k] == 1:
26-
P[${k}] = max(1e1,min(C["${dic['rock'][i][0]}${sum(dic['actnum_c'][0:k])}"],1e9))
29+
P[${k}] = max(1e1,min(C["${dic['rock'][i][0]}${np.sum(dic['actnum_c'][0:k])}"],1e9))
2730
% endif
2831
% else:
2932
P[${k}] = ${k_c[k]}
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
<%!
2+
import numpy as np
3+
%>\
14
%for j in range(len(dic['actnum_c'])):
25
%if dic['actnum_c'][j] == 1:
3-
${dic["rock"][i][0]}${sum(dic['actnum_c'][0:j])} UNIFORM ${min_max[j][0]} ${min_max[j][1]}
6+
${dic["rock"][i][0]}${np.sum(dic['actnum_c'][0:j])} UNIFORM ${min_max[j][0]} ${min_max[j][1]}
47
%endif
58
%endfor

src/pycopm/template_scripts/common/plot_post.mako

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def visualizeData():
188188
for type, ftype, dens in zip(["WWPR","WOPR","WGPR"],["FWPT","FOPT","FGPT"],[999.04100, 852.95669, 0.90358]):
189189
fmass[ftype] = dens*smspec[ftype+"H"][-1]
190190
for well in nwells:
191-
if sum(smspec[type+"H:"+well])>0:
191+
if np.sum(smspec[type+"H:"+well])>0:
192192
wells[type].append(type+":"+well)
193193
j += 1
194194
linei = [[ ] for _ in range(j)]
@@ -417,14 +417,14 @@ def visualizeData():
417417
data = smspec[wells[type][i]]
418418
datah = smspec[wells[type][i][:4]+"H"+wells[type][i][4:]]
419419
axs[j].plot(smsp_dates, data, color='m', label = 'opm-tests')
420-
if sum(datah>0):
420+
if np.sum(datah>0):
421421
axs[j].errorbar(smsp_dates, datah, yerr= [max(minerr[type],var[type]*d_2) for d_2 in datah], color=[128 / 255.0, 128 / 255.0, 128 / 255.0], markersize='.5', elinewidth=.5, fmt='o', linestyle='', label = 'Data')
422422
axs[j].set_ylabel(f'{wells[type][i]} [SM3/day]', fontsize=12)
423423
axs[j].set_xlabel('Time [years]', fontsize=12)
424424
axs[j].xaxis.set_tick_params(size=6, rotation=45)
425425
axs[j].legend()
426426
axs[j].set_ylim(bottom=0)
427-
if sum(datah>0):
427+
if np.sum(datah>0):
428428
figs[j].savefig(f"{output_folder}/postprocessing/wells/HISTO_DATA_{wells[type][i][:4]}_{wells[type][i][5:]}.png", bbox_inches="tight")
429429
else:
430430
figs[j].savefig(f"{output_folder}/postprocessing/wells/{wells[type][i][:4]}_{wells[type][i][5:]}.png", bbox_inches="tight")
@@ -455,7 +455,7 @@ def visualizeData():
455455
figs, ax = plt.subplots()
456456
tab20s = matplotlib.colormaps['tab20']
457457
for i in range(I):
458-
ax.plot(i,sum(error_hist[i])/(len(error_hist[i])), markersize='10', marker='o', label=r"$N_{ens}=$"+f"{n_e[i]}", c=tab20s.colors[i])
458+
ax.plot(i,np.sum(error_hist[i])/(len(error_hist[i])), markersize='10', marker='o', label=r"$N_{ens}=$"+f"{n_e[i]}", c=tab20s.colors[i])
459459
ax.axhline(y=error_standard, color="black", ls="--", lw=1, label=f'opm-tests (#Active cells:{numCellsDefault})')
460460
ax.set_title(r"$O_i=\frac{1}{N_{ens}}\sum_{j}^{N_{e}}O_{i,j}$, "+f"#HM parameters: {len(csvData)}, #Active cells: {numCellsHm}")
461461
ax.legend()
@@ -578,7 +578,7 @@ def visualizeData():
578578
f.write(f'Missmatch (standard simulation from opm-test deck): {error_standard : .4e}\n')
579579
for i in range(I):
580580
f.write(f'Iteration {i}; Number of ensembles {int(n_e[i])}\n')
581-
f.write(f'Missmatch (mean): {sum(error_hist[i])/(len(error_hist[i])) : .4e} \n')
581+
f.write(f'Missmatch (mean): {np.sum(error_hist[i])/(len(error_hist[i])) : .4e} \n')
582582
f.write(f'Missmatch (closest realization to all obs): {error_ens[i][eobs[i][0][0]]: .4e}\n')
583583
print(f'\nClosest final realization to all obs:{eobs[-1][0][0]}')
584584
print(f'Number of parameters to HM: {len(csvData)}')
@@ -587,7 +587,7 @@ def visualizeData():
587587
print(f'Missmatch (standard simulation from opm-test deck): {error_standard : .4e}')
588588
for i in range(I):
589589
print(f'Iteration {i}; Number of ensembles {int(n_e[i])}')
590-
print(f'Missmatch (mean): {sum(error_hist[i])/(len(error_hist[i])) : .4e}')
590+
print(f'Missmatch (mean): {np.sum(error_hist[i])/(len(error_hist[i])) : .4e}')
591591
print(f'Missmatch (closest realization to all obs): {error_ens[i][eobs[i][0][0]] : .4e}')
592592
else:
593593
with open(f"{output_folder}/postprocessing/errors.txt", 'w') as f:

0 commit comments

Comments
 (0)