title: Replace all elements of Python NumPy Array that are greater than some value
body: <p>I have a 2D NumPy array and would like to replace all values in it greater than or equal to a threshold T with 255.0. To my knowledge, the most fundamental way would be:</p>
  
  <pre><code>shape = arr.shape
  result = np.zeros(shape)
  for x in range(0, shape[0]):
      for y in range(0, shape[1]):
          if arr[x, y] &gt;= T:
              result[x, y] = 255
  </code></pre>
  
  <ol>
  <li><p>What is the most concise and pythonic way to do this?</p></li>
  <li><p>Is there a faster (possibly less concise and/or less pythonic) way to do this?</p></li>
  </ol>
  
  <p>This will be part of a window/level adjustment subroutine for MRI scans of the human head. The 2D numpy array is the image pixel data.</p>