title: GDAL: GetMaximum and GetMinimum returns no values
body: <p>I am trying to get the maximum and minimum pixel values of a tif raster file.</p>
  
  <p>I am using the GetMaximum() and GetMinimum() methods but they return nothing, thus the error I get is: 
  <code>TypeError: unsupported operand type(s) for -: 'NoneType' and 'NoneType'</code></p>
  
  <p>The in file is a small tif raster for testing purposes. I do get the same error with other rasters that actually did work just a couple of days ago.</p>
  
  <p>This is what I have been trying:</p>
  
  <pre><code>from osgeo import gdal
  
  driver = gdal.GetDriverByName('GTiff')
  in_file = gdal.Open("L8_field.tif")
  band1 = in_file.GetRasterBand(1)
  barray = band1.ReadAsArray()
  
  # Getting the interval value and setting the classes
  max_value = band1.GetMaximum()
  min_value = band1.GetMinimum()
  
  tot_classes = 5
  class_1 = class_x + min_value
  class_x = (max_value - min_value) / tot_classes
  class_2 = (class_x * 2) + min_value
  class_3 = (class_x * 3) + min_value
  class_4 = (class_x * 4) + min_value
  class_5 = max_value
  ...
  </code></pre>
  
  <p>I'm using this to classify the raster. So there is more code that actually classifies it. This snippet is meant to grab the equal intervals. </p>
  
  <p>What am I missing? </p>