Skip to content

Commit

Permalink
Minor modifications to utilities: add num param to get output paths f…
Browse files Browse the repository at this point in the history
…unction, change name of CLI function
  • Loading branch information
nmaarnio committed Apr 17, 2024
1 parent 774e68c commit 7631c48
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion eis_toolkit/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions eis_toolkit/utilities/file_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)

Expand Down

0 comments on commit 7631c48

Please sign in to comment.