Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wsegaicd support #201

Merged
merged 9 commits into from
Nov 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ecl2df/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
"WELOPEN",
"WELSEGS",
"WELSPECS",
"WSEGAICD",
"WSEGSICD",
]:
OPMKEYWORDS[keyw] = json.loads(
(Path(__file__).parent / "opmkeywords" / keyw).read_text()
Expand Down
37 changes: 35 additions & 2 deletions ecl2df/compdat.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ def deck2dfs(deck, start_date=None, unroll=True):
compsegsrecords = []
welopenrecords = []
welsegsrecords = []
wsegsicdrecords = []
wsegaicdrecords = []
welspecs = {}
date = start_date # DATE column will always be there, but can contain NaN/None
for idx, kword in enumerate(deck):
Expand Down Expand Up @@ -115,6 +117,18 @@ def deck2dfs(deck, start_date=None, unroll=True):
)
rec_data["J"] = welspecs[rec_data["WELL"]]["J"]
compdatrecords.append(rec_data)
elif kword.name == "WSEGSICD":
for rec in kword: # Loop over the lines inside WSEGSICD record
rec_data = parse_opmio_deckrecord(rec, "WSEGSICD")
rec_data["DATE"] = date
rec_data["KEYWORD_IDX"] = idx
wsegsicdrecords.append(rec_data)
elif kword.name == "WSEGAICD":
for rec in kword: # Loop over the lines inside WSEGAICD record
rec_data = parse_opmio_deckrecord(rec, "WSEGAICD")
rec_data["DATE"] = date
rec_data["KEYWORD_IDX"] = idx
wsegaicdrecords.append(rec_data)
elif kword.name == "COMPSEGS":
wellname = parse_opmio_deckrecord(
kword[0], "COMPSEGS", itemlistname="records", recordindex=0
Expand All @@ -139,7 +153,6 @@ def deck2dfs(deck, start_date=None, unroll=True):
"COMPDAT state. Using 'SHUT' instead." % rec_data["STATUS"]
)
welopenrecords.append(rec_data)

elif kword.name == "WELSEGS":
# First record contains meta-information for well
# (opm deck returns default values for unspecified items.)
Expand Down Expand Up @@ -173,14 +186,34 @@ def deck2dfs(deck, start_date=None, unroll=True):

compsegs_df = pd.DataFrame(compsegsrecords)
welsegs_df = pd.DataFrame(welsegsrecords)
wsegsicd_df = pd.DataFrame(wsegsicdrecords)
wsegaicd_df = pd.DataFrame(wsegaicdrecords)

if unroll and not welsegs_df.empty:
welsegs_df = unrolldf(welsegs_df, "SEGMENT1", "SEGMENT2")

if unroll and not wsegsicd_df.empty:
wsegsicd_df = unrolldf(wsegsicd_df, "SEGMENT1", "SEGMENT2")

if unroll and not wsegaicd_df.empty:
wsegaicd_df = unrolldf(wsegaicd_df, "SEGMENT1", "SEGMENT2")

if "KEYWORD_IDX" in compdat_df.columns:
compdat_df.drop(["KEYWORD_IDX"], axis=1, inplace=True)

return dict(COMPDAT=compdat_df, COMPSEGS=compsegs_df, WELSEGS=welsegs_df)
if "KEYWORD_IDX" in wsegsicd_df.columns:
wsegsicd_df.drop(["KEYWORD_IDX"], axis=1, inplace=True)
Copy link
Collaborator

@berland berland Nov 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this drop is not done for WELSEGS and COMPSEGS, for which WSEGxICD are analogues. So potentially it should not be done for WSEx*ICD or it should also be done for WELSEGS and COMPSEGS?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, her har det skjedd noe feil. La meg sjekke litt og gjøre en pull-request til.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, WSEGxICD is analogous to COMPDAT with only one record, so I used COMPDAT as a template. WELSEGS and COMPSEGS have two records. KEYWORD_IDX is not defined in WELSEGS and COMPSEGS and therefore not dumped. If KEYWORD_IDX should have been defined/dumped for WELSEGS and COMPSEGS I think you should discuss with the developer for those keywords?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that sounds reasonable. Maybe that information should be included as a code comment.


