The docs for np.where() (https://numpy.org/doc/stable/reference/generated/numpy.where.html) suggest to prefer nonzero() over where() without x and y arguments. In the spirit of defensive programming I included np.asarray(cond) even where cond is already an array.
>>> a = np.array([None, None])
>>> a[a != None]
array([], dtype=object)
>>> a[a is not None]
array([[None, None]], dtype=object)
Unrelatedly, mark test_mt3d.py::test_mfnwt_keat_uzf() slow, it should not be included in smoke tests (this was causing the optional dependency CI tests to fail due to timeout). And clean up some unused imports in conftest.py.
The docs for
np.where()
(https://numpy.org/doc/stable/reference/generated/numpy.where.html) suggest to prefernonzero()
overwhere()
withoutx
andy
arguments. In the spirit of defensive programming I includednp.asarray(cond)
even wherecond
is already an array.This PR also fixes a bug I introduced in the model splitter in https://github.com/modflowpy/flopy/pull/2124: while E711 (https://www.flake8rules.com/rules/E711.html) dictates comparisons to
None
should use identity rather than equality, this rule should not be applied to NumPy array selection conditions as it will change the semantics:Unrelatedly, mark
test_mt3d.py::test_mfnwt_keat_uzf()
slow, it should not be included in smoke tests (this was causing the optional dependency CI tests to fail due to timeout). And clean up some unused imports inconftest.py
.