Source code for pycif.plugins.transforms.system.run_model.adjoint



[docs] def adjoint( transform, datastore, controlvect, obsvect, mapper, di, df, mode, runsubdir, workdir, do_simu=True, onlyinit=False, approx_transf=False, overlap=False, ref_fwd_dir="", **kwargs ): """Execute the adjoint transport model for one sub-simulation period. Mirrors :func:`forward`: calls ``model.make_auxiliary`` and then ``model.run`` in adjoint mode. Skipped entirely when ``onlyinit`` is ``True`` (dry-run initialisation pass). Args: transform (Plugin): run_model instance. datastore (dict): mutable datastore passed to ``model.run``. controlvect: unused. obsvect: unused. mapper (dict): transform mapper. di (datetime): sub-simulation start date. df (datetime): sub-simulation end date. mode (str): ``'adj'``. runsubdir (str): sub-simulation run directory. workdir (str): root working directory. do_simu (bool): if ``False``, skip the model execution. onlyinit (bool): if ``True``, return without doing anything. approx_transf (bool): passed to ``model.run``. overlap (bool): passed to ``model.run``. ref_fwd_dir (str): passed to ``model.run``. **kwargs: forwarded to ``model.make_auxiliary`` and ``model.run``. """ if not onlyinit: ddi = min(di, df) # First produce auxiliary data transform.model.make_auxiliary( ddi, runsubdir, onlyinit=onlyinit, do_simu=do_simu, mode=mode, **kwargs ) # Now run the model itself transform.model.run(runsubdir, mode, workdir, min(di, df), do_simu=do_simu, approx_transf=approx_transf, overlap=overlap, ref_fwd_dir=ref_fwd_dir,datastore = datastore, **kwargs)