(var: Variable, name: T_Name = None)
| 52 | |
| 53 | |
| 54 | def ensure_not_multiindex(var: Variable, name: T_Name = None) -> None: |
| 55 | # only the pandas multi-index dimension coordinate cannot be serialized (tuple values) |
| 56 | if isinstance(var._data, indexing.PandasMultiIndexingAdapter): |
| 57 | if name is None and isinstance(var, IndexVariable): |
| 58 | name = var.name |
| 59 | if var.dims == (name,): |
| 60 | raise NotImplementedError( |
| 61 | f"variable {name!r} is a MultiIndex, which cannot yet be " |
| 62 | "serialized. Instead, either use reset_index() " |
| 63 | "to convert MultiIndex levels into coordinate variables instead " |
| 64 | "or use https://cf-xarray.readthedocs.io/en/latest/coding.html." |
| 65 | ) |
| 66 | |
| 67 | |
| 68 | def encode_cf_variable( |
no outgoing calls
no test coverage detected
searching dependent graphs…