Source code for pycif.plugins.models.chimere.io.inputs.make_auxiliary

from ......utils import path
from .params import make_nml
from ......utils.check.errclass import CifError


[docs] def make_auxiliary(self, ddi, runsubdir, onlyinit=False, do_simu=True, mode="fwd", **kwargs): """Set up the CHIMERE executable and namelist for one sub-simulation period. Symlinks the correct CHIMERE binary (``fwdchimere.e``, ``tlchimere.e``, or ``achimere.e``) into *runsubdir* as ``chimere.e``, then calls :func:`make_nml` to write the Fortran namelist ``chimere.nml``. If ``onlyinit=True`` the function returns immediately without doing anything (the adjoint init pass uses previously linked forward outputs). Args: self: CHIMERE model plugin instance with ``workdir`` set. ddi (datetime): start date of the sub-simulation period. runsubdir (str): path to the period run directory. onlyinit (bool): if ``True``, skip setup (used during adjoint initialisation). do_simu (bool): if ``False``, skip setup. mode (str): ``'fwd'``, ``'tl'``, or ``'adj'``. **kwargs: unused. Raises: Exception: if *mode* is not one of the recognised values. """ sdc = ddi.strftime("%Y%m%d%H") # If mode is "fwd" or "tl" but onlyinit is True, # it means that we are initializing an adjoint by running backward # the adjoint pipeline if mode in ["tl", "fwd"] and onlyinit: mode = "adj" if not do_simu or onlyinit: return # Choose the right executable if mode == "fwd": source = "fwdchimere.e" elif mode == "tl": source = "tlchimere.e" elif mode == "adj": source = "achimere.e" else: raise CifError( f"Unknown mode '{mode}' for executable with CHIMERE" ) path.link( f"{self.workdir}/model/{source}", f"{runsubdir}/chimere.e", ) # Deals with the nml file make_nml(self, runsubdir, sdc, mode, ddi)