uvisbox.Modules.ContourBoxplot.contour_boxplot
Module Contents
- uvisbox.Modules.ContourBoxplot.contour_boxplot.contour_boxplot(ensemble_images, isovalue, boxplot_style=None, ax=None, eps=0, workers=11, x_coords=None, y_coords=None)[source]
Create a contour boxplot visualization from an ensemble of scalar fields.
This function processes ensemble images by extracting binary contours at a given isovalue, computing their band depths, and visualizing the uncertainty using band envelopes.
- Parameters:
ensemble_images (np.ndarray) – 3D array of shape (n_ensemble, y_dim, x_dim) containing the ensemble scalar fields.
isovalue (float) – Threshold value for creating binary images. Pixels with values < isovalue are set to 1.
boxplot_style (BoxplotStyleConfig, optional) – Configuration for the boxplot visualization including percentiles, and median/outlier styling. If None, uses default configuration. The percentile_colormap is used for the band sum visualization.
ax (matplotlib.axes.Axes, optional) – Matplotlib Axes object to plot on. If None, a new figure and axes will be created.
eps (float, optional) – Epsilon tolerance for subset checks in band depth computation. With eps=0 (default), exact pixel-level containment is required, which can be too strict for continuously-varying rasterized contours. Values like 0.01-0.05 allow approximate containment.
workers (int, optional) – Number of parallel workers for band depth computation. Default is 11.
x_coords (np.ndarray, optional) – 1D array of x-axis coordinates defining the spatial domain. Length must match the image width. If None, pixel indices are used.
y_coords (np.ndarray, optional) – 1D array of y-axis coordinates defining the spatial domain. Length must match the image height. If None, pixel indices are used.
- Returns:
ax – The Axes object with the contour boxplot visualization.
- Return type:
matplotlib.axes.Axes
Examples
>>> # Basic usage with defaults >>> ensemble = np.random.randn(50, 100, 100) # 50 ensemble members >>> ax = contour_boxplot(ensemble, isovalue=0.5)
>>> # Custom styling >>> from uvisbox.Core.CommonInterface import BoxplotStyleConfig >>> style = BoxplotStyleConfig( ... percentiles=[25, 50, 75], ... percentile_colormap='hot', ... show_median=True, ... show_outliers=True ... ) >>> ax = contour_boxplot(ensemble, isovalue=0.5, boxplot_style=style)