title: Get a 3D or 4D array as input and reshape it to 2D array in a function from external script
body: <p>Okay, my question is a little more specific than reshaping a 3D or 4D array to a 2D array.</p>
  
  <p>I am writing a script for front end processing of 3D or 4D arrays.</p>
  
  <p>I want to call a function from an external script for which a 3D array will be supplied as the ONLY input. The desired output should be a 2D array.</p>
  
  <p>To elaborate even more, the 3D or 4D array will be of dimensions (x,y,t) or (x,y,z,t) where x,y,and z are spatial dimensions and t being the time. Basically this is how an unsteady flow data is contained.</p>
  
  <p>Now I want to reshape this into a 2D array with shape ([x*y*z, t]). However, this should be done with only the multidimensional array as the input. I wouldn't want to pass x,y,z, and t as input.</p>
  
  <p>Could someone help me write a function for this?</p>
  
  <p>Something like,</p>
  
  <p>def frontend(data):</p>
  
  <ul>
  <li>check data.shape</li>
  <li>obtain x,y,z,t values using len(data) commands</li>
  <li>reshape the data into ([x*y*z, t])</li>
  <li>return reshaped data</li>
  </ul>
  
  <p>UPDATE: I am sorry for not being very clear. The problem I am exactly having is about the shape. For example, I have 100 steps in the x direction, 50 steps in the y direction, 10 steps in the z direction, and 20 steps in the temporal direction. That is the array has dimensions ([100,50,10,20]). Now, I need to reshape this ([100,50,10,20]) array to ([50000,20]) array. This can be done with the normal 'reshape' command. Now, the problem is that, I am supplying only the data array into the function from an external script and I do not know its dimensions. I need to find the X dimension, Y dimension, Z dimension, and t dimension of the array, and then I need to reshape this 4D array into a 2D array with dimensions ([X*Y*Z, t]). Finally I have to get this 2D array as the output.</p>