import pandas as pd import xarray as xr from pathlib import Path file_path = Path("data/bayesian/l63_hm.nc") with xr.open_dataset(file_path) as dataset: metric = dataset["metric"] metric = metric.where(metric != -1) metric_mean = metric.mean(dim="random_seed", skipna=True) df = metric_mean.to_dataframe(name="metric").reset_index() print(df.head()) file_path_abc = Path("data/bayesian/l63_abc.nc") with xr.open_dataset(file_path_abc) as dataset: metric = dataset["metric"] metric = metric.where(metric != -1) metric_mean = metric.mean(dim="random_seed", skipna=True) df = metric_mean.to_dataframe(name="metric").reset_index() print(df.head())