pycif.plugins.transforms.system.loadfromoutputs — API reference#
Configuration reference: loadfromoutputs plugin
- pycif.plugins.transforms.system.loadfromoutputs.adjoint.adjoint(transform, inout_datastore, controlvect, obsvect, mapper, di, df, mode, runsubdir, workdir, onlyinit=False, do_simu=True, check_transforms=False, **kwargs)[source]#
Write model-space adjoint sensitivities to native model input format.
The adjoint of
forward(): for each input tracer, collects the adjoint sensitivity arrays from the output datastore (populated byarray2sampledorsparse2sample), initialises empty datastores where data is absent, and calls the model’soutputs2native_adjfunction to write the sensitivities to the model-native format.Also performs a deep copy of the
'inputs'datastore to prevent later in-place modifications from corrupting the adjoint pass.Batch-sampling tracers (
__sample#Nnaming) are grouped and processed together viatrids_in_refto avoid redundant I/O.- Parameters:
transform (Plugin) – loadfromoutputs instance (carries
outputs2native_adj).inout_datastore (dict) – mutable datastore;
'outputs'holds the sensitivities;'inputs'is updated in-place.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) – passed to
outputs2native_adj.workdir (str) – unused.
onlyinit (bool) – forwarded to
outputs2native_adj.do_simu (bool) – forwarded to
outputs2native_adj.check_transforms (bool) – forwarded to
outputs2native_adj.**kwargs – unused.
- pycif.plugins.transforms.system.loadfromoutputs.forward.forward(transform, inout_datastore, controlvect, obsvect, mapper, di, df, mode, runsubdir, workdir, do_simu=True, onlyinit=False, check_transforms=False, **kwargs)[source]#
Load model output files into CIF-internal arrays via
outputs2native.Iterates over the input tracers in the mapper, collects the data already present in the datastore, and passes it to the model’s
outputs2nativefunction (bound on the transform instance byini_mapper()). The returned arrays are stored in both the'inputs'and'outputs'sub-dicts of the datastore so they are available to both the current and succeeding transforms.When the tracer parameter is
'', all parameters of the matching component are loaded together.- Parameters:
transform (Plugin) – loadfromoutputs instance (carries
outputs2native).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) –
'fwd'or'tl'.runsubdir (str) – sub-simulation run directory passed to
outputs2native.workdir (str) – root working directory.
do_simu (bool) – forwarded to
outputs2native.onlyinit (bool) – forwarded to
outputs2native.check_transforms (bool) – forwarded to
outputs2native.**kwargs – forwarded to
outputs2native.