reservoirflow.utils.pyvista.save_gif#
- reservoirflow.utils.pyvista.save_gif(model, prop: str = 'pressures', label: str = None, boundary: bool = False, wells: bool = True, ruler: bool = False, desc: bool = False, info: bool = True, cbar: bool = True, title: str = None, cmap: str = 'Blues', gamma: float = 0.7, n_colors: int = 10, opacity: float = 0.9, azimuth: float = 45, elevation: float = 40, zoom: float = 1, fps: int = 10, file_name: str = 'grid_animated.gif', window_size: tuple = None, **kwargs)#
Saves pyvista show as gif
- Parameters:
prop (str, optional) – property to be visualized in [“pressures”, “rates”].
label (str) – label of grid centers as str in [‘id’, ‘coords’, ‘icoords’, ‘dx’, ‘dy’, ‘dz’, ‘Ax’, ‘Ay’, ‘Az’, ‘V’, ‘center’, ‘sphere’]. If None, this nothing will be added.
boundary (bool, optional) – include boundary cells.
wells (bool, optional) – show wells.
ruler (bool, optional) – show ruler grid lines.
info (bool, optional) – show simulation information.
cbar (bool, optional) – show color bar.
title (str, optional) – title shown at top-center of the Graph. If None, ReservoirFlow is shown.
cmap (str, optional) – color map name based on Matplotlib, see Choosing Colormaps in Matplotlib.
gamma (float, optional) – shift color map distribution to left when values less than 1 and to right when values larger than 1. In case of qualitative colormaps, this argument is ignored.
n_colors (int, optional) – number of colors. In case of qualitative colormaps, n_colors should not exceed the total number of available colors (e.g. 10 for cmap=”tab10” and 20 for cmap=”tab20”).
opacity (float, optional) – adjust transparency between 0 and 1 where 0 is fully transparent and 1 is fully nontransparent.
azimuth (float, optional) – adjust camera azimuth which is a horizontal rotation around the central focal point, see pyvista.Camera.
elevation (float, optional) –
adjust camera elevation which is a vertical rotation around the central focal point, see pyvista.Camera.
zoom (float, optional) – adjust camera zoom which is direct zooming into the central focal point. see pyvista.Camera.zoom.
fps (int, optional) – the number of frames per second starting at 1 and higher. Use this to control the speed of the gif image. Note that at some point, higher fps will not have affect on speed.
file_name (str, optional) – file name of the gif file (including the extension .gif).
window_size (tuple, optional) – pyvista plotter window size in pixels.
**kwargs – you can pass any argument for pyvista Plotter except if it is defined as argument in this function (e.g. window_size), see pyvista.Plotter.
- Raises:
ValueError – label is not recognized.
Warning
Jittering :
There is still jittering affect especially when a continues colors are used. In addition, the same affect appears on side 0 of cell 0 even with discretized colors. This is a common issue in pyvista also causing issus with color bar. So far there is no solution to this issue. The affect might be mitigated by using discretized colors or by making the first cell or layer nontransparent.
# making cell 0 nontransparent: base_cells = 0 # or layer 0: base_cells = model.grid.get_cells_i(boundary, True)[0, :, :] # add mesh: pl.add_mesh( grid_pv.extract_cells(base_cells), clim=limits, show_edges=True, opacity=1, lighting=True, colormap=colormap, show_scalar_bar=False, )