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

Correct shutting in of last production well #92

Merged
merged 7 commits into from
Aug 8, 2020
Merged
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
27 changes: 17 additions & 10 deletions src/flownet/data/from_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,20 @@ def _production_data(self) -> pd.DataFrame:
df.loc[:, (df == 0).all(axis=0)] = np.nan

df["WELL_NAME"] = well_name
df_production_data = df_production_data.append(df)

df_production_data["PHASE"] = None
df_production_data.loc[df_production_data["WOPR"] > 0, "PHASE"] = "OIL"
df_production_data.loc[df_production_data["WWIR"] > 0, "PHASE"] = "WATER"
df_production_data.loc[df_production_data["WGIR"] > 0, "PHASE"] = "GAS"
df["PHASE"] = None
df.loc[df["WOPR"] > 0, "PHASE"] = "OIL"
df.loc[df["WWIR"] > 0, "PHASE"] = "WATER"
df.loc[df["WGIR"] > 0, "PHASE"] = "GAS"
df["TYPE"] = None
df.loc[df["WOPR"] > 0, "TYPE"] = "OP"
df.loc[df["WWIR"] > 0, "TYPE"] = "WI"
df.loc[df["WGIR"] > 0, "TYPE"] = "GI"
# make sure the correct well type is set also when the well is shut in
df[["PHASE", "TYPE"]] = df[["PHASE", "TYPE"]].fillna(method="backfill")
df[["PHASE", "TYPE"]] = df[["PHASE", "TYPE"]].fillna(method="ffill")

df_production_data = df_production_data.append(df)

if df_production_data["WSTAT"].isna().all():
warnings.warn(
Expand All @@ -190,14 +198,13 @@ def _production_data(self) -> pd.DataFrame:
}
)

df_production_data["TYPE"] = None
df_production_data.loc[df_production_data["WOPR"] > 0, "TYPE"] = "OP"
df_production_data.loc[df_production_data["WWIR"] > 0, "TYPE"] = "WI"
df_production_data.loc[df_production_data["WGIR"] > 0, "TYPE"] = "GI"

# ensure that a type is assigned also if a well is never activated
df_production_data[["PHASE", "TYPE"]] = df_production_data[
["PHASE", "TYPE"]
].fillna(method="backfill")
df_production_data[["PHASE", "TYPE"]] = df_production_data[
["PHASE", "TYPE"]
].fillna(method="ffill")

df_production_data["date"] = df_production_data.index
df_production_data["date"] = pd.to_datetime(df_production_data["date"]).dt.date
Expand Down