title: why am I getting negative values for bands 5, 6, and 7 after radiometric correction?
body: <p>I'm trying to radiometrically correct Landsat 8 imagery manually with Python; I'm using Rasterio and numpy arrays to modify the digital numbers of each band using the band multiplicative and additive values from the MTL file provided in LVL 1 collection 1 data but my values for the NIR SWIR1 and SWIR2 are coming out negative. </p>
  
  <pre><code> for x in B_list: 
      with rasterio.open(x,"r") as b:
          band=b.read(1)
          band_masked = numpy.ma.masked_array(band, mask=(band == 0))
          TOA_x=(.00002000*band_masked)+(-.100000)
          TOA=TOA_x/math.sin(sun_elevation)
          scaled=TOA*10000 # scale the numbers by 10000
          rad_cor_bands.append(scaled) # append the new rasters to a list
  </code></pre>
  
  <p>These are the results compared to ENVI FLAASH results:</p>
  
  <p>(MY RESULTS)</p>
  
  <p>{'min': 870.353812730424, 'max': 9149.756477515453, 'mean': 1282.322945234995, 'std': 320.7381911648936}</p>
  
  <p>{'min': 622.4013889713156, 'max': 10142.046235327802, 'mean': 1079.4094047219655, 'std': 350.35757713331907}</p>
  
  <p>{'min': 343.96497894172603, 'max': 11529.667689104577, 'mean': 896.144857921475, 'std': 378.5729920045608}</p>
  
  <p>{'min': 134.17754586770752, 'max': 11543.109446830142, 'mean': 742.6455972788715, 'std': 453.6422724804889}</p>
  
  <p>{'min': -110.65446984796611, 'max': 10970.634586553786, 'mean': 1557.865121879584, 'std': 1162.4318852778347}</p>
  
  <p>{'min': -82.33076606909405, 'max': 14530.300069949319, 'mean': 1092.5736223521078, 'std': 926.4220337052117}</p>
  
  <p>{'min': -41.045367340568724, 'max': 14530.300069949319, 'mean': 667.2732393332138, 'std': 626.3179561231228}</p>
  
  <p>(ENVI'S RESULTS)</p>
  
  <p>Band 1  859.540771  9036.083008 1266.391450 316.757106 </p>
  
  <p>Band 2  614.668823  10016.045898    1065.998458 346.008481</p>
  
  <p>Band 3  339.691589  11386.427734    885.012531  373.876933</p>
  
  <p>Band 4  132.510468  11399.702148    733.421884  448.012152</p>
  
  <p>Band 5  0.711042    10834.339844    1538.519843 1147.988763</p>
  
  <p>Band 6  0.236943    14349.781250    1078.952402 914.906030</p>
  
  <p>Band 7  1.896288    14349.781250    658.963308  618.535988</p>
  
  <p>The results from ENVI quickstats are displayed in the same order as they are in the dictionary I made for my numpy arrays. Does anyone know why I'm getting negative values for the NIR SWIR1 and SWIR2? all the other values are extremely similar to the ENVI Quick stats.</p>