Suppose I have three arbitrary 1D arrays, for example:
x_p = np.array((1.0, 2.0, 3.0, 4.0, 5.0))
y_p = np.array((2.0, 3.0, 4.0))
z_p = np.array((8.0, 9.0))
<
For those who had to stay with numpy <1.7.x, here is a simple two-liner solution:
g_p=np.zeros((x_p.size, y_p.size, z_p.size))
array_you_want=array(zip(*[item.flatten() for item in \
[g_p+x_p[...,np.newaxis,np.newaxis],\
g_p+y_p[...,np.newaxis],\
g_p+z_p]]))
Very easy to expand to even higher dimenision as well. Cheers!