title: Numpy.mean, amin, amax, std huge returns
body: <p>I am struggling working with large numpy arrays.  Here is the scenario.  I am working with 300MB - 950MB images and using GDAL to read them as Numpy arrays.  Reading in the array uses exactly as much memory as one would expect, ie. 250MB for a 250MB image, etc...</p>
  
  <p>My problem occurs when I use numpy to get the mean, min, max, or standard deviation.  In main() I open the image and read the array (type ndarray).  I then call the following function, to get the standard deviation, on a 2D array:</p>
  
  <pre><code>def get_array_std(input_array):
      array_standard_deviation = numpy.std(input_array, copy=False)
      return array_standard_deviation
  </code></pre>
  
  <p>Here I am constantly having memory errors (on a 6GB machine).  From the <a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.std.html" rel="nofollow">documentation</a> it looks like numpy is returning an ndarray with the same shape and dtype as my input, thereby doubling the in memory size.  </p>
  
  <p>Using:</p>
  
  <pre><code>print type(array_standard_deviation)
  </code></pre>
  
  <p>Returns:</p>
  
  <pre><code>numpy.float64
  </code></pre>
  
  <p>Additionally, using:</p>
  
  <pre><code>print array_standard_deviation
  </code></pre>
  
  <p>Returns a float std as one would expect.  Is numpy reading the array in again to perform this calculation?  Would I be better off iterating through the array and manually performing the calculation(s)?  How about working with a flattened array?</p>
  
  <p>I have tried placing each statistic call (numpy.amin(), numpy.amax(), numpy.std(), numpy.mean()) into their own function so that the large array would go out of scope, but no luck there.  I have also tried casting the return to another type, but no joy.</p>