You can add a new axis on the right using data_property[..., np.newaxis]
. Then the assignment can be done like this:
uncertainty[..., :3] = numpy.uint8(data_property * 255)[..., np.newaxis]
For example,
In [49]: x = np.arange(6).reshape(2,3)
In [50]: x
Out[50]:
array([[0, 1, 2],
[3, 4, 5]])
In [51]: y = np.zeros((2,3,4))
In [52]: y[...,:3] = x[...,np.newaxis]
In [53]: y
Out[53]:
array([[[ 0., 0., 0., 0.],
[ 1., 1., 1., 0.],
[ 2., 2., 2., 0.]],
[[ 3., 3., 3., 0.],
[ 4., 4., 4., 0.],
[ 5., 5., 5., 0.]]])
In [54]: np.allclose(y[...,0], x)
Out[54]: True
In [55]: np.allclose(y[...,1], x)
Out[55]: True
In [56]: np.allclose(y[...,2], x)
Out[56]: True