-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enables production data from CSV file and fixes failing probability d…
…istribution test (#425) * Enables production data from CSV file * Adds config_parser changes and fixes black formatting * Fixes pylint * Fixes description CSVData class * Fixes probability distributions test * Updates documentation and CHANGELOG * Changes position of observation vectors entry in config file * Changes CI testdata branch for CI * Reverts CI back to equinor/master testdata branch and updates CHANGELOG
- Loading branch information
1 parent
3568b46
commit 9ffca96
Showing
9 changed files
with
354 additions
and
265 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from ..data import from_source | ||
|
||
from ..data.from_flow import FromSource, FlowData | ||
from ..data.from_csv import CSVData |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
from pathlib import Path | ||
from typing import Union | ||
|
||
import pandas as pd | ||
|
||
|
||
class CSVData: | ||
""" | ||
CSV data source class | ||
Args: | ||
input_data: Full path to CSV file to load production data from | ||
""" | ||
|
||
def __init__( | ||
self, | ||
input_data: Union[Path, str], | ||
): | ||
super().__init__() | ||
|
||
self._input_data: Path = Path(input_data) | ||
|
||
# pylint: disable=too-many-branches | ||
def _production_data(self) -> pd.DataFrame: | ||
""" | ||
Function to read production data for all producers and injectors from a CSV file. | ||
Returns: | ||
A DataFrame with a DateTimeIndex and the following columns: | ||
- date equal to index | ||
- WELL_NAME Well name as used in Flow | ||
- WOPR Well Oil Production Rate | ||
- WGPR Well Gas Production Rate | ||
- WWPR Well Water Production Rate | ||
- WOPT Well Cumulative Oil Production | ||
- WGPT Well Cumulative Gas Production | ||
- WWPT Well Cumulative Water Production | ||
- WBHP Well Bottom Hole Pressure | ||
- WTHP Well Tubing Head Pressure | ||
- WGIR Well Gas Injection Rate | ||
- WWIR Well Water Injection Rate | ||
- WSPR Well Salt Production Rate | ||
- WSIR Well Salt Injection Rate | ||
- WSPT Well Cumulative Salt Production | ||
- WSIT Well Cumulative Salt Injection | ||
- WSTAT Well status (OPEN, SHUT, STOP) | ||
- TYPE Well Type: "OP", "GP", "WI", "GI" | ||
- PHASE Main producing/injecting phase fluid: "OIL", "GAS", "WATER" | ||
Todo: | ||
* Remove depreciation warning suppression when solved in LibEcl. | ||
* Improve robustness pf setting of Phase and Type. | ||
""" | ||
df_production_data = pd.read_csv(self._input_data) | ||
df_production_data["date"] = pd.to_datetime(df_production_data["date"]).dt.date | ||
df_production_data = df_production_data.set_index("date", drop=False) | ||
return df_production_data | ||
|
||
@property | ||
def production(self) -> pd.DataFrame: | ||
"""dataframe with all production data""" | ||
return self._production_data() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters