title: How to delete a certain range from a numpy array?
body: <p>I've got the following numpy array:</p>
  
  <pre><code>import numpy as np
  
  a = np.asarray([887, 895, 903, 911, 920, 928, 936,  
  944, 952, 961, 969, 977, 985, 905, 
  914, 924, 934, 944, 954, 965, 975, 986, 996, 1007])
  </code></pre>
  
  <p>The values constantly increase until <code>985</code> followed by a drop to <code>905</code>. From here on the values start to increase again.</p>
  
  <p>I need a function that detects this drop and deletes all array elements greater than the value it dropped to in such a way that the remaining values are still monotonically increasing (values to be deleted are bold):</p>
  
  <p>[887, 895, 903, <strong>911, 920, 928, 936,<br>
  944, 952, 961, 969, 977, 985,</strong> 905, 
  914, 924, 934, 944, 954, 965, 975, 986, 996, 1007]</p>
  
  <p>The desired outcome looks as follows:</p>
  
  <pre><code>[887, 895, 903, 905, 
  914, 924, 934, 944, 954, 965, 975, 986, 996, 1007]
  </code></pre>
  
  <p>How could I do this?</p>