resqpy.olio.wellspec_keywords.load_wellspecs

resqpy.olio.wellspec_keywords.load_wellspecs(wellspec_file: str, well: Optional[str] = None, column_list: Optional[List[str]] = [], keep_duplicate_cells: bool = False, keep_null_columns: bool = True, last_data_only: bool = True, usa_date_format: bool = False, return_dates_list: bool = False)[source]

Reads the Nexus wellspec file returning a dictionary of well name to pandas dataframe.

Parameters
  • wellspec_file (str) – file path of ascii input file containing wellspec keywords.

  • well (str, optional) – if present, only the data for the named well are loaded. If None, data for all wells are loaded.

  • column_list (List[str]/None) – if present, each dataframe returned contains these columns, in this order. If None, the resulting dictionary contains only well names as keys (each mapping to None rather than a dataframe). If an empty list (default), each dataframe contains the columns listed in the corresponding wellspec header, in the order found in the file.

  • keep_duplicate_cells (bool) – if True (default), duplicate cells are kept, otherwise only the last entry is kept.

  • keep_null_columns (bool) – if True (default), columns that contain all NA values are kept, otherwise they are removed.

  • last_data_only (bool) – If True, only the last entry of well data in the file are used in the dataframe, otherwise all of the well data are used at different times.

  • usa_date_format (bool) – If True, wellspec file is expected to contain date formats in MM/DD/YYYY. if False, DD/MM/YYYY.

  • return_dates_list (bool, default False) – if True, a sorted list of unique dates present in the wellspec file is also returned, with dates in iso format

Returns

well_dict (Dict[str, Union[pd.DataFrame, None]])

mapping each well name found in the

wellspec file to a dataframe containing the wellspec data

or (well_dict, dates_list): where dates list is a sorted list of all dates present in the

wellspec file (including those not relevant to a specific well), in iso format

Note

if return_dates_list is True, the returned list always contains all dates from the wellspec file that applied to any entry, regardless of the well and last_data_only arguments; the dates list will not include a null entry, even if there are wellspec data before the first timestamp