Skip to content
This repository was archived by the owner on Feb 23, 2026. It is now read-only.

Commit b8a7fc6

Browse files
committed
🎨 customize gdal num of threads to cog
1 parent e19cf10 commit b8a7fc6

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

cube_builder/utils/image.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,13 @@ def generate_cogs(input_data_set_path, file_path, profile='deflate', block_size=
354354
output_profile["blockxsize"] = block_size
355355
output_profile["blockysize"] = block_size
356356

357+
threads = os.getenv("GDAL_NUM_THREADS", "2")
358+
if threads.isnumeric():
359+
threads = int(threads)
360+
357361
# Dataset Open option (see gdalwarp `-oo` option)
358362
config = dict(
359-
GDAL_NUM_THREADS="ALL_CPUS",
363+
GDAL_NUM_THREADS=threads,
360364
GDAL_TIFF_INTERNAL_MASK=True,
361365
GDAL_TIFF_OVR_BLOCKSIZE="128",
362366
)

0 commit comments

Comments
 (0)