model_proxy_from_results#

model_proxy_from_results(ds)#

Create a lightweight model proxy from a self-contained results Dataset.

The proxy satisfies the interface required by plotting functions (plot_bmd(), plot_sfd(), etc.) so that results saved to NetCDF can be visualised without the original OspGrillage object.

Parameters:

ds (xarray.Dataset) – Dataset loaded via xarray.open_dataset(). Must contain a node_coordinates variable and member_elements / model_type attributes (added automatically by get_results()).

Returns:

A proxy object with get_nodes(), get_element(), and common_grillage_element_z_group matching the OspGrillage interface.

Raises:

KeyError – If the Dataset is missing the required geometry data.

Example:

import xarray as xr
import ospgrillage as og

ds = xr.open_dataset("results.nc")
proxy = og.model_proxy_from_results(ds)
og.plot_bmd(proxy, ds, backend="plotly")