File tree Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -2993,19 +2993,20 @@ def isel(
2993
2993
# underlying array's shape and ndim since the dims are already
2994
2994
# cached by the Variable
2995
2995
var_dims = var .dims
2996
- # preserve variable order
2997
- if name in index_variables :
2998
- var = index_variables [name ]
2999
2996
# Fastpath, skip all this metadata analysis for variables
3000
2997
# with no dimensions
3001
- elif var_dims and (var_indexer_keys := all_keys .intersection (var_dims )):
3002
- var_indexers = {k : indexers [k ] for k in var_indexer_keys }
3003
- var = var .isel (var_indexers )
3004
- if drop and var .ndim == 0 and name in coord_names :
3005
- coord_names .remove (name )
3006
- continue
2998
+ if var_dims :
2999
+ # preserve variable order
3000
+ if name in index_variables :
3001
+ var = index_variables [name ]
3002
+ elif var_indexer_keys := all_keys .intersection (var_dims ):
3003
+ var_indexers = {k : indexers [k ] for k in var_indexer_keys }
3004
+ var = var .isel (var_indexers )
3005
+ if drop and var .ndim == 0 and name in coord_names :
3006
+ coord_names .remove (name )
3007
+ continue
3007
3008
variables [name ] = var
3008
- dims .update (zip (var . dims , var .shape ))
3009
+ dims .update (zip (var_dims , var .shape ))
3009
3010
3010
3011
return self ._construct_direct (
3011
3012
variables = variables ,
You can’t perform that action at this time.
0 commit comments