Source code for pycif.plugins.models.satwetch4.io.outputs2native
from logging import debug
import numpy as np
[docs]
def outputs2native(
self, data2dump, input_type, di, df, runsubdir, mode="fwd",
onlyinit=False, check_transforms=False, **kwargs
):
"""Reads outputs to pyCIF objects.
Args:
self: the model itself
data2dump (dict): a dictionary with output data structure to be filled
with correct data for every component/tracer
input_type (str): the type of model outputs to be processed;
this information is redundant with the components of
the data2dump dictionary
di (datetime.datetime): starting date of the present sub-simulation
df (datetime.datetime): ending date of the present sub-simulation
runsubdir (str): path to the present sub-simulation work directory
mode (str): running mode; one of "fwd", "tl" and "adj"
onlyinit (bool): if ``True``, means that the function is called during
the initialization process of the observation vector
do_simu (bool): if ``False``, means that the observation vector
is retrieving information from a previous existing run;
in that case, it may not be necessary to dump files
Return:
dict: a dictionary with structure the components/tracers to be extracted
"""
ddi = min(di, df)
dataout = {}
if mode in ["tl", "fwd"]:
# Loop over species in data2dump
for trid in data2dump:
if trid[0] != input_type:
continue
if trid not in dataout:
dataout[trid] = {}
flux = self.flux_out
dataout[trid] = {"spec": flux}
if mode == "tl":
dflux = self.dflux_out
dataout[trid]["incr"] = dflux
return dataout