This is called an array slice. As noted in @ cᴏʟᴅs, it xis a 4D array, and it X[:,:,:,i]receives one specific fragment of a 3D array.
Maybe a smaller example might help.
matrix = np.arange(4).reshape((2,2))
In this case, it matrixis a two-dimensional array:
array([[0, 1],
[2, 3]])
Therefore, it matrix[:, 1]will lead to a smaller fragment matrix:
array([1, 3])
In the source code, matrix[:,:,:, 1]each of the first :means something like "all the elements in this dimension."
, numpy .