Source code for pycif.plugins.models.dummy.io.inputs.fluxes

import numpy as np


[docs] def make_fluxes(self, datastore, ddi, ddf): """Store CIF flux datastore values in the dummy model's in-memory cache. Unlike real models the dummy model does not write NetCDF or binary files; it keeps flux arrays in ``self.dataflx`` (forward) and ``self.dataflx_tl`` (tangent-linear increment) dictionaries, indexed by period start date and species name. Args: self: dummy model plugin instance. datastore (dict): tracer-ID-keyed CIF data-store entries, each carrying a ``data[ddi]`` dict with ``'spec'`` (and optionally ``'incr'``) arrays. ddi (datetime): period start date. ddf (datetime): period end date (unused; kept for API consistency). """ # Initialize data fluxes if not hasattr(self, "dataflx"): self.dataflx = {} self.dataflx_tl = {} if ddi not in self.dataflx: self.dataflx[ddi] = {spec: 0 for spec in self.chemistry.acspecies.attributes} self.dataflx_tl[ddi] = {spec: 0 for spec in self.chemistry.acspecies.attributes} # Fill with actual values for trid in datastore: spec = trid[1] ds = datastore[trid]["data"][ddi] flx_fwd = ds["spec"] flx_tl = 0.0 * flx_fwd if "incr" in ds: flx_tl = ds["incr"] # Saving data in model object # For other models, intermediate NetCDF or binary files should be # saved for later use by numerical Fortran (or other) model self.dataflx[ddi][spec] = flx_fwd self.dataflx_tl[ddi][spec] = flx_tl