pyscal.plotting

Module for plotting relative permeability and capillary pressure curves.

Potential improvements:

Plotting low/base/high curves before interpolation

Plotting curve sets on the same plot, e.g. curves from different SATNUMs or low/base/high curves from a SCAL recommendation

Option to plot GasWater curves with Sg axis (instead of Sw; the Sg column is already present in the dataframe)

pyscal.plotting.format_cap_pressure_plot(fig, neg_pc=False, **kwargs)[source]

Formatting options for individual capillary pressure plots.

Parameters:
  • fig (plt.Figure) – Capillary pressure figure to be formatted

  • neg_pc (bool, optional) – Negative Pc flag. True if the Pc curve has a

  • False. (negative part. Defaults to) –

Returns:

Formatted capillary pressure figure

Return type:

plt.Figure

pyscal.plotting.format_gaswater_table(model)[source]

Format the tables held by the GasWater object (through the GasOil and WaterOil objects).

The GasWater object is a bit trickier to work with. Like WaterOilGas, GasWater takes from both WaterOil and GasOil objects, but unlike WaterOilGas, it is a two-phase model. It is based on one curve from GasOil, krg, and one curve from WaterOil, krw. This is a different format to the other models, where the relperm curves to be plotted in the same figure are found in the same table and are accessed easily using the “table” instance variable, e.g. WaterOil.table. To plot the correct curves for the GasWater model, additional formatting is required. That is handled by this function.

Process: sort both the GasOil and WaterOil tables by increasing SW and then merge on index. Can’t join on “SW” due to potential floating-point number errors.

Parameters:

model (GasWater) – GasWater model

Returns:

saturation table with Sw, Sg, krg from the GasOil instance, and krw and Pc from the WaterOil instance

Return type:

pd.DataFrame

pyscal.plotting.format_relperm_plot(fig, **kwargs)[source]

Formatting options for individual relative permeability plots.

Parameters:

fig (plt.Figure) – Relative permeability figure to be formatted

Returns:

Formatted relative permeability figure

Return type:

plt.Figure

pyscal.plotting.get_plot_config_options(curve_type, **kwargs)[source]

Get config data from plot config dictionary based on the curve (model) type.

Parameters:
  • curve_type (str) – Name of the curve type. Allowed types are given in

  • dictionary (the PLOT_CONFIG_OPTIONS) –

Returns:

Config parameters for the chosen model type

Return type:

dict

pyscal.plotting.get_satnum_from_tag(string)[source]

Get SATNUM from the model tag. Used in the naming of figures.

Parameters:

string (str) – String from the model .tag instance variable

Returns:

SATNUM number

Return type:

int

pyscal.plotting.go_plotter(model, **kwargs)[source]

Plot a GasOil model.

For a GasOil instance, the saturation table can be accessed using the “table” instance variable.

Parameters:

model (GasOil) – GasOil instance

Return type:

None

pyscal.plotting.gw_plotter(model, **kwargs)[source]

For GasWater, the format is different, and an additional formatting step is required. Use the formatted table as an argument to the plotter function, instead of the “table” instance variable

Parameters:

model (GasWater) – GasWater instance

Return type:

None

pyscal.plotting.plot_pc(table, satnum, **kwargs)[source]

Plot capillary pressure curves.

Called if the Pc plot is requested, regardless of if Pc is non-zero.

Parameters:
  • table (pd.DataFrame) – Saturation table with Pc curves to be plotted

  • satnum (int) – SATNUM number

Returns:

Pc figure with a single Pc curve for a given model and SATNUM

Return type:

plt.Figure

pyscal.plotting.plot_relperm(table, satnum, config, **kwargs)[source]

Function for plotting one relperm curve set for each SATNUM.

Takes kwargs from the plotter() function, which in turn come from the pyscal CLI, and are passed on to the plot formatting functions.

Parameters:
  • table (pd.DataFrame) – Saturation table with curves to be plotted

  • satnum (int) – SATNUM number

  • config (dict) – Plot config

Returns:

Relative permeability figure with two relative permeability curves for a given model and SATNUM

Return type:

plt.Figure

pyscal.plotting.plotter(models, pc=False, semilog=False, outdir='./')[source]

Runner function for creating plots.

Iterate over PyscalList and plot curves based on type of pyscal objects encountered.

PyscalList is a list of WaterOilGas, WaterOil, GasOil or GasWater objects.

For WaterOil and GasOil, the saturation table can be accessed using the “table” instance variable.

For WaterOilGas, the WaterOil and GasOil instances can be accessed, then the “table” instance variable.

For GasWater, the format is different, and an additional formatting step is required.

Parameters:
  • models (PyscalList) – List of models

  • pc (bool, optional) – Plot Pc flag. Defaults to False.

  • semilog (bool, optional) – Plot relperm with log y-axis. Defaults to

  • False.

Return type:

None

pyscal.plotting.save_figure(fig, satnum, config, plot_type, outdir)[source]

Save the provided figure.

Parameters:
  • fig (plt.Figure) – Figure to be saved

  • satnum (int) – SATNUM number

  • config (dict) – Plot config

  • plot_type (str) – Figure type. Allowed types are ‘relperm’ and ‘pc’

  • outdir (str) – Directory where the figure will be saved

Return type:

None

pyscal.plotting.wo_plotter(model, **kwargs)[source]

Plot a WaterOil model.

For a WaterOil instance, the saturation table can be accessed using the “table” instance variable.

Parameters:

model (WaterOil) – WaterOil instance

Return type:

None

pyscal.plotting.wog_plotter(model, **kwargs)[source]

Plot a WaterOilGas (WaterOil and GasOil) model.

For a WaterOilGas instance, the WaterOil and GasOil instances can be accessed, then the “table” instance variable.

Parameters:

model (WaterOilGas) – WaterOilGas instance

Return type:

None