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 @@ -2995,19 +2995,20 @@ def isel(
2995
2995
# underlying array's shape and ndim since the dims are already
2996
2996
# cached by the Variable
2997
2997
var_dims = var .dims
2998
- # preserve variable order
2999
- if name in index_variables :
3000
- var = index_variables [name ]
3001
2998
# Fastpath, skip all this metadata analysis for variables
3002
2999
# with no dimensions
3003
- elif var_dims and (var_indexer_keys := all_keys .intersection (var_dims )):
3004
- var_indexers = {k : indexers [k ] for k in var_indexer_keys }
3005
- var = var .isel (var_indexers )
3006
- if drop and var .ndim == 0 and name in coord_names :
3007
- coord_names .remove (name )
3008
- continue
3000
+ if var_dims :
3001
+ # preserve variable order
3002
+ if name in index_variables :
3003
+ var = index_variables [name ]
3004
+ elif var_indexer_keys := all_keys .intersection (var_dims ):
3005
+ var_indexers = {k : indexers [k ] for k in var_indexer_keys }
3006
+ var = var .isel (var_indexers )
3007
+ if drop and var .ndim == 0 and name in coord_names :
3008
+ coord_names .remove (name )
3009
+ continue
3009
3010
variables [name ] = var
3010
- dims .update (zip (var . dims , var .shape ))
3011
+ dims .update (zip (var_dims , var .shape ))
3011
3012
3012
3013
return self ._construct_direct (
3013
3014
variables = variables ,
You can’t perform that action at this time.
0 commit comments