Skip to content

Commit

Permalink
directly returning a xr dataset when loading from netcdf file
Browse files Browse the repository at this point in the history
  • Loading branch information
jenshnielsen committed Jan 16, 2024
1 parent aa69eda commit 772dad1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/qcodes/dataset/data_set_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,18 @@ def load_data_from_db(self) -> None:
)


def to_xarray_dataset(
self, *, use_multi_index: Literal["auto", "always", "never"] = "auto"
) -> xr.Dataset:
if use_multi_index == "always":
ds = self._xr_dataset.stack()
elif use_multi_index == "never":
ds = self._xr_dataset.unstack()
else:
ds = self._xr_dataset
return ds


class DataSetCacheWithDBBackend(DataSetCache["DataSet"]):
def load_data_from_db(self) -> None:
"""
Expand Down

0 comments on commit 772dad1

Please sign in to comment.