Skip to content

Commit 1a184f9

Browse files
author
Yngve S. Kristiansen
committed
Use res2df instead of ecl2df
1 parent 2142fc5 commit 1a184f9

File tree

10 files changed

+35
-35
lines changed

10 files changed

+35
-35
lines changed

docs/scripts/prtvol2csv.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,5 +130,5 @@ file has been supplied defining the map from zones and regions to FIPNUM:
130130
See also
131131
--------
132132

133-
* https://equinor.github.io/ecl2df/usage/fipreports.html can be used to extract
133+
* https://equinor.github.io/res2df/usage/fipreports.html can be used to extract
134134
more information from the PRT files.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ dynamic = ["version"]
3737
dependencies = [
3838
"configsuite",
3939
"resdata",
40-
"ecl2df",
40+
"res2df",
4141
"ert>=2.38.0b7",
4242
"fmu-tools",
4343
"matplotlib",

src/subscript/check_swatinit/check_swatinit.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys
44
from typing import Any, Dict, List
55

6-
import ecl2df
6+
import res2df
77
import numpy as np
88
import pandas as pd
99
from matplotlib import pyplot
@@ -58,7 +58,7 @@ def main() -> None:
5858
if args.DATAFILE.endswith(".csv"):
5959
qc_frame = pd.read_csv(args.DATAFILE)
6060
else:
61-
eclfiles = ecl2df.EclFiles(args.DATAFILE)
61+
eclfiles = res2df.Resdatafiles(args.DATAFILE)
6262

6363
# Fail hard if the deck is not suitable for this tool or
6464
# give warnings/hints to the user:
@@ -102,7 +102,7 @@ def main() -> None:
102102
pyplot.savefig(args.plotfile)
103103

104104

105-
def check_applicability(eclfiles: ecl2df.EclFiles) -> None:
105+
def check_applicability(eclfiles: res2df.ResdataFiles) -> None:
106106
"""Check that the input is relevant for usage with check_swatinit. This
107107
function may raise exceptions, SystemExit or only give warnings"""
108108

@@ -212,15 +212,15 @@ def human_report_pc_scaling(qc_frame: pd.DataFrame) -> str:
212212
return string
213213

214214

215-
def make_qc_gridframe(eclfiles: ecl2df.EclFiles) -> pd.DataFrame:
215+
def make_qc_gridframe(eclfiles: res2df.ResdataFiles) -> pd.DataFrame:
216216
"""Construct a dataframe with needed information for swatinit qc from an
217217
Eclipse run.
218218
219219
Makes a dataframe with one row for each active cell. Information from
220220
satfunc and equil merged in.
221221
"""
222222

223-
grid_df = ecl2df.grid.df(
223+
grid_df = res2df.grid.df(
224224
eclfiles,
225225
vectors=[
226226
# All of these are required.
@@ -242,14 +242,14 @@ def make_qc_gridframe(eclfiles: ecl2df.EclFiles) -> pd.DataFrame:
242242
rstdates="first",
243243
)
244244

245-
# Circumvent bug in ecl2df that will pick SWL from both INIT and restart file:
245+
# Circumvent bug in res2df that will pick SWL from both INIT and restart file:
246246
grid_df = grid_df.loc[:, ~grid_df.columns.duplicated()]
247247

248248
# Merge in PPCWMAX from the deck, it is not reported in binary output files:
249249
if "PPCWMAX" in eclfiles.get_ecldeck():
250250
grid_df["PPCWMAX"] = ppcwmax_gridvector(eclfiles)
251251

252-
# This will be unneccessary from ecl2df 0.13.0:
252+
# This will be unneccessary from res2df 0.13.0:
253253
grid_df = grid_df.where(grid_df > -1e20 + 1e13)
254254

255255
if "SWL" not in grid_df:
@@ -280,12 +280,12 @@ def make_qc_gridframe(eclfiles: ecl2df.EclFiles) -> pd.DataFrame:
280280
del grid_df["SWATINIT_DECK"] # This is not needed
281281

282282
# Exposed to issues with endpoint scaling in peculiar decks:
283-
satfunc_df = ecl2df.satfunc.df(eclfiles)
283+
satfunc_df = res2df.satfunc.df(eclfiles)
284284

285285
# Merge in the input pcmax pr. satnum for each cell:
286286
grid_df = merge_pc_max(grid_df, satfunc_df)
287287

288-
grid_df = merge_equil(grid_df, ecl2df.equil.df(eclfiles, keywords=["EQUIL"]))
288+
grid_df = merge_equil(grid_df, res2df.equil.df(eclfiles, keywords=["EQUIL"]))
289289

290290
grid_df = augment_grid_frame_qc_vectors(grid_df)
291291

@@ -587,7 +587,7 @@ def compute_pc(qc_frame: pd.DataFrame, satfunc_df: pd.DataFrame) -> pd.Series:
587587
return p_cap
588588

589589

590-
def ppcwmax_gridvector(eclfiles: ecl2df.EclFiles) -> pd.Series:
590+
def ppcwmax_gridvector(eclfiles: res2df.ResdataFiles) -> pd.Series:
591591
"""Generate a vector of PPCWMAX data pr cell
592592
593593
PPCWMAX is pr. SATNUM in the input deck
@@ -596,10 +596,10 @@ def ppcwmax_gridvector(eclfiles: ecl2df.EclFiles) -> pd.Series:
596596
eclfiles
597597
598598
Returns:
599-
pd.Series, indexed according to ecl2df.grid.df(eclfiles)
599+
pd.Series, indexed according to res2df.grid.df(eclfiles)
600600
"""
601601

602-
satnum_df = ecl2df.grid.df(eclfiles, vectors="SATNUM")
602+
satnum_df = res2df.grid.df(eclfiles, vectors="SATNUM")
603603
deck = eclfiles.get_ecldeck()
604604
for satnum in satnum_df["SATNUM"].unique():
605605
ppcwmax = deck["PPCWMAX"][satnum - 1][0].get_raw_data_list()[0]
@@ -615,7 +615,7 @@ def merge_equil(grid_df: pd.DataFrame, equil_df: pd.DataFrame) -> pd.DataFrame:
615615
assert "Z" in equil_df
616616
assert "PRESSURE" in equil_df
617617

618-
# Be compatible with future change in ecl2df:
618+
# Be compatible with future change in res2df:
619619
equil_df.rename({"ACCURACY": "OIP_INIT"}, axis="columns", inplace=True)
620620

621621
contacts = list(set(["OWC", "GOC", "GWC"]).intersection(set(equil_df.columns)))

src/subscript/interp_relperm/interp_relperm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import yaml
1212
from configsuite import MetaKeys as MK # lgtm [py/import-and-import-from]
1313
from configsuite import types # lgtm [py/import-and-import-from]
14-
from ecl2df import satfunc
14+
from res2df import satfunc
1515

1616
import subscript
1717

@@ -397,10 +397,10 @@ def main() -> None:
397397

398398
logger.setLevel(logging.INFO)
399399

400-
# Mute expected warnings from ecl2df.inferdims, we get these
400+
# Mute expected warnings from res2df.inferdims, we get these
401401
# because we don't tell the module how many SATNUMs there are in
402402
# input files, which is slightly fragile for opm to parse.
403-
logging.getLogger("ecl2df.inferdims").setLevel(logging.ERROR)
403+
logging.getLogger("res2df.inferdims").setLevel(logging.ERROR)
404404

405405
# parse the config file
406406
if not Path(args.configfile).exists():

src/subscript/presentvalue/presentvalue.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from pathlib import Path
66
from typing import Dict, Optional
77

8-
import ecl2df
8+
import res2df
99
import numpy as np
1010
import pandas as pd
1111
import scipy.optimize
@@ -422,8 +422,8 @@ def get_yearly_summary(
422422
vec.split(":")[0].endswith("T") for vec in [oilvector, gasvector, gasinjvector]
423423
):
424424
raise ValueError("Only cumulative Eclipse vectors can be used")
425-
eclfiles = ecl2df.EclFiles(eclfile)
426-
sum_df = ecl2df.summary.df(
425+
eclfiles = res2df.ResdataFiles(eclfile)
426+
sum_df = res2df.summary.df(
427427
eclfiles, column_keys=[oilvector, gasvector, gasinjvector], time_index="yearly"
428428
)
429429
sum_df.rename(

src/subscript/prtvol2csv/prtvol2csv.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from pathlib import Path
88
from typing import Optional
99

10-
import ecl2df
10+
import res2df
1111
import pandas as pd
1212
from fmu.tools.fipmapper.fipmapper import FipMapper
1313

@@ -162,7 +162,7 @@ def currently_in_place_from_prt(
162162
) -> pd.DataFrame:
163163
"""Extracts currently-in-place volumes from a PRT file
164164
165-
This function uses ecl2df.fipreports, and slices its
165+
This function uses res2df.fipreports, and slices its
166166
output for the purpose here.
167167
168168
Args:
@@ -174,7 +174,7 @@ def currently_in_place_from_prt(
174174
Returns:
175175
pd.DataFrame
176176
"""
177-
inplace_df = ecl2df.fipreports.df(prt_file, fipname=fipname)
177+
inplace_df = res2df.fipreports.df(prt_file, fipname=fipname)
178178

179179
available_dates = inplace_df.sort_values("DATE")["DATE"].unique()
180180
if date is None or date == "first":

src/subscript/sector2fluxnum/completions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from ecl2df import EclFiles, compdat
1+
from res2df import ResdataFiles, compdat
22

33

44
def get_completion_list(ecl_data_file_name):
@@ -14,7 +14,7 @@ def get_completion_list(ecl_data_file_name):
1414
List of completions associated to well names
1515
"""
1616

17-
ecl_file = EclFiles(ecl_data_file_name)
17+
ecl_file = ResdataFiles(ecl_data_file_name)
1818
compdat_df = compdat.df(ecl_file)
1919

2020
# Convert from ECL index

tests/test_check_swatinit_simulators.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import time
1414
from pathlib import Path
1515

16-
import ecl2df
16+
import res2df
1717
import numpy as np
1818
import pandas as pd
1919
import pytest
@@ -85,7 +85,7 @@ def run_reservoir_simulator(simulator, resmodel, perform_qc=True):
8585
raise AssertionError(f"reservoir simulator failed in {os.getcwd()}")
8686

8787
if perform_qc:
88-
return make_qc_gridframe(ecl2df.EclFiles("FOO.DATA"))
88+
return make_qc_gridframe(res2df.ResdataFiles("FOO.DATA"))
8989
return None
9090

9191

@@ -494,7 +494,7 @@ def test_swatinit_less_than_1_below_contact(simulator, tmp_path):
494494
assert np.isclose(qc_frame["PC"], 0)
495495
else:
496496
# E100 will not report a PPCW in this case, libecl gives -1e20,
497-
# which becomes a NaN through ecl2df and then NaN columns are dropped.
497+
# which becomes a NaN through res2df and then NaN columns are dropped.
498498
if "PPCW" in qc_frame:
499499
assert pd.isnull(qc_frame["PPCW"][0])
500500
if "PC_SCALING" in qc_frame:

tests/test_interp_relperm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import pandas as pd
77
import pytest
88
import yaml
9-
from ecl2df import satfunc
9+
from res2df import satfunc
1010
from pyscal import PyscalFactory
1111
from pyscal.utils.testing import sat_table_str_ok
1212

@@ -201,7 +201,7 @@ def test_garbled_base_input(tmp_path):
201201

202202
def test_parse_satfunc_files():
203203
"""Test that tables in Eclipse format can be converted
204-
into dataframes (using ecl2df)"""
204+
into dataframes (using res2df)"""
205205
swoffn = TESTDATA / "swof_base.inc"
206206
sgoffn = TESTDATA / "sgof_base.inc"
207207

tests/test_presentvalue.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import subprocess
44
from pathlib import Path
55

6-
import ecl2df
6+
import res2df
77
import numpy as np
88
import pandas as pd
99
import pytest
@@ -328,7 +328,7 @@ def test_no_gasinj(tmp_path):
328328
)
329329
smry["DATE"] = pd.to_datetime(smry["DATE"])
330330
smry.set_index("DATE")
331-
eclsum = ecl2df.summary.df2eclsum(smry, "NOGASINJ")
331+
eclsum = res2df.summary.df2ressum(smry, "NOGASINJ")
332332
Summary.fwrite(eclsum)
333333
econ_df = presentvalue.prepare_econ_table(
334334
oilprice=100, gasprice=0, usdtonok=10, discountrate=0
@@ -353,7 +353,7 @@ def test_no_gas(tmp_path):
353353
)
354354
smry["DATE"] = pd.to_datetime(smry["DATE"])
355355
smry.set_index("DATE")
356-
eclsum = ecl2df.summary.df2eclsum(smry, "NOGAS")
356+
eclsum = res2df.summary.df2ressum(smry, "NOGAS")
357357
Summary.fwrite(eclsum)
358358
econ_df = presentvalue.prepare_econ_table(
359359
oilprice=100, gasprice=0, usdtonok=10, discountrate=0
@@ -378,7 +378,7 @@ def test_no_oil(tmp_path):
378378
)
379379
smry["DATE"] = pd.to_datetime(smry["DATE"])
380380
smry.set_index("DATE")
381-
eclsum = ecl2df.summary.df2eclsum(smry, "NOOIL")
381+
eclsum = res2df.summary.df2ressum(smry, "NOOIL")
382382
Summary.fwrite(eclsum)
383383
econ_df = presentvalue.prepare_econ_table(
384384
oilprice=0, gasprice=10, usdtonok=10, discountrate=0

0 commit comments

Comments
 (0)