TILE MERGE SCRIPT#

The python script below looks into subfolders of specified directory and merge together all tiff files found, naming the resulting tiff as the folder from which they are generated.

  • The function for merging and exporting is found in merge_utils.py

  • GDAL library must be installed in your python environment

  • Output is exported in the same format of the original tiles

  • The scripts makes use of parallel processing for quicker results

import os
import concurrent.futures
from merge_utils import merge_tifs

# Specify the directory to search for .tif files
directory = 'C:/YourWorkDirectory/Fathom3/PL/2020/'

# Iterate through each subdirectory
subdirs = [os.path.join(directory, subdir) for subdir in os.listdir(directory) if os.path.isdir(os.path.join(directory, subdir))]

# Process subdirectories in parallel
with concurrent.futures.ProcessPoolExecutor() as executor:
    executor.map(merge_tifs, subdirs)