polaris.tasks.ocean.horiz_press_grad.metrics.write_metric_dataset
- polaris.tasks.ocean.horiz_press_grad.metrics.write_metric_dataset(filename: str, resolution_km: ndarray, rms_error: dict[str, ndarray], y_name: str, y_units: str, fit: dict[str, ndarray] | None = None, slope: dict[str, float] | None = None, intercept: dict[str, float] | None = None) None[source]
Write the data used in a convergence plot to netCDF, one series per pressure-gradient scheme.
Series are written as separate variables suffixed with the scheme name rather than stacked along a scheme dimension, so that a file stays readable when the set of schemes changes and so that the two schemes’ fits can carry their own attributes.
- Parameters:
filename (str) – The netCDF file to write.
resolution_km (numpy.ndarray) – The horizontal resolutions in km.
rms_error (dict) – The error metric at each resolution, keyed by scheme.
y_name (str) – The variable name to give
rms_error, suffixed by the scheme.y_units (str) – The units of
rms_error.fit (dict, optional) – A fitted curve to include, keyed by scheme.
slope (dict, optional) – The fitted exponent per scheme, stored as global attributes.
intercept (dict, optional) – The fitted
log10intercept per scheme, stored as global attributes.