Source code for pycif.plugins.models.lmdz_acc.flushrun
import os
import pandas as pd
from ....utils import path
[docs]
def flushrun(self, rundir, mode, transform_id, full_flush=True):
"""Cleaning the simulation directories to limit space usage"""
periods = pd.date_range(self.datei, self.datef, freq=self.periods)
subdir_list = periods.strftime("%Y-%m-%d_%H-%M").to_list()
# Run subdirectories
for subdir in subdir_list:
# Obs files
# path.remove(os.path.join(rundir, subdir, "obs.txt"))
# path.remove(os.path.join(rundir, subdir, "obs.bin"))
# path.remove(os.path.join(rundir, subdir, "obs_out.bin"))
# Start files
path.remove(os.path.join(rundir, subdir, "start.nc"))
path.remove(os.path.join(rundir, subdir, "start_tl.nc"))
path.remove(os.path.join(rundir, subdir, "start_tl.bin"))
# Fluxes files
path.remove(os.path.join(rundir, subdir, "mod_*.bin"))
# Chemistry files
path.remove(os.path.join(rundir, subdir, "kinetic.nc"))
path.remove(os.path.join(rundir, subdir, "prescr_*.nc"))
path.remove(os.path.join(rundir, subdir, "scale_*.bin"))
path.remove(os.path.join(rundir, subdir, "prod*_*.nc"))
# Mass fluxes files
path.remove(os.path.join(rundir, subdir, "*stoke*.nc"))
# Trajq files
path.remove(os.path.join(rundir, subdir, "traj*.bin"))
# Executables
path.remove(os.path.join(rundir, subdir, "run.sh")) # LMDZ/acc only
path.remove(os.path.join(rundir, subdir, "dispersion.e"))
# "chain" directory
if mode == "adj":
path.remove(os.path.join(rundir, "chain", "traj*.bin"))
if full_flush:
path.remove(os.path.join(rundir, "chain", "restart_*.nc"))
path.remove(os.path.join(rundir, "chain", "restart_tl_*.bin"))