Source code for pycif.plugins.transforms.system.dump2format.adjoint
from logging import info
[docs]
def adjoint(
transform,
inout_datastore,
controlvect,
obsvect,
mapper,
di,
df,
mode,
runsubdir,
workdir,
onlyinit=False,
**kwargs
):
"""Pass adjoint sensitivities through dump2format unchanged.
The adjoint of dump2format is a no-op for the data: sensitivities flow
through the transform without modification (writing to disk only happens
in the forward pass). This function simply copies the output datastore
entries back into the input datastore so that the adjoint pipeline can
continue.
Args:
transform (Plugin): dump2format instance.
inout_datastore (dict): mutable datastore.
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): unused.
workdir (str): unused.
onlyinit (bool): unused.
**kwargs: unused.
"""
ddi = min(di, df)
for trid in mapper["inputs"]:
inout_datastore["inputs"][trid][ddi] = \
inout_datastore["outputs"][trid][ddi]