During the investigation work into IMPROVER wind gusts I noticed an error in our nbhood plugin when using a more up to date environment than we use for production:
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.
It tripped me up a bit trying to work out what the problem was.
This error is a VisibleDeprecationWarning in our current environment which explains things better:
/improver/nbhood/nbhood.py:102: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
open_grid = np.array(np.ogrid[[slice(-x, x + 1) for x in (ranges, ranges)]])
To avoid tripping up on this again in the future this PR suggests we implement the change it requires now.
Description:
During the investigation work into IMPROVER wind gusts I noticed an error in our nbhood plugin when using a more up to date environment than we use for production:
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.
It tripped me up a bit trying to work out what the problem was. This error is a
VisibleDeprecationWarning
in our current environment which explains things better:To avoid tripping up on this again in the future this PR suggests we implement the change it requires now.
Testing: