title: Mask ndarray based on conditions in different dimensions
body: <p>I have ndarray with the shape of (3,794,1255).
  I want to create mask based on the 2 first bands of the ndarray, so my output will be one array with x-y coordinates, with 0 for pixels that do not fullfill the 2 conditions and 1 for pixels that do fullfill the conditions.<br />
  For example, the conditions can be:</p>
  <pre><code>array.shape
  &gt;&gt;&gt;(3,794,1255)
  
  
  array[0]&gt;0.65
  0.2&lt;array[1]&lt;0.4
  
  
  mask = (array[0] &gt; 0.65) &amp; (0.2&lt;array[1]&lt;0.4)
  array[mask]
  
  
  </code></pre>
  <p>but that returns the error:</p>
  <blockquote>
  <p>IndexError: boolean index did not match indexed array along dimension
  0; dimension is 3 but corresponding boolean dimension is 794</p>
  </blockquote>
  <p><strong>My question is how can I create one mask layer based on two first dimensions of ndarray ? is there any better way to do this?</strong></p>