res2df 1.3.1__py2.py3-none-any.whl → 1.3.2__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
res2df/csv2res.py CHANGED
@@ -19,21 +19,6 @@ from .summary import summary_reverse_main
19
19
  from .vfp import fill_reverse_parser as vfp_fill_reverse_parser
20
20
  from .vfp import vfp_reverse_main
21
21
 
22
- # String constants in use for generating ERT forward model documentation:
23
- DESCRIPTION: str = """Convert CSV files into include files. Uses the command
24
- line utility ``csv2res``. Run ``csv2res --help`` to see which subcommands are supported.
25
- No options other than the output file is possible when used directly as a forward model.
26
- When writing synthetic summary files, the ECLBASE with no filename suffix is expected
27
- as the OUTPUT argument."""
28
- CATEGORY: str = "utility.eclipse"
29
- EXAMPLES: str = (
30
- "``FORWARD_MODEL "
31
- "CSV2RES(<SUBCOMMAND>=equil, <CSVFILE>=equil.csv, "
32
- "<OUTPUT>=eclipse/include/equil.inc)``"
33
- "CSV2RES(<SUBCOMMAND>=summary, <CSVFILE>=summary-monthly.csv, "
34
- "<OUTPUT>=eclipse/model/MONTHLYSUMMARY)``"
35
- )
36
-
37
22
 
38
23
  def get_parser() -> argparse.ArgumentParser:
39
24
  """Make parser"""
res2df/fipreports.py CHANGED
@@ -66,10 +66,10 @@ def report_block_lineparser(line: str) -> tuple:
66
66
  (liquid_oil, vapour_oil, total_oil) = map(
67
67
  float_or_nan, colonsections[2].split()
68
68
  )
69
+ elif len(colonsections[2].split()) == 2:
70
+ (liquid_oil, total_oil) = map(float_or_nan, colonsections[2].split())
69
71
  elif len(colonsections[2].split()) == 1:
70
72
  total_oil = float_or_nan(colonsections[2])
71
- else:
72
- (liquid_oil, total_oil) = map(float_or_nan, colonsections[2].split())
73
73
 
74
74
  total_water = float_or_nan(colonsections[3])
75
75
 
