title: Reclassifying image creates unwanted artifacts
body: <p>I have a lot of (Sentinel-2) raster cloudcover-images, which I would like to reclassify. It should assign each cell either a 1 or a 0, depending if the value is higher than <code>var</code> or not. It mostly works, except for a few (seemingly random) cells that get the value 2.</p>
  <p>My code:</p>
  <pre><code>import rasterio as rio
  
  def Reclassify(path_in, path_out):
      
      # path_in = full path to image which should be reclassified
      # path_out = output location for the reclassified file
      var = 40  # Value that decides the border between cloud/no cloud
  
      with rio.open(path_in) as src:
          
          array = src.read()
          profile = src.profile
  
          # Reclassify
          array[np.where(array &lt; var)] = 0  # No clouds
          array[np.where(array &gt;= var)] = 1  # Clouds
          
      with rio.open(path_out, 'w', **profile) as dst:
          # Save changes
          dst.write(array)
  </code></pre>
  <p>The 2's are seemingly random, but they do appear at the exact same places everytime I run the code.</p>
  <p>Result loaded in QGIS below:
  <a href="https://i.stack.imgur.com/uJJFL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uJJFL.png" alt="Result in QGIS" /></a></p>