def get_completion_list(ECL_DATA_file_name): """ Create a datafram of unrolled well completions Args: Input DATA file name Returns: Tuple: List of unique well names List of completions associated to well names """ ECL_file = EclFiles(ECL_DATA_file_name) compdat_df = compdat.df(ECL_file) # Convert from ECL index compdat_df[["I", "J", "K1", "K2"]] = compdat_df[["I", "J", "K1", "K2"]] - 1 # Create tuples compdat_df["IJK"] = compdat_df[["I", "J", "K1"]].apply(tuple, axis=1) well_list = compdat_df["WELL"].unique().tolist() completion_list = [] for well in well_list: completion_list.append( compdat_df["IJK"].loc[compdat_df["WELL"] == well].to_list()) return completion_list, well_list
def test_df(): """Test main dataframe API, only testing that something comes out""" eclfiles = EclFiles(EIGHTCELLS) compdat_df = compdat.df(eclfiles) assert not compdat_df.empty assert "ZONE" in compdat_df assert "K1" in compdat_df assert "WELL" in compdat_df
def __init__( self, input_case: Union[Path, str], layers: Tuple = (), ): super().__init__() self._input_case: Path = Path(input_case) self._eclsum = EclSum(str(self._input_case)) self._init = EclFile(str(self._input_case.with_suffix(".INIT"))) self._grid = EclGrid(str(self._input_case.with_suffix(".EGRID"))) self._restart = EclFile(str(self._input_case.with_suffix(".UNRST"))) self._init = EclInitFile(self._grid, str(self._input_case.with_suffix(".INIT"))) self._wells = compdat.df(EclFiles(str(self._input_case))) self._layers = layers
def __init__( self, input_case: Union[Path, str], perforation_handling_strategy: str = "bottom_point", ): super().__init__() self._input_case: Path = Path(input_case) self._eclsum = EclSum(str(self._input_case)) self._init = EclFile(str(self._input_case.with_suffix(".INIT"))) self._grid = EclGrid(str(self._input_case.with_suffix(".EGRID"))) self._restart = EclFile(str(self._input_case.with_suffix(".UNRST"))) self._init = EclInitFile(self._grid, str(self._input_case.with_suffix(".INIT"))) self._wells = compdat.df(EclFiles(str(self._input_case))) self._perforation_handling_strategy: str = perforation_handling_strategy
def test_initmerging(): """Test that we can ask for INIT vectors to be merged into the data""" eclfiles = EclFiles(REEK) noinit_df = compdat.df(eclfiles) df = compdat.df(eclfiles, initvectors=[]) assert isinstance(df, pd.DataFrame) assert not df.empty df = compdat.df(eclfiles, initvectors=["FIPNUM", "EQLNUM", "SATNUM"]) assert "FIPNUM" in df assert "EQLNUM" in df assert "SATNUM" in df assert len(df) == len(noinit_df) df = compdat.df(eclfiles, initvectors="FIPNUM") assert "FIPNUM" in df assert len(df) == len(noinit_df) with pytest.raises(AssertionError): compdat.df(eclfiles, initvectors=2)