<s> import sys <EOL> import os <EOL> import logging <EOL> import click <EOL> import numpy <EOL> from click . testing import CliRunner <EOL> from pytest import fixture <EOL> import rasterio <EOL> from rasterio . rio . merge import merge <EOL> from rasterio . transform import Affine <EOL> logging . basicConfig ( stream = sys . stderr , level = logging . DEBUG ) <EOL> @ fixture ( scope = '<STR_LIT>' ) <EOL> def test_data_dir_1 ( tmpdir ) : <EOL> kwargs = { <EOL> "<STR_LIT>" : { '<STR_LIT>' : '<STR_LIT>' } , <EOL> "<STR_LIT>" : ( - <NUM_LIT> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , - <NUM_LIT> ) , <EOL> "<STR_LIT:count>" : <NUM_LIT:1> , <EOL> "<STR_LIT>" : rasterio . uint8 , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT:width>" : <NUM_LIT:10> , <EOL> "<STR_LIT>" : <NUM_LIT:10> , <EOL> "<STR_LIT>" : <NUM_LIT:1> <EOL> } <EOL> with rasterio . open ( str ( tmpdir . join ( '<STR_LIT>' ) ) , '<STR_LIT:w>' , ** kwargs ) as dst : <EOL> data = numpy . ones ( ( <NUM_LIT:10> , <NUM_LIT:10> ) , dtype = rasterio . uint8 ) <EOL> data [ <NUM_LIT:0> : <NUM_LIT:6> , <NUM_LIT:0> : <NUM_LIT:6> ] = <NUM_LIT:255> <EOL> dst . write ( data , indexes = <NUM_LIT:1> ) <EOL> with rasterio . open ( str ( tmpdir . join ( '<STR_LIT>' ) ) , '<STR_LIT:w>' , ** kwargs ) as dst : <EOL> data = numpy . ones ( ( <NUM_LIT:10> , <NUM_LIT:10> ) , dtype = rasterio . uint8 ) <EOL> data [ <NUM_LIT:4> : <NUM_LIT:8> , <NUM_LIT:4> : <NUM_LIT:8> ] = <NUM_LIT> <EOL> dst . write ( data , indexes = <NUM_LIT:1> ) <EOL> return tmpdir <EOL> @ fixture ( scope = '<STR_LIT>' ) <EOL> def test_data_dir_2 ( tmpdir ) : <EOL> kwargs = { <EOL> "<STR_LIT>" : { '<STR_LIT>' : '<STR_LIT>' } , <EOL> "<STR_LIT>" : ( - <NUM_LIT> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , - <NUM_LIT:0.1> ) , <EOL> "<STR_LIT:count>" : <NUM_LIT:1> , <EOL> "<STR_LIT>" : rasterio . uint8 , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT:width>" : <NUM_LIT:10> , <EOL> "<STR_LIT>" : <NUM_LIT:10> <EOL> } <EOL> with rasterio . open ( str ( tmpdir . join ( '<STR_LIT>' ) ) , '<STR_LIT:w>' , ** kwargs ) as dst : <EOL> data = numpy . zeros ( ( <NUM_LIT:10> , <NUM_LIT:10> ) , dtype = rasterio . uint8 ) <EOL> data [ <NUM_LIT:0> : <NUM_LIT:6> , <NUM_LIT:0> : <NUM_LIT:6> ] = <NUM_LIT:255> <EOL> dst . write ( data , indexes = <NUM_LIT:1> ) <EOL> with rasterio . open ( str ( tmpdir . join ( '<STR_LIT>' ) ) , '<STR_LIT:w>' , ** kwargs ) as dst : <EOL> data = numpy . zeros ( ( <NUM_LIT:10> , <NUM_LIT:10> ) , dtype = rasterio . uint8 ) <EOL> data [ <NUM_LIT:4> : <NUM_LIT:8> , <NUM_LIT:4> : <NUM_LIT:8> ] = <NUM_LIT> <EOL> dst . write ( data , indexes = <NUM_LIT:1> ) <EOL> return tmpdir <EOL> def test_merge_with_nodata ( test_data_dir_1 ) : <EOL> outputname = str ( test_data_dir_1 . join ( '<STR_LIT>' ) ) <EOL> inputs = [ str ( x ) for x in test_data_dir_1 . listdir ( ) ] <EOL> inputs . sort ( ) <EOL> runner = CliRunner ( ) <EOL> result = runner . invoke ( merge , inputs + [ outputname ] ) <EOL> assert result . exit_code == <NUM_LIT:0> <EOL> assert os . path . exists ( outputname ) <EOL> with rasterio . open ( outputname ) as out : <EOL> assert out . count == <NUM_LIT:1> <EOL> data = out . read ( <NUM_LIT:1> , masked = False ) <EOL> expected = numpy . ones ( ( <NUM_LIT:10> , <NUM_LIT:10> ) , dtype = rasterio . uint8 ) <EOL> expected [ <NUM_LIT:0> : <NUM_LIT:6> , <NUM_LIT:0> : <NUM_LIT:6> ] = <NUM_LIT:255> <EOL> expected [ <NUM_LIT:4> : <NUM_LIT:8> , <NUM_LIT:4> : <NUM_LIT:8> ] = <NUM_LIT> <EOL> assert numpy . all ( data == expected ) <EOL> def test_merge_warn ( test_data_dir_1 ) : <EOL> outputname = str ( test_data_dir_1 . join ( '<STR_LIT>' ) ) <EOL> inputs = [ str ( x ) for x in test_data_dir_1 . listdir ( ) ] <EOL> inputs . sort ( ) <EOL> runner = CliRunner ( ) <EOL> result = runner . invoke ( merge , inputs + [ outputname ] + [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> assert result . exit_code == <NUM_LIT:0> <EOL> assert os . path . exists ( outputname ) <EOL> assert "<STR_LIT>" in result . output <EOL> def test_merge_without_nodata ( test_data_dir_2 ) : <EOL> outputname = str ( test_data_dir_2 . join ( '<STR_LIT>' ) ) <EOL> inputs = [ str ( x ) for x in test_data_dir_2 . listdir ( ) ] <EOL> inputs . sort ( ) <EOL> runner = CliRunner ( ) <EOL> result = runner . invoke ( merge , inputs + [ outputname ] ) <EOL> assert result . exit_code == <NUM_LIT:0> <EOL> assert os . path . exists ( outputname ) <EOL> with rasterio . open ( outputname ) as out : <EOL> assert out . count == <NUM_LIT:1> <EOL> data = out . read ( <NUM_LIT:1> , masked = False ) <EOL> expected = numpy . zeros ( ( <NUM_LIT:10> , <NUM_LIT:10> ) , dtype = rasterio . uint8 ) <EOL> expected [ <NUM_LIT:0> : <NUM_LIT:6> , <NUM_LIT:0> : <NUM_LIT:6> ] = <NUM_LIT:255> <EOL> expected [ <NUM_LIT:4> : <NUM_LIT:8> , <NUM_LIT:4> : <NUM_LIT:8> ] = <NUM_LIT> <EOL> assert numpy . all ( data == expected ) <EOL> def test_merge_output_exists ( tmpdir ) : <EOL> outputname = str ( tmpdir . join ( '<STR_LIT>' ) ) <EOL> runner = CliRunner ( ) <EOL> result = runner . invoke ( <EOL> merge , <EOL> [ '<STR_LIT>' , outputname ] ) <EOL> assert result . exit_code == <NUM_LIT:0> <EOL> result = runner . invoke ( <EOL> merge , <EOL> [ '<STR_LIT>' , outputname ] ) <EOL> assert os . path . exists ( outputname ) <EOL> with rasterio . open ( outputname ) as out : <EOL> assert out . count == <NUM_LIT:3> <EOL> def test_merge_output_exists_without_nodata_fails ( test_data_dir_2 ) : <EOL> """<STR_LIT>""" <EOL> runner = CliRunner ( ) <EOL> result = runner . invoke ( <EOL> merge , <EOL> [ str ( test_data_dir_2 . join ( '<STR_LIT>' ) ) , <EOL> str ( test_data_dir_2 . join ( '<STR_LIT>' ) ) ] ) <EOL> assert result . exit_code == <NUM_LIT:1> <EOL> def test_merge_output_exists_without_nodata ( test_data_dir_2 ) : <EOL> """<STR_LIT>""" <EOL> runner = CliRunner ( ) <EOL> result = runner . invoke ( <EOL> merge , <EOL> [ '<STR_LIT>' , str ( test_data_dir_2 . join ( '<STR_LIT>' ) ) , <EOL> str ( test_data_dir_2 . join ( '<STR_LIT>' ) ) ] ) <EOL> assert result . exit_code == <NUM_LIT:0> <EOL> def test_merge_err ( ) : <EOL> runner = CliRunner ( ) <EOL> result = runner . invoke ( <EOL> merge , <EOL> [ '<STR_LIT>' ] ) <EOL> assert result . exit_code == <NUM_LIT:1> <EOL> def test_format_jpeg ( tmpdir ) : <EOL> outputname = str ( tmpdir . join ( '<STR_LIT>' ) ) <EOL> runner = CliRunner ( ) <EOL> result = runner . invoke ( <EOL> merge , <EOL> [ '<STR_LIT>' , outputname , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> assert result . exit_code == <NUM_LIT:0> <EOL> assert os . path . exists ( outputname ) <EOL> @ fixture ( scope = '<STR_LIT>' ) <EOL> def test_data_dir_overlapping ( tmpdir ) : <EOL> kwargs = { <EOL> "<STR_LIT>" : { '<STR_LIT>' : '<STR_LIT>' } , <EOL> "<STR_LIT>" : ( - <NUM_LIT> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , - <NUM_LIT> ) , <EOL> "<STR_LIT:count>" : <NUM_LIT:1> , <EOL> "<STR_LIT>" : rasterio . uint8 , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT:width>" : <NUM_LIT:10> , <EOL> "<STR_LIT>" : <NUM_LIT:10> , <EOL> "<STR_LIT>" : <NUM_LIT:0> <EOL> } <EOL> with rasterio . open ( str ( tmpdir . join ( '<STR_LIT>' ) ) , '<STR_LIT:w>' , ** kwargs ) as dst : <EOL> data = numpy . ones ( ( <NUM_LIT:10> , <NUM_LIT:10> ) , dtype = rasterio . uint8 ) <EOL> dst . write ( data , indexes = <NUM_LIT:1> ) <EOL> kwargs [ '<STR_LIT>' ] = ( - <NUM_LIT> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , - <NUM_LIT> ) <EOL> with rasterio . open ( str ( tmpdir . join ( '<STR_LIT>' ) ) , '<STR_LIT:w>' , ** kwargs ) as dst : <EOL> data = numpy . ones ( ( <NUM_LIT:10> , <NUM_LIT:10> ) , dtype = rasterio . uint8 ) * <NUM_LIT:2> <EOL> dst . write ( data , indexes = <NUM_LIT:1> ) <EOL> return tmpdir <EOL> def test_merge_overlapping ( test_data_dir_overlapping ) : <EOL> outputname = str ( test_data_dir_overlapping . join ( '<STR_LIT>' ) ) <EOL> inputs = [ str ( x ) for x in test_data_dir_overlapping . listdir ( ) ] <EOL> inputs . sort ( ) <EOL> runner = CliRunner ( ) <EOL> result = runner . invoke ( merge , inputs + [ outputname ] ) <EOL> assert result . exit_code == <NUM_LIT:0> <EOL> assert os . path . exists ( outputname ) <EOL> with rasterio . open ( outputname ) as out : <EOL> assert out . count == <NUM_LIT:1> <EOL> assert out . shape == ( <NUM_LIT:15> , <NUM_LIT:15> ) <EOL> assert out . bounds == ( - <NUM_LIT> , <NUM_LIT> , - <NUM_LIT> , <NUM_LIT> ) <EOL> data = out . read ( <NUM_LIT:1> , masked = False ) <EOL> expected = numpy . zeros ( ( <NUM_LIT:15> , <NUM_LIT:15> ) , dtype = rasterio . uint8 ) <EOL> expected [ <NUM_LIT:0> : <NUM_LIT:10> , <NUM_LIT:0> : <NUM_LIT:10> ] = <NUM_LIT:1> <EOL> expected [ <NUM_LIT:5> : , <NUM_LIT:5> : ] = <NUM_LIT:2> <EOL> assert numpy . all ( data == expected ) <EOL> @ fixture ( scope = '<STR_LIT>' ) <EOL> def test_data_dir_float ( tmpdir ) : <EOL> kwargs = { <EOL> "<STR_LIT>" : { '<STR_LIT>' : '<STR_LIT>' } , <EOL> "<STR_LIT>" : ( - <NUM_LIT> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT> , <NUM_LIT:0> , - <NUM_LIT> ) , <EOL> "<STR_LIT:count>" : <NUM_LIT:1> , <EOL> "<STR_LIT>" : rasterio . float64 , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT:width>" : <NUM_LIT:10> , <EOL> "<STR_LIT>" : <NUM_LIT:10> , <EOL> "<STR_LIT>" : <NUM_LIT:0> <EOL> } <EOL> with rasterio . open ( str ( tmpdir . join ( '<STR_LIT>' ) ) , '<STR_LIT:w>' , ** kwargs ) as dst : <EOL> data = numpy . zeros ( ( <NUM_LIT:10> , <NUM_LIT:10> ) , dtype = rasterio . float64 ) <EOL> data [ <NUM_LIT:0> : <NUM_LIT:6> , <NUM_LIT:0> : <NUM_LIT:6> ] = <NUM_LIT:255> <EOL> dst . write ( data , indexes = <NUM_LIT:1> ) <EOL> with rasterio . open ( str ( tmpdir . join ( '<STR_LIT>' ) ) , '<STR_LIT:w>' , ** kwargs ) as dst : <EOL> data = numpy . zeros ( ( <NUM_LIT:10> , <NUM_LIT:10> ) , dtype = rasterio . float64 ) <EOL> data [ <NUM_LIT:4> : <NUM_LIT:8> , <NUM_LIT:4> : <NUM_LIT:8> ] = <NUM_LIT> <EOL> dst . write ( data , indexes = <NUM_LIT:1> ) <EOL> return tmpdir <EOL> def test_merge_float ( test_data_dir_float ) : <EOL> outputname = str ( test_data_dir_float . join ( '<STR_LIT>' ) ) <EOL> inputs = [ str ( x ) for x in test_data_dir_float . listdir ( ) ] <EOL> inputs . sort ( ) <EOL> runner = CliRunner ( ) <EOL> result = runner . invoke ( merge , inputs + [ outputname ] + [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> assert result . exit_code == <NUM_LIT:0> <EOL> assert os . path . exists ( outputname ) <EOL> with rasterio . open ( outputname ) as out : <EOL> assert out . count == <NUM_LIT:1> <EOL> data = out . read ( <NUM_LIT:1> , masked = False ) <EOL> expected = numpy . ones ( ( <NUM_LIT:10> , <NUM_LIT:10> ) , dtype = rasterio . float64 ) * - <NUM_LIT> <EOL> expected [ <NUM_LIT:0> : <NUM_LIT:6> , <NUM_LIT:0> : <NUM_LIT:6> ] = <NUM_LIT:255> <EOL> expected [ <NUM_LIT:4> : <NUM_LIT:8> , <NUM_LIT:4> : <NUM_LIT:8> ] = <NUM_LIT> <EOL> assert numpy . all ( data == expected ) <EOL> @ fixture ( scope = '<STR_LIT>' ) <EOL> def tiffs ( tmpdir ) : <EOL> data = numpy . ones ( ( <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> ) , '<STR_LIT>' ) <EOL> kwargs = { <EOL> '<STR_LIT:count>' : '<STR_LIT:1>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT:1> , <EOL> '<STR_LIT:width>' : <NUM_LIT:1> } <EOL> kwargs [ '<STR_LIT>' ] = Affine ( <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:1> , <EOL> <NUM_LIT:0> , - <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> with rasterio . open ( str ( tmpdir . join ( '<STR_LIT>' ) ) , '<STR_LIT:w>' , ** kwargs ) as r : <EOL> r . write ( data * <NUM_LIT> ) <EOL> kwargs [ '<STR_LIT>' ] = Affine ( <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:2> , <EOL> <NUM_LIT:0> , - <NUM_LIT:1> , <NUM_LIT:2> ) <EOL> with rasterio . open ( str ( tmpdir . join ( '<STR_LIT>' ) ) , '<STR_LIT:w>' , ** kwargs ) as r : <EOL> r . write ( data * <NUM_LIT> ) <EOL> kwargs [ '<STR_LIT>' ] = Affine ( <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT:3> , <EOL> <NUM_LIT:0> , - <NUM_LIT:2> , <NUM_LIT:4> ) <EOL> with rasterio . open ( str ( tmpdir . join ( '<STR_LIT>' ) ) , '<STR_LIT:w>' , ** kwargs ) as r : <EOL> r . write ( data * <NUM_LIT> ) <EOL> kwargs [ '<STR_LIT>' ] = Affine ( <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT:2> , <EOL> <NUM_LIT:0> , - <NUM_LIT:2> , <NUM_LIT:4> ) <EOL> with rasterio . open ( str ( tmpdir . join ( '<STR_LIT>' ) ) , '<STR_LIT:w>' , ** kwargs ) as r : <EOL> r . write ( data * <NUM_LIT> ) <EOL> return tmpdir <EOL> def test_merge_tiny ( tiffs ) : <EOL> outputname = str ( tiffs . join ( '<STR_LIT>' ) ) <EOL> inputs = [ str ( x ) for x in tiffs . listdir ( ) ] <EOL> inputs . sort ( ) <EOL> runner = CliRunner ( ) <EOL> result = runner . invoke ( merge , inputs + [ outputname ] ) <EOL> assert result . exit_code == <NUM_LIT:0> <EOL> with rasterio . open ( outputname ) as src : <EOL> data = src . read ( ) <EOL> assert ( data [ <NUM_LIT:0> ] [ <NUM_LIT:0> : <NUM_LIT:2> , <NUM_LIT:1> ] == <NUM_LIT> ) . all ( ) <EOL> assert ( data [ <NUM_LIT:0> ] [ <NUM_LIT:0> : <NUM_LIT:2> , <NUM_LIT:2> : <NUM_LIT:4> ] == <NUM_LIT> ) . all ( ) <EOL> assert data [ <NUM_LIT:0> ] [ <NUM_LIT:2> ] [ <NUM_LIT:1> ] == <NUM_LIT> <EOL> assert data [ <NUM_LIT:0> ] [ <NUM_LIT:3> ] [ <NUM_LIT:0> ] == <NUM_LIT> <EOL> def test_merge_tiny_output_opt ( tiffs ) : <EOL> outputname = str ( tiffs . join ( '<STR_LIT>' ) ) <EOL> inputs = [ str ( x ) for x in tiffs . listdir ( ) ] <EOL> inputs . sort ( ) <EOL> runner = CliRunner ( ) <EOL> result = runner . invoke ( merge , inputs + [ '<STR_LIT>' , outputname ] ) <EOL> assert result . exit_code == <NUM_LIT:0> <EOL> with rasterio . open ( outputname ) as src : <EOL> data = src . read ( ) <EOL> assert ( data [ <NUM_LIT:0> ] [ <NUM_LIT:0> : <NUM_LIT:2> , <NUM_LIT:1> ] == <NUM_LIT> ) . all ( ) <EOL> assert ( data [ <NUM_LIT:0> ] [ <NUM_LIT:0> : <NUM_LIT:2> , <NUM_LIT:2> : <NUM_LIT:4> ] == <NUM_LIT> ) . all ( ) <EOL> assert data [ <NUM_LIT:0> ] [ <NUM_LIT:2> ] [ <NUM_LIT:1> ] == <NUM_LIT> <EOL> assert data [ <NUM_LIT:0> ] [ <NUM_LIT:3> ] [ <NUM_LIT:0> ] == <NUM_LIT> <EOL> def test_merge_tiny_res_bounds ( tiffs ) : <EOL> outputname = str ( tiffs . join ( '<STR_LIT>' ) ) <EOL> inputs = [ str ( x ) for x in tiffs . listdir ( ) ] <EOL> inputs . sort ( ) <EOL> runner = CliRunner ( ) <EOL> result = runner . invoke ( merge , inputs + [ outputname , '<STR_LIT>' , <NUM_LIT:2> , '<STR_LIT>' , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:5> , <NUM_LIT:4> ] ) <EOL> assert result . exit_code == <NUM_LIT:0> <EOL> with rasterio . open ( outputname ) as src : <EOL> data = src . read ( ) <EOL> print ( data ) <EOL> assert data [ <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ] == <NUM_LIT> <EOL> assert data [ <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:1> ] == <NUM_LIT> <EOL> assert data [ <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> ] == <NUM_LIT> <EOL> assert data [ <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:1> ] == <NUM_LIT:0> <EOL> def test_merge_tiny_res_high_precision ( tiffs ) : <EOL> outputname = str ( tiffs . join ( '<STR_LIT>' ) ) <EOL> inputs = [ str ( x ) for x in tiffs . listdir ( ) ] <EOL> inputs . sort ( ) <EOL> runner = CliRunner ( ) <EOL> result = runner . invoke ( merge , inputs + [ outputname , '<STR_LIT>' , <NUM_LIT:2> , '<STR_LIT>' , <NUM_LIT:15> ] ) <EOL> assert result . exit_code == <NUM_LIT:0> <EOL> with rasterio . open ( outputname ) as src : <EOL> data = src . read ( ) <EOL> print ( data ) <EOL> assert data [ <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ] == <NUM_LIT> <EOL> assert data [ <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:1> ] == <NUM_LIT> <EOL> assert data [ <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> ] == <NUM_LIT> <EOL> assert data [ <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:1> ] == <NUM_LIT:0> <EOL> def test_merge_rgb ( tmpdir ) : <EOL> """<STR_LIT>""" <EOL> outputname = str ( tmpdir . join ( '<STR_LIT>' ) ) <EOL> inputs = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ] <EOL> runner = CliRunner ( ) <EOL> result = runner . invoke ( merge , inputs + [ outputname ] ) <EOL> assert result . exit_code == <NUM_LIT:0> <EOL> with rasterio . open ( outputname ) as src : <EOL> assert [ src . checksum ( i ) for i in src . indexes ] == [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] <EOL> def test_merge_tiny_intres ( tiffs ) : <EOL> from rasterio . merge import merge <EOL> inputs = [ str ( x ) for x in tiffs . listdir ( ) ] <EOL> inputs . sort ( ) <EOL> sources = [ rasterio . open ( x ) for x in inputs ] <EOL> merge ( sources , res = <NUM_LIT:2> ) </s>
