Skip to content

Commit 8d168db

Browse files
authored
Point users to where in their code they should make mods for Dataset.dims (#8534)
* Point users to where in their code they should make mods for Dataset.dims Its somewhat annoying to get warnings that point to a line within a library where the warning is issued. It really makes it unclear what one needs to change. This points to the user's access of the `dims` attribute. * use emit_user_level_warning
1 parent 9acc411 commit 8d168db

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

xarray/core/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ class FrozenMappingWarningOnValuesAccess(Frozen[K, V]):
491491
__slots__ = ("mapping",)
492492

493493
def _warn(self) -> None:
494-
warnings.warn(
494+
emit_user_level_warning(
495495
"The return type of `Dataset.dims` will be changed to return a set of dimension names in future, "
496496
"in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, "
497497
"please use `Dataset.sizes`.",

0 commit comments

Comments
 (0)