Oil and Gas

Gas density calculator

indsl.oil_and_gas.calculate_gas_density(pressure: Series, temperature: Series, sg: Series, align_timesteps: bool = False) Series

Gas density calculator.

The gas density is calculated from real gas laws.The psuedo critical tempreature and pressure is calculated from specific gravity following Sutton (1985). The Beggs and Brill (1973) method (explicit) is used to calculate the compressibility factor. All equations used here can be found in one place at Kareem et. al.. The gas equation Pv = zRT is used to calculate the gas density.

Parameters:
  • pressure – Pressure [psi]. Pressure time series in psi units.

  • temperature – Temperature [degF]. Temperature time series in degrees Fahrenheit units.

  • sg – Specific gravity [-]. Specific gravity of the gas.

  • align_timesteps – Auto-align Automatically align time stamp of input time series. Default is False.

Returns:

Gas density [lbm/ft3]

Estimated gas density in pound-mass per cubic foot (pcf).

Return type:

pandas.Series

Raises:

UserValueError – When all values of the pressure and temperature are out of range for calculating compressibility.

Productivity index

indsl.oil_and_gas.productivity_index(p_res: Series, p_bh: Series, Q_gas: Series, align_timesteps: bool = False) Series

Productivity Index.

The productivity index or PI is defined as the gas flow rate at the well divided by the difference in pressure between the reservoir and bottom hole. If no data is available for any of the inputs for a specific timestamp, then it will be ignored.

Parameters:
  • p_res – Reservoir pressure.

  • p_bh – Bottomhole pressure.

  • Q_gas – Gas flowrate.

  • align_timesteps – Auto-align. Automatically align time stamp of input time series. Default is False.

Returns:

Productivity index.

Return type:

pandas.Series

Raises:

RuntimeError – If any input time series has no data, then PI can’t be computed for any timestamps.

Shut-in detector

indsl.oil_and_gas.calculate_shutin_interval(shut_valve: Series, min_shutin_len: float = 6, min_time_btw_shutins: float = 1, shutin_state_below_threshold: bool = True, shutin_threshold: float | None = None) Series

Shut-in interval.

The shut-in interval is defined as the period when the valve is in closed state. The close state is determined based on the calculated manually-given threshold. The threshold is calculated based on the analysis of the valve signal histogram.

Parameters:
  • shut_valve – Shut-in valve. Time series with the shut-in valve opening.

  • min_shutin_len – Minimum time. Minimum shut-in length in hours to be considered for detection.

  • min_time_btw_shutins – Time between. Minimum time between consecutive shut-ins in hours to validate change of state.

  • shutin_state_below_threshold – Below threshold. Indicator to tell the algorithm if the shut-in state is below the threshold.

  • shutin_threshold – Threshold. Threshold between the valve open and close states. Defaults to None, meaning that the threshold is calculated.

Returns:

Shut-in periods. Binary time series indicating open state or closed state: Open state= 1, Close state = 0.

Return type:

pandas.Series

Raises:

RuntimeError – If threshold cannot be determined in the evaluation window, the user is asked to increase the evaluation period. Recommended period is 30 days.

Shut-in variable calculator

indsl.oil_and_gas.calculate_shutin_variable(variable_signal: Series, shutin_signal: Series, hrs_after_shutin: float) Series

Shut-in variable calculator.

The shut-in variable calculator is a function to compute the variable of interest at specific times after the shut-in onset. Typically, variables of interest are pressure and temperature. The function is the dependency of the shut-in detector. Based on the detected shut-in interval, the function uses specified number of hours indicating the time after the onset of each shut-in. It calculates the variable of interest at that time instance using interpolation (method - time).

Parameters:
  • variable_signal – Signal of interest. Typically pressure or temperature signal.

  • shutin_signal – Shut-in signal. The signal comes from a shut-in detector function or a signal indicating shut-in condition (0 - well in shut-in state, 1 - well in flowing state). We suggest using the indsl.oil_and_gas.calculate_shutin_interval().

  • hrs_after_shutin – Hours after. Hours after shut-in onset at which to calculate the signal of interest.

Returns:

Output. Signal of interest at specific time after shut-in onset.

Return type:

pandas.Series

Well production status

indsl.oil_and_gas.calculate_well_prod_status(master_valve: Series, wing_valve: Series, choke_valve: Series, threshold_master: float = 1, threshold_wing: float = 1, threshold_choke: float = 5, align_timesteps: bool = False) Series

Check if the well is producing.

Determine if the well is producing. In order for this to be the case, the following has to happen:

  • All Master, Wing and Choke data have to come from the same well.

  • Check if the master, wing and choke valve openings are above their respective threshold values at a given time.

  • If any of the valves are below the threshold opening, then the well is closed.

  • If all of the valves are above the threshold opening, then the well is open.

  • Threshold values should be between 0-100.

Parameters:
  • master_valve – Master Valve Time series of the master valve.

  • wing_valve – Wing Valve Time series of the wing valve.

  • choke_valve – Choke Valve Time series of the choke valve.

  • threshold_master – Master threshold Threshold percentage value from 0%-100%.

  • threshold_wing – Wing threshold Threshold percentage value from 0%-100%.

  • threshold_choke – Choke threshold Threshold percentage value from 0%-100%.

  • align_timesteps – Auto-align Automatically align time stamp of input time series. Default is False.

Returns:

Well Status

Well production status (1 means open, 0 means closed).

Return type:

pandas.Series

Retrieve fluid properties

indsl.oil_and_gas.live_fluid_properties.retrieve_fluid_properties(pressure: Series, temperature: Series, pvt_data: DataFrame, param: str, interp_method: Literal['linear', 'nearest', 'cubic'] = 'linear') Series

Retrieve fluid properties.

This function obtains the value for the selected fluid property (param) corresponding to the pressure/temp pairs input as series. The input fluid file type is a .tab file that is an output of an equation of state simulator (i.e PVTSim, MultiFlash) and is an input file specifically for OLGA. The 31 fluid property parameters included in the .tab file are the options as an output for this function. Note that pressure and temperature sensors have to come from the same location.

Parameters:
  • pressure – Pressure time series.

  • temperature – Temperature time series.

  • pvt_data – PVT data. This is a PVT table that has been parsed out from a .tab file which is a standardized generated output of MultiFlash and PVTSim.

  • param – Fluid parameter of interest. Fluid property to be estimated.

  • interp_method – Method. The method used to interpolate the pvt table to obtain fluid properties of a given pressure and temperature.

Returns:

Time series

Fluid property of selected fluid property (“param”) for corresponding pressure and temperature sensors. There are 31 fluid properties currently available to output from the fluid file.

Return type:

pandas.Series

Raises:
  • AssertionError – If data in sequence is not from a .tab file.

  • AssertionError – If param input is not one of the 31 fluid properties available.

  • Exception – If the range of the pressure and temperature sensor is outside the pvt table window, the function

  • cannot interpolate for fluid property parameters.