Skip to content

Commit

Permalink
Makes delete_dummy_model use pathlib
Browse files Browse the repository at this point in the history
  • Loading branch information
dulte committed Mar 8, 2022
1 parent 2e34614 commit eaa8f4f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pyaerocom/aeroval/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging
import os
import shutil
from pathlib import Path

from pyaerocom import const
from pyaerocom.aeroval.modelentry import ModelEntry
Expand Down Expand Up @@ -191,12 +192,11 @@ def make_dummy_model(obs_list: list, cfg) -> str:
return model_id


def delete_dummy_model(model_id: str):
def delete_dummy_model(model_id: str) -> None:
tmpdir = const.LOCAL_TMP_DIR
const.add_data_search_dir(tmpdir)

outdir = os.path.join(tmpdir, f"{model_id}/renamed")
dirs = glob.glob(outdir + "/*.nc")
for d in dirs:
print(f"Deleting dummy model {d}")
os.remove(d)
renamed = Path(tmpdir) / f"{model_id}/renamed"
for path in renamed.glob("*.nc"):
print(f"Deleting dummy model {path}")
path.unlink()

0 comments on commit eaa8f4f

Please sign in to comment.