Skip to content
Snippets Groups Projects
Commit c89c13a3 authored by Frisinghelli Daniel's avatar Frisinghelli Daniel
Browse files

Create output directory, if not existing.

parent 4d1b3417
Branches
No related tags found
No related merge requests found
......@@ -42,6 +42,11 @@ def reproject_cdo(grid, src_ds, trg_ds, mode='bilinear', overwrite=False):
operator = cdo.Cdo()
# check if target dataset exists
trg_ds = pathlib.Path(trg_ds)
if not trg_ds.parent.exist():
LOGGER.info('mkdir {}'.format(trg_ds.parent))
trg_ds.parent.mkdir(parents=True, exist_ok=True)
if pathlib.Path(trg_ds).exists() and not overwrite:
LOGGER.info('{} already exists. Aborting ...'.format(trg_ds))
return trg_ds
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment