File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -2842,24 +2842,22 @@ def set_coordinate_selection(
28422842 try :
28432843 from numcodecs .compat import ensure_ndarray_like
28442844
2845- value_array = ensure_ndarray_like (value ) # TODO replace with agnostic
2845+ value = ensure_ndarray_like (value ) # TODO replace with agnostic
28462846 except TypeError :
28472847 # Handle types like `list` or `tuple`
2848- value_array = np .array (value ) # TODO replace with agnostic
2848+ value = np .array (value ) # TODO replace with agnostic
28492849 if hasattr (value , "shape" ) and len (value .shape ) > 1 :
2850- value_array = np .array (value ).reshape (- 1 )
2850+ value = np .array (value ).reshape (- 1 )
28512851
2852- if indexer .sel_shape != value_array .shape :
2852+ if not is_scalar (value , self .dtype ) and (
2853+ isinstance (value , np .ndarray ) and indexer .shape != value .shape
2854+ ):
28532855 raise ValueError (
28542856 f"Attempting to set a selection of { indexer .sel_shape [0 ]} "
2855- f"elements with an array of { value_array .shape [0 ]} elements."
2857+ f"elements with an array of { value .shape [0 ]} elements."
28562858 )
28572859
2858- sync (
2859- self ._async_array ._set_selection (
2860- indexer , value_array , fields = fields , prototype = prototype
2861- )
2862- )
2860+ sync (self ._async_array ._set_selection (indexer , value , fields = fields , prototype = prototype ))
28632861
28642862 @_deprecate_positional_args
28652863 def get_block_selection (
You can’t perform that action at this time.
0 commit comments