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("{}/*/".format(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("{}/AEMISSIONS.*nc".format(runsubdir))
path.remove("{}/BEMISSIONS.*nc".format(runsubdir))
path.remove("{}/BOUN_CONCS.*nc".format(runsubdir))
path.remove("{}/INI_CONCS.0.*nc".format(runsubdir))
path.remove("{}/METEO.nc".format(runsubdir))
path.remove("{}/par.nc".format(runsubdir))
path.remove("{}/dep.nc".format(runsubdir))
path.remove("{}/end.nc".format(runsubdir))
path.remove("{}/out.nc".format(runsubdir))
path.remove("{}/TMPconc*".format(runsubdir))
path.remove("{}/obs.txt".format(runsubdir))
if mode == "adj":
path.remove("{}/*.txt".format(runsubdir))
if not final:
return
path.remove("{}/aout.*.nc".format(runsubdir))
path.remove("{}/aini.nc".format(runsubdir))
path.remove("{}/*.txt".format(runsubdir))
path.remove("{}/aend.*.nc".format(runsubdir))
if mode == "adj" and full_flush:
path.remove("{}/end.*.nc".format(runsubdir))