Skip to content

Commit

Permalink
Correct shutting in of last production well (#92)
Browse files Browse the repository at this point in the history
* Correct shutting in of last production well

* Test commit - no changes to master

* Test commit - no changes to master

* modified phase and type assignment

* remove cache

* undo remove cache

Co-authored-by: Wouter J. de Bruin <9119793+wouterjdb@users.noreply.github.com>
  • Loading branch information
olwijn and wouterjdb authored Aug 8, 2020
1 parent b7fece0 commit c02fd58
Showing 1 changed file with 17 additions and 10 deletions.
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

0 comments on commit c02fd58

Please sign in to comment.