Skip to content

Commit

Permalink
copy file to output if only one netCDF file is there.
Browse files Browse the repository at this point in the history
  • Loading branch information
danielfromearth committed Aug 8, 2024
1 parent d8ce913 commit 8e76871
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions concatenator/stitchee.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,20 @@ def stitchee(
logger.info("No non-empty netCDF files found. Exiting.")
return ""

output_file = validate_output_path(output_file, overwrite=overwrite_output_file)

# Exit cleanly with the file copied if one workable netCDF file found.
if num_input_files == 1:
shutil.copyfile(input_files[0], output_file)
logger.info("One workable netCDF file. Copied to output path without modification.")
return output_file

if concat_dim and (concat_method == "xarray-combine"):
warn(
"'concat_dim' was specified, but will not be used because xarray-combine method was "
"selected."
)

output_file = validate_output_path(output_file, overwrite=overwrite_output_file)

# If requested, make a temporary directory with new copies of the original input files
temporary_dir_to_remove = None
if copy_input_files:
Expand Down

0 comments on commit 8e76871

Please sign in to comment.