Skip to content

fix: resolve xarray MultiIndex FutureWarning in build_renewable_profiles#2144

Open
FabianHofmann wants to merge 2 commits intomasterfrom
fix/multiindex-future-warning
Open

fix: resolve xarray MultiIndex FutureWarning in build_renewable_profiles#2144
FabianHofmann wants to merge 2 commits intomasterfrom
fix/multiindex-future-warning

Conversation

@FabianHofmann
Copy link
Copy Markdown
Contributor

@FabianHofmann FabianHofmann commented Apr 10, 2026

Changes proposed in this Pull Request

Fixes the FutureWarning from xarray about pandas MultiIndex when calling atlite's conversion functions in build_renewable_profiles.py:

FutureWarning: the `pandas.MultiIndex` object(s) passed as 'bus_bin' coordinate(s) 
will no longer be implicitly promoted and wrapped into multiple indexed coordinates...
  • Pass a RangeIndex to atlite instead of the bus_bin MultiIndex, then explicitly assign the MultiIndex coordinates on the result using xr.Coordinates.from_pandas_multiindex() before unstacking.
  • Remove redundant log messages that duplicate the timing-based info logs already present.

Note that atlite currently fails when directly passing the xr.Coordinate as it expects the index object to have a .name attribute. so this change is save for future xarray version, but we need to support xr.Coordinates in atlite in the first place.

Checklist

Required:

  • Changes are tested locally and behave as expected.
  • Code and workflow changes are documented.
  • A release note entry is added to doc/release_notes.rst.

If applicable:

  • N/A

Pass a RangeIndex to atlite instead of a MultiIndex and explicitly
assign MultiIndex coordinates using xr.Coordinates.from_pandas_multiindex
on the result. Also remove redundant log messages that duplicate the
timing-based info logs.
@FabianHofmann FabianHofmann requested review from coroa and fneum April 10, 2026 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant