Source code for pycif.plugins.models.chimere.flushrun
from glob import glob
from ....utils import path
[docs]
def flushrun(self, rundir, mode, transform_id, full_flush=True):
"""Cleaning the simulation directories to limit space usage"""
list_subdirs = glob(f"{rundir}/*/")
# Removing big files in CHIMERE directories
for subdir in list_subdirs:
flush_rundir(subdir, mode, final=True, full_flush=full_flush)
def flush_rundir(runsubdir, mode, final=False, full_flush=True):
path.remove(f"{runsubdir}/AEMISSIONS.*nc")
path.remove(f"{runsubdir}/BEMISSIONS.*nc")
path.remove(f"{runsubdir}/BOUN_CONCS.*nc")
path.remove(f"{runsubdir}/INI_CONCS.0.*nc")
path.remove(f"{runsubdir}/METEO.nc")
path.remove(f"{runsubdir}/par.nc")
path.remove(f"{runsubdir}/dep.nc")
path.remove(f"{runsubdir}/end.nc")
path.remove(f"{runsubdir}/out.nc")
path.remove(f"{runsubdir}/TMPconc*")
path.remove(f"{runsubdir}/obs.txt")
if mode == "adj":
path.remove(f"{runsubdir}/*.txt")
if not final:
return
path.remove(f"{runsubdir}/aout.*.nc")
path.remove(f"{runsubdir}/aini.nc")
path.remove(f"{runsubdir}/*.txt")
path.remove(f"{runsubdir}/aend.*.nc")
if mode == "adj" and full_flush:
path.remove(f"{runsubdir}/end.*.nc")