Merge

When working with satellite imagery, multiple images often need to be merged to create a comprehensive view of a larger area. This is particularly important when the geographic extent of the area of interest exceeds the coverage of a single image, or when a series of images captured over time need to be stitched together for analysis.

Merging is done based on the georeference and the date of each image, ensuring that they align correctly in space. all images from the same day are merged together forming a large mosaic. If there are bnd informations included in the file name (b1, b01, b1a, ...) then the bands are preserved.

Supported timestamps are:

  • yyyymmddThhmmss
  • yyydddhhmmss
  • yyyymmdd
  • yyyyddd

And supported band formats patterns matching 'B' followed by 1-2 digits and an optional letter (e.g., "B1", "B12a").

The first non background pixel is used for the final mosaic during the merge process.

Parameters¤

Name Type Description
input_dir str Input directory path. Can contain subfolders.
output_dir str The output directory will hold the merged mosaic images. The output mosaic files will be named based on the defined method.
file_patterns str list Pattern(s) to group files additionally to the timestamp (default: []). The pattern can include wildcards:

* matches any sequence of characters (including an empty sequence).
? matches any single character.
[seq] matches any character in seq.
[!seq] matches any character not in seq.
num_processes int Process multiple files in parallel using multi-processing. Default is 1.

Example¤

Python
from sipt.processing import merge

merge("./src", "./processed", ["*b01*", "*b02*"], 4)