Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
dcherian committed Nov 24, 2020
1 parent 8cca190 commit 762b570
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions xarray/core/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -2900,12 +2900,13 @@ def _rename_all(self, name_dict, dims_dict):
# in this case, convert to IndexVariable and set indexes
# GH4107
for name in set(self.dims):
indexvar = variables.pop(name).to_index_variable()
variables[name] = indexvar
if indexes is None:
indexes = dict()
indexes[name] = indexvar.to_index()
coord_names.add(name)
if name in variables:
indexvar = variables.pop(name).to_index_variable()
variables[name] = indexvar
if indexes is None:
indexes = dict()
indexes[name] = indexvar.to_index()
coord_names.add(name)

return variables, coord_names, dims, indexes

Expand Down Expand Up @@ -5806,6 +5807,7 @@ def filter_by_attrs(self, **kwargs):
Examples
--------
>>> # Create an example dataset:
...
>>> import numpy as np
>>> import pandas as pd
>>> import xarray as xr
Expand Down Expand Up @@ -5986,6 +5988,7 @@ def map_blocks(
... gb = da.groupby(groupby_type)
... clim = gb.mean(dim="time")
... return gb - clim
...
>>> time = xr.cftime_range("1990-01", "1992-01", freq="M")
>>> month = xr.DataArray(time.month, coords={"time": time}, dims=["time"])
>>> np.random.seed(123)
Expand Down

0 comments on commit 762b570

Please sign in to comment.