res2df/grid.py CHANGED
@@ -726,9 +726,9 @@ def df2res(
726
726
  raise ValueError(f"Keyword {keyword} not found in grid dataframe")
727
727
  vector = np.zeros(global_size)
728
728
  vector[grid_df["GLOBAL_INDEX"].astype(int).values] = grid_df[keyword]
729
- if dtype == int:
729
+ if dtype is int:
730
730
  vector = vector.astype(int)
731
- if dtype == float:
731
+ if dtype is float:
732
732
  vector = vector.astype(float)
733
733
  if len(vector) != global_size:
734
734
  logger.warning(
res2df/gruptree.py CHANGED
@@ -340,7 +340,7 @@ def _add_to_tree_from_dict(
340
340
  _add_to_tree_from_dict(nested_dict=value, name=key, tree=tree, parent=name)
341
341
 
342
342
 
343
- def tree_from_dict(nested_dict: dict) -> treelib.Tree:
343
+ def tree_from_dict(nested_dict: dict) -> treelib.Tree | str:
344
344
  """Convert a dictionary to a treelib Tree.
345
345
 
346
346
  The treelib representation of the trees is used
@@ -0,0 +1,138 @@
1
+ import shutil
2
+
3
+ try:
4
+ from ert import ( # type: ignore
5
+ ForwardModelStepDocumentation,
6
+ ForwardModelStepJSON,
7
+ ForwardModelStepPlugin,
8
+ ForwardModelStepValidationError,
9
+ )
10
+ from ert import plugin as ert_plugin # type: ignore
11
+ except ModuleNotFoundError:
12
+ # ert is not installed, use dummy/transparent function decorator:
13
+ def ert_plugin(name: str = ""):
14
+ def decorator(func):
15
+ return func
16
+
17
+ return decorator
18
+
19
+ class ForwardModelStepDocumentation: # type: ignore
20
+ pass
21
+
22
+ class ForwardModelStepJSON: # type: ignore
23
+ pass
24
+
25
+ class ForwardModelStepPlugin: # type: ignore
26
+ pass
27
+
28
+ class ForwardModelStepValidationError: # type: ignore
29
+ pass
30
+
31
+
32
+ class Res2Csv(ForwardModelStepPlugin):
33
+ def __init__(self) -> None:
34
+ super().__init__(
35
+ name="RES2CSV",
36
+ command=[
37
+ shutil.which("res2csv"),
38
+ "<SUBCOMMAND>",
39
+ "--verbose",
40
+ "--output",
41
+ "<OUTPUT>",
42
+ *[f"<XARG{num + 1}>" for num in range(10)],
43
+ "--",
44
+ "<ECLBASE>",
45
+ ],
46
+ default_mapping={f"<XARG{num + 1}>": "" for num in range(10)},
47
+ )
48
+
49
+ def validate_pre_experiment(self, fm_json: ForwardModelStepJSON) -> None:
50
+ if fm_json["argList"][0] == "<SUBCOMMAND>":
51
+ raise ForwardModelStepValidationError(
52
+ "You must supply a value for SUBCOMMAND to RES2CSV"
53
+ )
54
+ if fm_json["argList"][3] == "<OUTPUT>":
55
+ raise ForwardModelStepValidationError(
56
+ "You must supply a value for OUTPUT to RES2CSV"
57
+ )
58
+
59
+ @staticmethod
60
+ def documentation() -> ForwardModelStepDocumentation | None:
61
+ return ForwardModelStepDocumentation(
62
+ description="""Convert reservoir simulator input and output files into CSV
63
+ files, with the command line utility ``res2csv``. Run ``res2csv --help`` to see
64
+ which subcommands are supported.
65
+
66
+ For supplying options to subcommands, you can use the arguments ``<XARGn>``
67
+ where ``n`` goes from 1 to 10.
68
+
69
+ For more documentation, see https://equinor.github.io/res2df/.
70
+ """,
71
+ category="utility.eclipse",
72
+ examples="""Outputting the EQUIL data from a .DATA file. This is implicitly
73
+ supplied in ERT configs::
74
+
75
+ FORWARD_MODEL RES2CSV(<SUBCOMMAND>=equil, <OUTPUT>=equil.csv)
76
+
77
+ For a yearly summary export of the realization, options have to be supplied
78
+ with the XARG options::
79
+
80
+ FORWARD_MODEL RES2CSV(<SUBCOMMAND>=summary, \
81
+ <OUTPUT>=yearly.csv, <XARG1>="--time_index", <XARG2>="yearly")
82
+
83
+ The quotes around double-dashed options are critical to avoid ERT taking for a
84
+ comment. For more options, use ``<XARG3>`` etc.
85
+ """,
86
+ )
87
+
88
+
89
+ class Csv2Res(ForwardModelStepPlugin):
90
+ def __init__(self) -> None:
91
+ super().__init__(
92
+ name="CSV2RES",
93
+ command=[
94
+ shutil.which("csv2res"),
95
+ "<SUBCOMMAND>",
96
+ "--verbose",
97
+ "--output",
98
+ "<OUTPUT>",
99
+ "<CSVFILE>",
100
+ ],
101
+ )
102
+
103
+ def validate_pre_experiment(self, fm_json: ForwardModelStepJSON) -> None:
104
+ if fm_json["argList"][0] == "<SUBCOMMAND>":
105
+ raise ForwardModelStepValidationError(
106
+ "You must supply a value for SUBCOMMAND to CSV2RES"
107
+ )
108
+ if fm_json["argList"][3] == "<OUTPUT>":
109
+ raise ForwardModelStepValidationError(
110
+ "You must supply a value for OUTPUT to CSV2RES"
111
+ )
112
+ if fm_json["argList"][4] == "<CSVFILE>":
113
+ raise ForwardModelStepValidationError(
114
+ "You must supply a value for CSVFILE to CSV2RES"
115
+ )
116
+
117
+ @staticmethod
118
+ def documentation() -> ForwardModelStepDocumentation | None:
119
+ return ForwardModelStepDocumentation(
120
+ description="""Convert CSV files into include files. Uses the command
121
+ line utility ``csv2res``. Run ``csv2res --help`` to see which subcommands are supported.
122
+ No options other than the output file is possible when used directly as a forward model.
123
+ When writing synthetic summary files, the ECLBASE with no filename suffix is expected
124
+ as the OUTPUT argument.""",
125
+ category="utility.eclipse",
126
+ examples=(
127
+ "``FORWARD_MODEL "
128
+ "CSV2RES(<SUBCOMMAND>=equil, <CSVFILE>=equil.csv, "
129
+ "<OUTPUT>=eclipse/include/equil.inc)``"
130
+ "CSV2RES(<SUBCOMMAND>=summary, <CSVFILE>=summary-monthly.csv, "
131
+ "<OUTPUT>=eclipse/model/MONTHLYSUMMARY)``"
132
+ ),
133
+ )
134
+
135
+
136
+ @ert_plugin(name="RES2CSV")
137
+ def installable_forward_model_steps() -> list[type[ForwardModelStepPlugin]]:
138
+ return [Res2Csv, Csv2Res]
res2df/res2csv.py CHANGED
@@ -12,33 +12,6 @@ from typing import Optional
12
12
 
13
13
  from .__version__ import __version__
14
14
 
15
- # String constants in use for generating ERT forward model documentation:
16
- DESCRIPTION: str = """Convert reservoir simulator input and output files into CSV files,
17
- with the command line utility ``res2csv``. Run ``res2csv --help`` to see
18
- which subcommands are supported.
19
-
20
- For supplying options to subcommands, you can use the arguments ``<XARGn>``
21
- where ``n`` goes from 1 to 10.
22
-
23
- For more documentation, see https://equinor.github.io/res2df/.
24
- """
25
- CATEGORY: str = "utility.eclipse"
26
- EXAMPLES: str = """
27
-
28
- Outputting the EQUIL data from a .DATA file. This is implicitly
29
- supplied in ERT configs::
30
-
31
- FORWARD_MODEL RES2CSV(<SUBCOMMAND>=equil, <OUTPUT>=equil.csv)
32
-
33
- For a yearly summary export of the realization, options have to be supplied
34
- with the XARG options::
35
-
36
- FORWARD_MODEL RES2CSV(<SUBCOMMAND>=summary, <OUTPUT>=yearly.csv, <XARG1>="--time_index", <XARG2>="yearly")
37
-
38
- The quotes around double-dashed options are critical to avoid ERT taking for a
39
- comment. For more options, use ``<XARG3>`` etc.
40
- """ # noqa
41
-
42
15
 
43
16
  def get_parser() -> argparse.ArgumentParser:
44
17
  """Make parser"""
res2df/summary.py CHANGED
@@ -814,6 +814,11 @@ def summary_main(args) -> None:
814
814
  paramfile=args.paramfile,
815
815
  datetime=False,
816
816
  )
817
+
818
+ if sum_df.empty:
819
+ logger.error("No data to write. The input file may be missing or invalid.")
820
+ return
821
+
817
822
  if args.arrow:
818
823
  sum_df = _df2pyarrow(sum_df)
819
824
 
res2df/version.py CHANGED
@@ -1,8 +1,13 @@
1
- # file generated by setuptools_scm
1
+ # file generated by setuptools-scm
2
2
  # don't change, don't track in version control
3
+
4
+ __all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
5
+
3
6
  TYPE_CHECKING = False
4
7
  if TYPE_CHECKING:
5
- from typing import Tuple, Union
8
+ from typing import Tuple
9
+ from typing import Union
10
+
6
11
  VERSION_TUPLE = Tuple[Union[int, str], ...]
7
12
  else:
8
13
  VERSION_TUPLE = object
@@ -12,5 +17,5 @@ __version__: str
12
17
  __version_tuple__: VERSION_TUPLE
13
18
  version_tuple: VERSION_TUPLE
14
19
 
15
- __version__ = version = '1.3.1'
16
- __version_tuple__ = version_tuple = (1, 3, 1)
20
+ __version__ = version = '1.3.2'
21
+ __version_tuple__ = version_tuple = (1, 3, 2)
res2df/vfp/_vfpinj.py CHANGED
@@ -116,7 +116,8 @@ def basic_data(
116
116
  if no_interp_values != no_tab_records:
117
117
  raise ValueError(
118
118
  "Dimensions of interpolation ranges does "
119
- "not match number of tabulated records"
119
+ "not match number of tabulated records "
120
+ f"in vfp table {tableno}"
120
121
  )
121
122
 
122
123
  # Extract interpolation values and tabulated values (BHP values)
@@ -136,7 +137,8 @@ def basic_data(
136
137
  if len(bhp_values) != no_flow_values:
137
138
  raise ValueError(
138
139
  "Dimension of record of tabulated values "
139
- "does not match number of flow values"
140
+ "does not match number of flow values "
141
+ f"in vfp table {tableno}"
140
142
  )
141
143
  bhp_table.append(bhp_values)
142
144
 
res2df/vfp/_vfpprod.py CHANGED
@@ -141,7 +141,8 @@ def basic_data(
141
141
  if no_interp_values != no_tab_records:
142
142
  raise ValueError(
143
143
  "Dimensions of interpolation ranges "
144
- "does not match number of tabulated records"
144
+ "does not match number of tabulated records "
145
+ f"in vfp table {tableno}"
145
146
  )
146
147
 
147
148
  # Extract interpolation values and tabulated values (BHP values)
@@ -171,7 +172,8 @@ def basic_data(
171
172
  if len(bhp_values) != no_flow_values:
172
173
  raise ValueError(
173
174
  "Dimension of record of tabulated "
174
- "values does not match number of flow values"
175
+ "values does not match number of flow values "
176
+ f"in vfp table {tableno}"
175
177
  )
176
178
  bhp_table.append(bhp_values)
177
179
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: res2df
3
- Version: 1.3.1
3
+ Version: 1.3.2
4
4
  Summary: Convert reservoir simulator input and output to DataFrames
5
5
  Home-page: http://github.com/equinor/res2df
6
6
  Author: Håvard Berland
@@ -47,6 +47,7 @@ Dynamic: description
47
47
  Dynamic: description-content-type
48
48
  Dynamic: home-page
49
49
  Dynamic: license
50
+ Dynamic: license-file
50
51
  Dynamic: provides-extra
51
52
  Dynamic: requires-dist
52
53
  Dynamic: requires-python
@@ -3,33 +3,31 @@ res2df/__version__.py,sha256=UtExCuqQ29NY2we1bzLXvNkP21JU7hx1wXM4G1uPvts,128
3
3
  res2df/common.py,sha256=9hK4g-0PDVb9HUv96DJ0Spx-yYCGT8ceL_huDjP-UDE,34887
4
4
  res2df/compdat.py,sha256=TVIXdK8HKYfbOQX2TnI63Xt0UNPjI3E9mFC1_Vb0AAc,36796
5
5
  res2df/constants.py,sha256=0W-ZYlm3Bbe9MONrRhA0c4yLXfJlqGX5apFN64i8RU0,258
6
- res2df/csv2res.py,sha256=f_27wjKXMUWnsYVBF1cFxSe4ePOGntZmUP7VDoZ9N7w,4018
6
+ res2df/csv2res.py,sha256=2LegGNGjEQ4lzRPjmS5MYTDsq8yWcRSd2OY6rpearEI,3283
7
7
  res2df/equil.py,sha256=NIJwAgbpjJg0pxsqfxPB86d2rdAVMNJBKsJsoG6ExxU,17175
8
8
  res2df/faults.py,sha256=5v4cWcEmIQwG8TXBBsiteT_3kCNO0noNiAiOZ6JC-80,3163
9
- res2df/fipreports.py,sha256=msZgrUfpQaZppboQgAwVOtReQHKepdsgwJ9lNAcrt0Y,7631
10
- res2df/grid.py,sha256=wlwwsRSfxFAI8YV8x6_VyKXKwnmC1376RtCTNb51wvs,27680
11
- res2df/gruptree.py,sha256=JXLacbT2CNADOIVuh1NkeOmmXYLY_09TzDsoGUGr8To,16923
9
+ res2df/fipreports.py,sha256=PwFUyNDngUi03cTJB8aPIQliPob82N5_IpkjOSbZPUg,7666
10
+ res2df/grid.py,sha256=4V9nPtZQpk4DejBZANVdA-1DBJ0sVK6odPLe3XSoFCA,27680
11
+ res2df/gruptree.py,sha256=4XO-jUaxZHr26iZOkyKByxCYQ1TU2fyW8a76jzphlZM,16929
12
12
  res2df/inferdims.py,sha256=ur0GE1ASzfzoXPgUjaow46NWBlBCgiX6qfAmn8HJatg,7329
13
13
  res2df/nnc.py,sha256=qEPuAhTFwmZuClxaKsrBh28HlLquE0-XH7ams4ylt50,9346
14
14
  res2df/parameters.py,sha256=pkgmW5tVtyMav1T43RxdYHnoejvnZarFhKfhhgp028U,6277
15
15
  res2df/pillars.py,sha256=NXFZhcd4L0pRFLH3B3ip_3ClVuy8Dgz13m4QW4mZDfA,16174
16
16
  res2df/pvt.py,sha256=JNmCUvaNBnq-SUdmnxkt9n3rkR-HUneiHJBfINACVfU,22646
17
- res2df/res2csv.py,sha256=aKqSHNTNXxMb3Ahwh1Cx2BSx7bXV3dSGxhjuPznDABA,12080
17
+ res2df/res2csv.py,sha256=fwGJ4VKhEWidnCPvh4XwTu7lAEK7doIwaYExKSvFN20,11072
18
18
  res2df/res2csvlogger.py,sha256=rsg1IweNsOiP2zHoYqpipQxW2FbvSIN5XNOlQHXfUqo,2328
19
19
  res2df/resdatafiles.py,sha256=xBW3GewottrdFqpj4LxGKjCbfLEPC0H7Odw1Mn1ls_U,10093
20
20
  res2df/rft.py,sha256=ptf-tqc10tpYN2B7W-onC-s20Ct2GRK65oD9ojG0O4w,28082
21
21
  res2df/satfunc.py,sha256=sxoqXsORI5xijD0RSybr6unm-sQNpUckXFNwHEtVdv8,13808
22
- res2df/summary.py,sha256=sa0OH9Nle1uaTRMN33XL69Lyl66876OX01ZJ_kISxSI,31711
22
+ res2df/summary.py,sha256=cHRL78XaypLCCdrIcW9gnlLmoCW6U6Nqpy5yO7FxaTQ,31833
23
23
  res2df/svg_color_keyword_names.txt,sha256=yiI2Ohv3NxxEAJC5OjVERZi7MLi2-bk7okyI5-xFDr8,1456
24
24
  res2df/trans.py,sha256=fWlelN74QPnxm5krWYXIGxhRZKVJA2r1lHXE-Ac1DuI,10880
25
- res2df/version.py,sha256=cOVPCvD2h2G_2KB6G3ddreYkIQfAnS6WqgAkF_qgGOQ,411
25
+ res2df/version.py,sha256=2MIKMHG_bp3KmQVZwa0rSvoTHIRfxwkSxFOUhMK4eQc,511
26
26
  res2df/wcon.py,sha256=67A2qtqokaefLyI5mdTaGkTlkSkDIRhVNVYA-8TE9oE,3376
27
27
  res2df/wellcompletiondata.py,sha256=s4PvMNYBcgSJzPE6_so6suxgeI_fzHbDzA8kHxen-AA,10990
28
28
  res2df/wellconnstatus.py,sha256=KPteMgwomDpp11rAkmN5GTLMEdS79Ah0QEFdG0VSu-E,4055
29
- res2df/config_jobs/CSV2RES,sha256=1s9p8fVOLaWoSuubQoiKMXKDKzXnkDGUOLmm8bNfuyY,94
30
- res2df/config_jobs/RES2CSV,sha256=lkLuiJaY2j3MXj8H8jjfn__6aSUZftGMckkjE91hLfU,372
31
29
  res2df/hook_implementations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
- res2df/hook_implementations/jobs.py,sha256=fowzvV--_Tv9MJ3vCIkUNqIE1Bdm27DlI0Vc_pLf7XU,1729
30
+ res2df/hook_implementations/forward_model_steps.py,sha256=I8T9HGmTW95mHHjBuZkhTxaYwIPg7CJwbusfJotXfSA,4800
33
31
  res2df/opmkeywords/BRANPROP,sha256=MZA6L6J9olaprrUhRah_wgJoOiYXP-DknVAYOdsIC14,475
34
32
  res2df/opmkeywords/COMPDAT,sha256=K19zEK1p9XNoKhD0ylLEJ-oNTi88QQNeUXt7qckO4lg,1345
35
33
  res2df/opmkeywords/COMPLUMP,sha256=AC1vBiHmQIjf9IxeVTGp38Ld8Xjz_xHQOUIg-VmGhFk,514
@@ -79,11 +77,11 @@ res2df/vfp/__init__.py,sha256=sJA_IWTLm3YRX-EjFI7z3DfJdmL_83zMxdAvm4tXdOQ,362
79
77
  res2df/vfp/_vfp.py,sha256=BXqfmdOu6kF8QVaWIOVUTJlNzHu5SIsMDYMidmMoc_o,19626
80
78
  res2df/vfp/_vfpcommon.py,sha256=0no9r1jwGaABXexZ6WoKrOl2fFq87RMmcRZLE640cnk,7053
81
79
  res2df/vfp/_vfpdefs.py,sha256=yvi5nCkJ2UZxVx0LuVbBHLNjn0e0UCSZudmzvTk689A,7028
82
- res2df/vfp/_vfpinj.py,sha256=-QgT0hKBd7mW9VcEaROtwOdxJlZlutRHCNp9wiED6jM,23594
83
- res2df/vfp/_vfpprod.py,sha256=0ar8v1JUFy3f4ezofdwCsq5Xricg6tQArre9rjI5Ol0,36743
84
- res2df-1.3.1.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
85
- res2df-1.3.1.dist-info/METADATA,sha256=6jgXWz_jzV8ApovvFVMzJm75RLfcuCmAy3gJ_Df9R8c,3339
86
- res2df-1.3.1.dist-info/WHEEL,sha256=9Hm2OB-j1QcCUq9Jguht7ayGIIZBRTdOXD1qg9cCgPM,109
87
- res2df-1.3.1.dist-info/entry_points.txt,sha256=MEFyOYIu-X3ZCgqZIE6t8EnmZ3xGvMAj8VMkJdi_lZY,164
88
- res2df-1.3.1.dist-info/top_level.txt,sha256=U8AZBqrFHm9PMXg0toCfHJ817VfFtdKQpc8JuS5qToM,7
89
- res2df-1.3.1.dist-info/RECORD,,
80
+ res2df/vfp/_vfpinj.py,sha256=HZddHIarLUD4BlMsch8kUBTjxyOctpN56X2qPJiSzLo,23676
81
+ res2df/vfp/_vfpprod.py,sha256=gmPKYDxphIutdhH-cn4qr5sIOGSDtxNNNAbk5Krc5Dk,36825
82
+ res2df-1.3.2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
83
+ res2df-1.3.2.dist-info/METADATA,sha256=HSjJKB8l7GQIUqc54aBQF11IQ2KTy3f4WyUZE36x5JM,3361
84
+ res2df-1.3.2.dist-info/WHEEL,sha256=AeO2BvogYWm3eGaHCvhzmUYt8ia7KfURiHzO_1atlys,109
85
+ res2df-1.3.2.dist-info/entry_points.txt,sha256=ctl-_CwayyUVqFMUrwTT3Z3gZdnW6WCaiaLUJ4f_HnY,180
86
+ res2df-1.3.2.dist-info/top_level.txt,sha256=U8AZBqrFHm9PMXg0toCfHJ817VfFtdKQpc8JuS5qToM,7
87
+ res2df-1.3.2.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (79.0.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py2-none-any
5
5
  Tag: py3-none-any
@@ -4,4 +4,4 @@ res2arrow = res2df.res2csv:main
4
4
  res2csv = res2df.res2csv:main
5
5
 
6
6
  [ert]
7
- res2df_jobs = res2df.hook_implementations.jobs
7
+ res2df_steps = res2df.hook_implementations.forward_model_steps
@@ -1,5 +0,0 @@
1
- EXECUTABLE csv2res
2
-
3
- ARGLIST <SUBCOMMAND> "--verbose" "--output" <OUTPUT> <CSVFILE>
4
-
5
- MIN_ARG 2
@@ -1,16 +0,0 @@
1
- EXECUTABLE res2csv
2
-
3
- DEFAULT <XARG1> ""
4
- DEFAULT <XARG2> ""
5
- DEFAULT <XARG3> ""
6
- DEFAULT <XARG4> ""
7
- DEFAULT <XARG5> ""
8
- DEFAULT <XARG6> ""
9
- DEFAULT <XARG7> ""
10
- DEFAULT <XARG8> ""
11
- DEFAULT <XARG9> ""
12
- DEFAULT <XARG10> ""
13
-
14
- ARGLIST <SUBCOMMAND> "--verbose" "--output" <OUTPUT> <XARG1> <XARG2> <XARG3> <XARG4> <XARG5> <XARG6> <XARG7> <XARG8> <XARG9> <XARG10> "--" <ECLBASE>
15
-
16
- MIN_ARG 2
@@ -1,63 +0,0 @@
1
- import importlib
2
- import sys
3
- from pathlib import Path
4
-
5
- try:
6
- from ert import plugin as ert_plugin # type: ignore
7
- except ModuleNotFoundError:
8
- # ert is not installed - use dummy/transparent function decorator:
9
- def ert_plugin(name: str = ""):
10
- def decorator(func):
11
- return func
12
-
13
- return decorator
14
-
15
-
16
- def _get_jobs_from_directory(directory):
17
- resource_directory = Path(sys.modules["res2df"].__file__).parent / directory
18
-
19
- all_files = [
20
- resource_directory / filename
21
- for filename in resource_directory.glob("*")
22
- if (resource_directory / filename).exists()
23
- ]
24
- return {path.name: str(path) for path in all_files}
25
-
26
-
27
- @ert_plugin(name="res2df")
28
- def installable_jobs():
29
- return _get_jobs_from_directory("config_jobs")
30
-
31
-
32
- def _get_module_variable_if_exists(module_name, variable_name, default=""):
33
- try:
34
- script_module = importlib.import_module(module_name)
35
- except ImportError:
36
- return default
37
-
38
- return getattr(script_module, variable_name, default)
39
-
40
-
41
- @ert_plugin(name="res2df")
42
- def job_documentation(job_name):
43
- res2df_jobs = set(installable_jobs().data.keys())
44
- if job_name not in res2df_jobs:
45
- return None
46
-
47
- module_name = f"res2df.{job_name.lower()}"
48
-
49
- description = _get_module_variable_if_exists(
50
- module_name=module_name, variable_name="DESCRIPTION"
51
- )
52
- examples = _get_module_variable_if_exists(
53
- module_name=module_name, variable_name="EXAMPLES"
54
- )
55
- category = _get_module_variable_if_exists(
56
- module_name=module_name, variable_name="CATEGORY", default="other"
57
- )
58
-
59
- return {
60
- "description": description,
61
- "examples": examples,
62
- "category": category,
63
- }