fix: resolve xarray MultiIndex FutureWarning in build_renewable_profiles#2144
Open
FabianHofmann wants to merge 2 commits intomasterfrom
Open
fix: resolve xarray MultiIndex FutureWarning in build_renewable_profiles#2144FabianHofmann wants to merge 2 commits intomasterfrom
FabianHofmann wants to merge 2 commits intomasterfrom
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes proposed in this Pull Request
Fixes the
FutureWarningfrom xarray about pandas MultiIndex when calling atlite's conversion functions inbuild_renewable_profiles.py:RangeIndexto atlite instead of thebus_binMultiIndex, then explicitly assign the MultiIndex coordinates on the result usingxr.Coordinates.from_pandas_multiindex()before unstacking.Note that atlite currently fails when directly passing the xr.Coordinate as it expects the
indexobject to have a.nameattribute. so this change is save for future xarray version, but we need to support xr.Coordinates in atlite in the first place.Checklist
Required:
doc/release_notes.rst.If applicable: