netcdf4-python icon indicating copy to clipboard operation
netcdf4-python copied to clipboard

what to do when a variable is sliced with an all False Boolean index array?

Open jswhit opened this issue 3 years ago • 4 comments

Current behavior:

  1. for a 1D variable an empty array is returned
  2. for multi-dim variables an opaque exception is raised.
  3. for numpy arrays, an empty array is always returned

Two potential solutions:

  1. PR #1197: always return an exception with a more informative error message
  2. PR #1198: always silently return an empty array (as numpy does)

Which one do you prefer?

jswhit avatar Oct 12 '22 16:10 jswhit

@dopplershift @shoyer any thoughts on this?

jswhit avatar Oct 14 '22 14:10 jswhit

Returning the size zero array like NumPy feels like the right thing to do

shoyer avatar Oct 14 '22 15:10 shoyer

I agree, my lean was towards mirroring NumPy behavior.

dopplershift avatar Oct 14 '22 16:10 dopplershift

thanks - that's my thought as well. I will merge PR #1198 next week if we have no dissenting opinions by then.

jswhit avatar Oct 14 '22 17:10 jswhit