Skip to content

Commit

Permalink
Update error message when saving multiindex (#7475)
Browse files Browse the repository at this point in the history
* update error message on saving multiindex

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Deepak Cherian <[email protected]>
  • Loading branch information
3 people authored Feb 24, 2023
1 parent ec1d328 commit 4194920
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions xarray/conventions.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,11 @@ def ensure_not_multiindex(var: Variable, name: T_Name = None) -> None:
if isinstance(var, IndexVariable) and isinstance(var.to_index(), pd.MultiIndex):
raise NotImplementedError(
"variable {!r} is a MultiIndex, which cannot yet be "
"serialized to netCDF files "
"(https://github.com/pydata/xarray/issues/1077). Use "
"reset_index() to convert MultiIndex levels into coordinate "
"variables instead.".format(name)
"serialized to netCDF files. Instead, either use reset_index() "
"to convert MultiIndex levels into coordinate variables instead "
"or use https://cf-xarray.readthedocs.io/en/latest/coding.html.".format(
name
)
)


Expand Down

0 comments on commit 4194920

Please sign in to comment.