flownet.data.compdat module

Extract COMPDAT, WELSEGS and COMPSEGS from an Eclipse deck

flownet.data.compdat.applywelopen(compdat_df: pandas.core.frame.DataFrame, welopen_df: pandas.core.frame.DataFrame) pandas.core.frame.DataFrame

Apply WELOPEN actions to the COMPDAT dataframe.

Each record in the WELOPEN keyword acts as an operator on existing connections in existing wells.

Example: COMPDAT and WELOPEN keyword:

COMPDAT
 'OP1' 33 44 10 11 'OPEN' /
 'OP2' 66 44 10 11 'OPEN' /
/
WELOPEN
 'OP1' SHUT /
 'OP2' SHUT 66 44 10 /
/

This deck would define two wells where OP1 and OP2 have two connected grid cells each. Although the COMPDAT defines all connections to be open, WELOPEN overwrites this: all connections in OP1 will be SHUT and in OP2 the upper connection will be SHUT.

WELOPEN can also be used at different dates and changes therefore the state of connections without explicit use of the COMPDAT keyword. This function translates WELOPEN actions into explicit additional COMPDAT definitions in the exported df.

Parameters
  • compdat_df – Dataframe with unrolled COMPDAT data

  • welopen_df – Dataframe with WELOPEN actions

Returns

Dataframe, compdat_df now including WELOPEN actions

flownet.data.compdat.compdat_main(args)

Entry-point for module, for command line utility

flownet.data.compdat.deck2dfs(deck: opm.io.Deck, start_date: Optional[Union[str, datetime.date]] = None, unroll: bool = True) Dict[str, pandas.core.frame.DataFrame]

Loop through the deck and pick up information found

The loop over the deck is a state machine, as it has to pick up dates and potential information from the WELSPECS keyword.

Parameters
  • deck – A deck representing the schedule Does not have to be a full Eclipse deck, an include file is sufficient

  • start_date – The default date to use for events where the DATE or START keyword is not found in advance. Default: None

  • unroll – Whether to unroll rows that cover a range, like K1 and K2 in COMPDAT and in WELSEGS. Defaults to True.

Returns

Dictionary with dataframes, at least for COMPDAT, COMPSEGS and WELSEGS.

flownet.data.compdat.df(eclfiles: ecl2df.eclfiles.EclFiles, initvectors: Optional[List[str]] = None) pandas.core.frame.DataFrame

Main function for Python API users

Supports only COMPDAT information for now. Will add a zone-name if a zonefile is found alongside

Returns

pd.Dataframe with one row pr cell to well connection

flownet.data.compdat.fill_parser(parser: argparse.ArgumentParser) argparse.ArgumentParser

Set up sys.argv parsers.

Parameters

parser – parser to fill with arguments

flownet.data.compdat.logger = <Logger flownet.data.compdat (WARNING)>

OPM authors and Roxar RMS authors have interpreted the Eclipse documentation ever so slightly different when naming the data.

For COMPDAT dataframe columnnames, we prefer the RMS terms due to the one very long one, and mixed-case in opm

flownet.data.compdat.postprocess()

Postprocessing of the compdat data, merging.

This function is NOT FINISHED

flownet.data.compdat.unrolldf(dframe: pandas.core.frame.DataFrame, start_column: str = 'K1', end_column: str = 'K2') pandas.core.frame.DataFrame

Unroll dataframes, where some column pairs indicate a range where data applies.

After unrolling, column pairs with ranges are transformed into multiple rows, with no ranges.

Example: COMPDAT supports K1, K2 intervals for multiple cells:

COMPDAT
  'OP1' 33 44 10 11 /
/

is transformed/unrolled so it would be equal to:

COMPDAT
  'OP1' 33 44 10 10 /
  'OP1' 33 44 11 11 /
/

The latter is easier to work with in Pandas dataframes

Parameters
  • dframe – Dataframe to be unrolled

  • start_column – Column name that contains the start of a range.

  • end (end_column Column name that contains the corresponding) – of the range.

Returns

Dataframe, unrolled version. Identical to input if none of rows had any ranges.