title: How to truncate a numpy array for values greater than a specified value?
body: <p>Similar to <a href="https://stackoverflow.com/questions/23227149/truncating-an-array">this Matlab question</a>, I am wondering how to truncate a numpy array by cutting off the values greater than a certain threshold value.  The values of the array in question are in ascending order.</p>
  
  <pre><code>import numpy as np
  a=np.linspace(1,10,num=10)
  truncatevalue = 5.5
  </code></pre>
  
  <p>How would I produce an array that has the values of <code>a</code> that are less than <code>truncatevalue</code> and would only include those values?  In this case, the resulting array would be</p>
  
  <pre><code>a_truncated=([1., 2., 3., 4., 5.])
  </code></pre>
  
  <p><strong>Bonus:</strong> I actually have two arrays I would like to truncate based on the values in one of the arrays.  </p>
  
  <pre><code>import numpy as np
  a=np.linspace(1,10,num=10)
  b=np.array([19, 17, 15, 14, 29, 33, 28, 4, 90, 6])
  truncatevalue = 5.5
  </code></pre>
  
  <p><code>b</code> is an arbitrary array, I just chose some numbers for a definite example.  I would like to truncate <code>b</code> in the same way that <code>a</code> gets truncated, so that the result would be</p>
  
  <pre><code>a_truncated=([1., 2., 3., 4., 5.])
  b_truncated=([19, 17, 15, 14, 29])
  </code></pre>
  
  <p>I don't know if it will be as simple as just repeating what needs to be done to get <code>a_truncated</code> or not, so I wanted to include it as well in case there is something different that needs to be done.</p>