title: How to select subset of 3D numpy array ending in a value?
body: <p>I have a 3D numpy array looks like this</p>
  
  <pre><code>shape(3,1000,100)
  
  [[[2,3,0,2,6,...,0,-1,-1,-1,-1,-1],
  [1,4,6,1,4,5,3,...,1,2,6,-1,-1],
  [7,4,6,3,1,0,1,...,2,0,8,-1,-1],
  ...
  [8,7,6,4,...,2,4,5,2,1,-1]],
  ...,
  [1,5,6,7,...,0,0,0,0,1]]]
  </code></pre>
  
  <p>Each lane of array end with 0 or multiple(less than 70 I'm sure) <strong>-1</strong>. </p>
  
  <p>For now, I want to select only 30 values before the <strong>-1</strong> for each lane, to make a subset of original numpy array with shape of <code>(3,1000,30)</code></p>
  
  <p>Should be similar like this,</p>
  
  <pre><code>[[[...,0],
      [...,1,2,6],
      [...,2,0,8],
      ...
      [...,2,4,5,2,1]],
      ...,
      [...,0,0,0,0,1]]]
  </code></pre>
  
  <p>Is it possible to do it with some numpy functions? Hope without a for loop:)</p>