if "KEYWORD_IDX" in wsegaicd_df.columns:
wsegaicd_df.drop(["KEYWORD_IDX"], axis=1, inplace=True)

return dict(
COMPDAT=compdat_df,
COMPSEGS=compsegs_df,
WELSEGS=welsegs_df,
WSEGSICD=wsegsicd_df,
WSEGAICD=wsegaicd_df,
)


def postprocess():
Expand Down
107 changes: 107 additions & 0 deletions ecl2df/opmkeywords/WSEGAICD
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"name": "WSEGAICD",
"sections": [
"SCHEDULE"
],
"items": [
{
"name": "WELL",
"value_type": "STRING"
},
{
"name": "SEGMENT1",
"value_type": "INT"
},
{
"name": "SEGMENT2",
"value_type": "INT"
},
{
"name": "STRENGTH",
"value_type": "DOUBLE"
},
{
"name": "LENGTH",
"value_type": "DOUBLE",
"default": 12.0
},
{
"name": "RHO_CAL",
"value_type": "DOUBLE",
"default": 1000.25
},
{
"name": "MU_CAL",
"value_type": "DOUBLE",
"default": 1.45
},
{
"name": "CRIT_WATFRAC",
"value_type": "DOUBLE"
},
{
"name": "WIDTH_WATFRAC",
"value_type": "DOUBLE"
},
{
"name": "MAX_RATIO",
"value_type": "DOUBLE",
"default": 5.0
},
{
"name": "SCALING",
"value_type": "INT",
"dimension": -1,
"default": 0
},
{
"name": "MAX_RATE",
"value_type": "DOUBLE"
},
{
"name": "VOLUME_RATE_EXP",
"value_type": "DOUBLE",
"default": 1.0
},
{
"name": "VISCOSITY_EXP",
"value_type": "DOUBLE",
"default": 1.0
},
{
"name": "FLAG",
"value_type": "STRING",
"default": "OPEN"
},
{
"name": "OIL_FRAC_EXP_DENS",
"value_type": "DOUBLE",
"default": 1.0
},
{
"name": "WATER_FRAC_EXP_DENS",
"value_type": "DOUBLE",
"default": 1.0
},
{
"name": "GAS_FRAC_EXP_DENS",
"value_type": "DOUBLE",
"default": 1.0
},
{
"name": "OIL_FRAC_EXP_VISC",
"value_type": "DOUBLE",
"default": 1.0
},
{
"name": "WATER_FRAC_EXP_VISC",
"value_type": "DOUBLE",
"default": 1.0
},
{
"name": "GAS_FRAC_EXP_VISC",
"value_type": "DOUBLE",
"default": 1.0
}
]
}
63 changes: 63 additions & 0 deletions ecl2df/opmkeywords/WSEGSICD
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"name": "WSEGSICD",
"sections": [
"SCHEDULE"
],
"items": [
{
"name": "WELL",
"value_type": "STRING"
},
{
"name": "SEGMENT1",
"value_type": "INT"
},
{
"name": "SEGMENT2",
"value_type": "INT"
},
{
"name": "STRENGTH",
"value_type": "DOUBLE"
},
{
"name": "LENGTH",
"value_type": "DOUBLE",
"default": 12.0
},
{
"name": "RHO_CAL",
"value_type": "DOUBLE",
"default": 1000.25
},
{
"name": "MU_CAL",
"value_type": "DOUBLE",
"default": 1.45
},
{
"name": "CRIT_WATFRAC",
"value_type": "DOUBLE",
"default": 0.5
},
{
"name": "WIDTH_WATFRAC",
"value_type": "DOUBLE",
"default": 0.05
},
{
"name": "SCALING",
"value_type": "INT",
"default": -1
},
{
"name": "MAX_RATE",
"value_type": "DOUBLE"
},
{
"name": "FLAG",
"value_type": "STRING",
"default": "OPEN"
}
]
}
Loading