@@ -420,6 +420,7 @@ class Dataset(Mapping, ImplementsDatasetReduce, DataWithCoords):
420420 "_file_obj" ,
421421 "_indexes" ,
422422 "_variables" ,
423+ "__weakref__" ,
423424 )
424425
425426 _groupby_cls = groupby .DatasetGroupBy
@@ -1783,7 +1784,7 @@ def _validate_indexers(
17831784 elif isinstance (v , Dataset ):
17841785 raise TypeError ("cannot use a Dataset as an indexer" )
17851786 elif isinstance (v , Sequence ) and len (v ) == 0 :
1786- v = IndexVariable ((k ,), np .zeros ((0 ,), dtype = "int64" ))
1787+ v = Variable ((k ,), np .zeros ((0 ,), dtype = "int64" ))
17871788 else :
17881789 v = np .asarray (v )
17891790
@@ -1797,16 +1798,13 @@ def _validate_indexers(
17971798 if v .ndim == 0 :
17981799 v = Variable ((), v )
17991800 elif v .ndim == 1 :
1800- v = IndexVariable ((k ,), v )
1801+ v = Variable ((k ,), v )
18011802 else :
18021803 raise IndexError (
18031804 "Unlabeled multi-dimensional array cannot be "
18041805 "used for indexing: {}" .format (k )
18051806 )
18061807
1807- if v .ndim == 1 :
1808- v = v .to_index_variable ()
1809-
18101808 indexers_list .append ((k , v ))
18111809
18121810 return indexers_list
@@ -2369,7 +2367,10 @@ def interp(
23692367 if kwargs is None :
23702368 kwargs = {}
23712369 coords = either_dict_or_kwargs (coords , coords_kwargs , "interp" )
2372- indexers = OrderedDict (self ._validate_indexers (coords ))
2370+ indexers = OrderedDict (
2371+ (k , v .to_index_variable () if isinstance (v , Variable ) and v .ndim == 1 else v )
2372+ for k , v in self ._validate_indexers (coords )
2373+ )
23732374
23742375 obj = self if assume_sorted else self .sortby ([k for k in coords ])
23752376
0 commit comments