petrelpy.petrel =============== .. py:module:: petrelpy.petrel .. autoapi-nested-parse:: Convert between Petrel and various other formats. Functions --------- .. autoapisummary:: petrelpy.petrel.write_header petrelpy.petrel.read_header petrelpy.petrel.collect_perfs petrelpy.petrel.export_perfs_ev petrelpy.petrel.export_perfs_prn petrelpy.petrel.read_production petrelpy.petrel.export_vol petrelpy.petrel.export_injection_vol petrelpy.petrel.convert_properties_petrel_to_arc petrelpy.petrel.read_petrel_tops petrelpy.petrel.write_tops petrelpy.petrel.get_raw_table Module Contents --------------- .. py:function:: write_header(df, fname, fill_na=-999) Write header information to a Petrel-readable header file. :param df: header information for wells (does not pass index) :type df: DataFrame :param fname: file to write to :type fname: str :param fill_na: value to write null values to, by default -999 :type fill_na: int, optional .. py:function:: read_header(fname: str) -> pandas.DataFrame Read headers from a file. .. py:function:: collect_perfs(df_perf: pandas.DataFrame) -> pandas.DataFrame Group perforations by well. :param df_perf: Well completion data. Expected columns include "Date Completion", "Date First Report", "Depth Top", "Depth Base" and "UWI" :type df_perf: pd.DataFrame :returns: Perforations grouped by well :rtype: pd.DataFrame .. py:function:: export_perfs_ev(perfs: pandas.DataFrame, output: pathlib.Path, header: str = 'UNITS FIELD\n') -> None Export perforations in ev (event file) format. :param perfs: contains perfs in columns for API,start_depth,stop_depth :type perfs: pd.DataFrame :param output: prn file to write to :type output: Path :param header: first line for file, probably explaining units :type header: str .. py:function:: export_perfs_prn(perfs: pandas.DataFrame, output: pathlib.Path) -> None Export perforations in prn (fixed) format. :param perfs: contains perfs in columns for API,start_depth,stop_depth :type perfs: pd.DataFrame :param output: prn file to write to :type output: Path .. py:function:: read_production(infile: str | tuple[str], yearly=False) Get raw data from infile (even if infile is several files). .. py:function:: export_vol(wells: pandas.DataFrame, outfile: str | pathlib.Path, header: str | None = None) Export production volumes to Petrel-readable .vol format file. :param wells: IHS-style wells dataframe with oil, water, and gas production. Expected columns are API,Date,Liquid,Water,Gas. :type wells: pd.DataFrame :param outfile: vol file to save to :type outfile: str | Path :param header: Units and column names. Defaults to None. :type header: str | None, optional .. py:function:: export_injection_vol(wells, outfile, header=None) Export injection volumes to Petrel-readable .vol format file. :param wells: IHS-style wells dataframe with water, and gas injection. Expected columns are API,Date,Water,Gas. :type wells: pd.DataFrame :param outfile: vol file to save to :type outfile: str | Path :param header: Units and column names. Defaults to None. :type header: str | None, optional .. py:function:: convert_properties_petrel_to_arc(fin, fout, prop) Make Midland basin Petrel gslib file Arc-readable. .. py:function:: read_petrel_tops(fname: str) -> pandas.DataFrame Read Petrel tops file. :param fname: path to file :type fname: str :returns: Tops, with Well indicating the well, then a column for each surface :rtype: pd.DataFrame .. py:function:: write_tops(df, fname, comments='', fill_na=-999) Write top picks to Petrel-readable file. :param df: tops picks. Expects "Well" to be first column, then a column per horizon :type df: DataFrame :param fname: Path to write out :type fname: str :param comments: Any comments to include at the beginning of the file, by default "" :type comments: str, optional :param fill_na: Value to assign nulls to, by default -999 :type fill_na: int, optional .. py:function:: get_raw_table(fname: str | pathlib.Path, sheetname: int | str = 0) -> pandas.DataFrame Ingest excel, prn, or csv file. :param fname: file to read :type fname: str :param sheetname: sheet to extract if excel. Defaults to 0. :type sheetname: int | str, optional :returns: table :rtype: pd.DataFrame