frflib.forecast_methods.fit_forecast.fit_forecaster

This is module contains a generic forecaster associated to a fitter

Module Contents

Classes

FitForecaster

This a an abstract class to generate a forecast associated

class frflib.forecast_methods.fit_forecast.fit_forecaster.FitForecaster(data, **kwargs)

Bases: frflib.forecast_methods.abstract_forecast.AbstractForecast

This a an abstract class to generate a forecast associated to a fitter object (parametric regression fit)

Attributes:

To implement this abstract class, the following attributes needs to be defined:
  • fluids (List[string]): the fluids forecasted (e.g. [“oil”] or [“water”])

  • x_var (List[string]): name of the variable for pass to the fit function (e.g. [“oil_cum_mmbbl”])

Parameters:
  • min_fit_points – Minimal required number of data points to try to fit the data

  • max_val – maximum value to be used for fitting (outside this range will be clipped in output) - so far not filtered in input

  • min_val – minimum value to be used for fitting (outside this range will be clipped in output) - so far not filtered in input

  • fitter_param – extra arguments to pass to the fitter

well_fit(df_well)

Finds the best parameters based on R2 score

Parameters:
  • df_well – data frame containing well production data

  • curve – exp/harm/hyper

  • period – period for the fit

Return:fit_flag:

if data respects the minimum point check

Returns:

tuple of parameters of the fit

Returns:

r2 score

tuple_to_forecast_func(param: dict)

transform a tuple from well_fit into a forecasting function Q=f(Cum)

Parameters:

param (tuple) – popt tuple from well_fit

Returns:

forecasting function Q=f(Cum)

Return type:

function

extract_var_fit(df_well)

Extract x and y values from df_well to apply to fitter

check_validity(out)

Determine if a well_fit results is valid or not. Returns the result of the fitting by default, should be implemented in the child forecaster otherwise

get_well_forecast_func(wellname, fluid=None)

override to avoid use of storing functions

Parameters:
  • wellname

  • fluid

Returns:

valid_fit(wells, fit_out)

Register all valid well_fit outputs in respective dictionaries