title: ctypes python unpacking three dimensional array (3x3x48) array, matrix?
body: <p>Using ctypes, I can't seem to access the third dimension correctly in a 3-dim array(3x3x48) </p>
  
  <p>To test things, I created a ctypes array:</p>
  
  <pre><code>opsOUT =(((c_double * 3) *3)*48)()
  </code></pre>
  
  <p>In my real application, a Fortran routine returns the array full of data.  But for now I'm trying to debug things by simply printing out these zeros in python and assigning them to a python array:</p>
  
  <pre><code>def unload_ctypes_3x3x48_double(OUT):
  """Take a ctypes array and load it into a python array"""
  a = zeros((3,3,48),dtype=np_float)
  for i in range(3):
      for j in range(3):
          for k in range(48):
             print [i,j,k], OUT[i][j][k]                
             a[i,j,k] = OUT[i][j][k]
  return a
  </code></pre>
  
  <p>But </p>
  
  <pre><code>unload_ctypes_3x3x48_double(opsOUT)
  </code></pre>
  
  <p>gives</p>
  
  <pre><code>[0, 0, 0] 0.0
  [0, 0, 1] 0.0
  [0, 0, 2] 0.0
  [0, 0, 3]
  IndexError: invalid index
  </code></pre>
  
  <p>So k goes only to 2, and when it reaches 3 it gives the error, but it should go to 47</p>
  
  <p>Any ideas of how to fix this?</p>