merge_files#
- mhm_tools.pre.merge.merge_files(input_path, input_file_part, output, n_cpus, preserve_folders=False)[source]#
Merge NetCDF files along time using CDO via its Python API.
Assumes files share the same grid and DO NOT overlap in time.
Parallelizes by merging chunks in parallel with joblib, then merges parts.
- Parameters:
input_path (str) – directory containing input files
input_file_part (str) – glob pattern (e.g., “tavg_*.nc”)
output_path (str) – directory to write output
output_file_name (str) – name of output NetCDF (e.g., “merged.nc”)
n_cpus (int) – number of parallel workers
preserve_folders (bool) – Decides if the top level folder structure should be preserved.
- Returns:
str
- Return type:
path to the merged file