title: Reshape 1D numpy array to 3D with x,y,z ordering
body: <p>Say I have a 1D array of values corresponding to x, y, and z values like this:</p>
  
  <pre><code>x  y  z  arr_1D
  0  0  0  0
  1  0  0  1
  0  1  0  2
  1  1  0  3
  0  2  0  4
  1  2  0  5
  0  0  1  6
  ...
  0  2  3  22
  1  2  3  23
  </code></pre>
  
  <p>I want to get <code>arr_1D</code> into a 3D array <code>arr_3D</code> with shape <code>(nx,ny,nz)</code> (in this case <code>(2,3,4)</code>). I'd like to the values to be referenceable using <code>arr_3D[x_index, y_index, z_index]</code>, so that, for example, <code>arr_3D[1,2,0]=5</code>. Using <code>numpy.reshape(arr_1D, (2,3,4))</code> gives me a 3D matrix of the right dimensions, but not ordered the way I want. I know I can use the following code, but I'm wondering if there's a way to avoid the clunky nested for loops.</p>
  
  <pre><code>arr_1d = np.arange(24)
  nx = 2
  ny = 3
  nz = 4
  arr_3d = np.empty((nx,ny,nz))
  count = 0
  for k in range(nz):
      for j in range(ny):
          for i in range(nx):
              arr_3d[i,j,k] = arr_1d[count]
              count += 1
  
  print arr_3d[1,2,0]
  
  output: 5
  </code></pre>
  
  <p>What would be the most pythonic and/or fast way to do this? I'll typically want to do this for arrays of length on the order of 100,000.</p>