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

from ......utils import path
from logging import info, warning
import os
import shutil
from .params import make_config


[docs] def make_auxiliary(self, ddi, runsubdir, onlyinit=False, do_simu=True, mode="fwd", **kwargs): """Set up the TM5 executable and configuration file for one sub-simulation period. Symlinks the TM5 binary (``tm5.x``) into *runsubdir* and calls :func:`make_config` to write the TM5 configuration file (``rc``). Returns immediately when ``do_simu=False`` or ``onlyinit=True``. Args: self: TM5 model plugin instance with ``workdir`` set. ddi (datetime): sub-simulation period start. runsubdir (str): path to the period run directory. onlyinit (bool): skip if ``True`` (adjoint initialisation pass). do_simu (bool): skip if ``False``. mode (str): ``'fwd'``, ``'tl'``, or ``'adj'``. **kwargs: unused. """ 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: return # Choose the right executable # JvP 20201103: Updated link statement #path.link( # "{}/model/tm5.f90".format(self.workdir), # "{}/tm5.f90".format(runsubdir), #) # JvP 20210118: renamed tm5.exe to tm5.x # JvP 20210202: The TM5 executable is now in the src subdirectory of # model. path.link( f"{self.workdir}/model/src/tm5.x", f"{runsubdir}/tm5.x", ) # JvP 20201109: replaced "nml file" (probably a Chimere term) with # config file. The function make_config can be found in ./io/params.py. # Deals with the config file (for TM5: rc file). make_config(self, runsubdir, sdc, mode)