title: Storing 2D array inside a larger 3D array
body: <p>I'm trying to store multiple 2D arrays (STAR) inside of a larger 3D array (called STACK) that can continue to grow in size.  I need STACK to be a global parameter that can be accessed by multiple functions at any time.  To do this I tried using <code>numpy.dstack()</code>  So far this is what my code looks like:</p>
  
  <pre><code>box_size = np.shape(star)[0]
  # The 2D array I'm trying to add to the STACK
  STAR = [[1, 1, 1, 1, 1],\
          [1, 1, 2, 1, 1],\
          [1, 2, 3, 2, 1],\
          [1, 1, 2, 1, 1],\
          [1, 1, 1, 1, 1,]]
  # Initialize STACK to be an empty array the same size as STAR
  STACK = np.zeros((2*(box_size/2)+1,2*(box_size/2)+1))
  
  # A function that appends STAR to STACK
  def add_Star(STAR):
      np.dstack((STACK,STAR))
  
  # Call the function
  add_Star(STAR)
  </code></pre>
  
  <p>However when I try to print the updated STACK, I get</p>
  
  <pre><code>[[ 0.  0.  0.  0.  0.]
   [ 0.  0.  0.  0.  0.]
   [ 0.  0.  0.  0.  0.]
   [ 0.  0.  0.  0.  0.]
   [ 0.  0.  0.  0.  0.]]
  </code></pre>
  
  <p>I don't know if I'm missing something obvious or completely misusing the function. </p>
  
  <p>To be clear, I'd like STACK to be a memory of every STAR I add to it.  That is, I'd like each STAR to be accessible in the STACK if I need, to say, remove it later.  In practice every STAR is going to be different, so simply adding STACK to STAR isn't going to work. </p>