From 53a2c72d60f0e0e9888921a6542ca526843d3cab Mon Sep 17 00:00:00 2001 From: "Oriol (ZBook)" Date: Wed, 25 Jan 2023 00:41:03 +0100 Subject: [PATCH 1/2] update error message on saving multiindex --- xarray/conventions.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/xarray/conventions.py b/xarray/conventions.py index 908180270bc..f015628e7a4 100644 --- a/xarray/conventions.py +++ b/xarray/conventions.py @@ -205,10 +205,9 @@ 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) ) From dc9441a85004fee79f3240b4d0c281cf1280e313 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 24 Jan 2023 23:45:27 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- xarray/conventions.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xarray/conventions.py b/xarray/conventions.py index f015628e7a4..fa90626a0ff 100644 --- a/xarray/conventions.py +++ b/xarray/conventions.py @@ -207,7 +207,9 @@ def ensure_not_multiindex(var: Variable, name: T_Name = None) -> None: "variable {!r} is a MultiIndex, which cannot yet be " "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) + "or use https://cf-xarray.readthedocs.io/en/latest/coding.html.".format( + name + ) )