<s> import subprocess <EOL> import numpy <EOL> import rasterio <EOL> from rasterio . features import sieve , shapes <EOL> with rasterio . drivers ( ) : <EOL> with rasterio . open ( '<STR_LIT>' ) as src : <EOL> shade = src . read ( <NUM_LIT:1> ) <EOL> print ( "<STR_LIT>" % len ( list ( shapes ( shade ) ) ) ) <EOL> sieved = sieve ( shade , <NUM_LIT> , out = numpy . zeros ( src . shape , src . dtypes [ <NUM_LIT:0> ] ) ) <EOL> print ( "<STR_LIT>" % len ( list ( shapes ( sieved ) ) ) ) <EOL> kwargs = src . meta <EOL> kwargs [ '<STR_LIT>' ] = kwargs . pop ( '<STR_LIT>' ) <EOL> with rasterio . open ( '<STR_LIT>' , '<STR_LIT:w>' , ** kwargs ) as dst : <EOL> dst . write ( sieved , indexes = <NUM_LIT:1> ) <EOL> print ( subprocess . check_output ( <EOL> [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) ) <EOL> subprocess . call ( [ '<STR_LIT>' , '<STR_LIT>' ] ) </s>
