From 7631c48fbd3d213f884f5a24c20c2064be87467b Mon Sep 17 00:00:00 2001 From: Niko Aarnio Date: Wed, 17 Apr 2024 12:04:26 +0300 Subject: [PATCH] Minor modifications to utilities: add num param to get output paths function, change name of CLI function --- eis_toolkit/cli.py | 2 +- eis_toolkit/utilities/file_io.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/eis_toolkit/cli.py b/eis_toolkit/cli.py index b4983832..145230a6 100644 --- a/eis_toolkit/cli.py +++ b/eis_toolkit/cli.py @@ -2913,7 +2913,7 @@ def split_raster_bands_cli(input_raster: INPUT_FILE_OPTION, output_dir: OUTPUT_D @app.command() -def combine_rasters_cli(input_rasters: INPUT_FILES_ARGUMENT, output_raster: OUTPUT_FILE_OPTION): +def combine_raster_bands_cli(input_rasters: INPUT_FILES_ARGUMENT, output_raster: OUTPUT_FILE_OPTION): """Combine multiple rasters into one multiband raster.""" from eis_toolkit.utilities.raster import combine_raster_bands diff --git a/eis_toolkit/utilities/file_io.py b/eis_toolkit/utilities/file_io.py index 15ce9a00..5088c89e 100644 --- a/eis_toolkit/utilities/file_io.py +++ b/eis_toolkit/utilities/file_io.py @@ -226,7 +226,7 @@ def get_output_paths_from_names( def get_output_paths_from_common_name( - outputs: Sequence[Any], directory: Path, common_name: str, extension: str + outputs: Sequence[Any], directory: Path, common_name: str, extension: str, first_num: int = 1 ) -> Sequence[Path]: """ Get output paths for cases where outputs should be just numbered. @@ -242,12 +242,13 @@ def get_output_paths_from_common_name( directory: Path of the output directory. common_name: Common name used as the basis of each output file name. A number is appended to this. extension: The extension used for the output path, for example ".tif". + first_num: The first number used as a suffix. Returns: List of output paths. """ output_paths = [] - for i in range(len(outputs)): + for i in range(first_num, len(outputs) + first_num): output_path = directory.joinpath(common_name + f"_{i}" + extension) output_paths.append(output_path)