diff --git a/samgeo/common.py b/samgeo/common.py index db617ef7..e7c69652 100644 --- a/samgeo/common.py +++ b/samgeo/common.py @@ -2992,16 +2992,20 @@ def merge_rasters( raise ImportError( "GDAL is required to use this function. Install it with `conda install gdal -c conda-forge`" ) + # Get a list of all the input files input_files = glob.glob(os.path.join(input_dir, input_pattern)) + # Prepare the gdal.Warp options + warp_options = gdal.WarpOptions( + format=output_format, dstNodata=output_nodata, creationOptions=output_options + ) + # Merge the input files into a single output file gdal.Warp( - output, - input_files, - format=output_format, - dstNodata=output_nodata, - options=output_options, + destNameOrDestDS=output, + srcDSOrSrcDSTab=input_files, + options=warp_options, )