pycif.plugins.models.dummy — API reference#

Configuration reference: dummy plugin

pycif.plugins.models.dummy.flushrun.flushrun(self, rundir, mode, transform_id, full_flush=True)[source]#

Cleaning attributes to the model

pycif.plugins.models.dummy.ini_mapper.ini_mapper(model, general_mapper={}, backup_comps={}, transforms_order=[], ref_transform='', **kwargs)[source]#

Build the data-flow mapper for the dummy Gaussian plume model.

Declares:

  • Inputs — meteorological fields (windspeed, winddir, stabclass) and one surface flux field per active species.

  • Outputs — one sparse (observation-sampled) concentration field per active species.

  • outputs2inputs — links each concentration output to the flux input of the corresponding species so the adjoint pipeline knows which flux sensitivity to accumulate.

Input date windows are hourly intervals derived from model.input_dates.

Parameters:
  • model – dummy model plugin instance (carries input_dates, domain, and chemistry.acspecies).

  • general_mapper (dict) – unused.

  • backup_comps (dict) – unused.

  • transforms_order (list) – unused.

  • ref_transform (str) – unused.

  • **kwargs – unused.

Returns:

mapper with inputs, outputs, and outputs2inputs.

Return type:

dict

pycif.plugins.models.dummy.ini_periods.ini_periods(self, **kwargs)[source]#

Initialise sub-simulation periods and time-step arrays for the dummy model.

Partitions the full simulation window into sub-periods of length self.periods, then divides each sub-period into time steps of length self.tstep. Both periods and time steps may be any pandas frequency alias (e.g. '4D', '1h").

Sets the following attributes on self:

  • subsimu_dates — 1-D array of sub-simulation boundary dates.

  • tstep_dates — dict mapping each sub-period start date to its array of time-step boundary dates.

  • input_dates — same as tstep_dates (dummy model reads inputs at each model time step).

  • tstep_all — 1-D array of all time steps across all periods.

Parameters:
  • self (Plugin) – dummy model plugin instance (carries datei, datef, periods, tstep).

  • **kwargs – unused; accepted for interface consistency.

pycif.plugins.models.dummy.perturb_model.perturb_model(self, nsamples, transf_mapper)[source]#

Extend the chemistry active-species list to accommodate ensemble members.

For each active species spec, creates nsamples copies named spec__sample#000, …, spec__sample#NNN on self.chemistry.acspecies, then removes the original species. This allows the ensemble inversion modes (EnSRF, Monte Carlo) to propagate multiple concentration fields through the model simultaneously.

Parameters:
  • self (Plugin) – dummy model plugin instance.

  • nsamples (int) – number of ensemble members (samples per species).

  • transf_mapper (dict) – transform mapper (unused; kept for API consistency with other model plugins).

pycif.plugins.models.dummy.run.run(self, runsubdir, mode, workdir, ddi, do_simu=True, **kwargs)[source]#

Run dummy_txt Gaussian model in forward or adjoint mode

Parameters:
  • runsubdir (str) – working directory for the current run

  • mode (str) – forward or backward

  • workdir (str) – pycif working directory

  • do_simu (bool) – if False, considers that the simulation was already run

pycif.plugins.models.dummy.run.fortran_exe(self, pg_file, mode, spec, ddi)[source]#

Mimic the behaviour of a numerical model executable

pycif.plugins.models.dummy.io.native2inputs.native2inputs(self, datastore, input_type, datei, datef, runsubdir, mode='fwd', onlyinit=False, do_simu=True, check_transforms=False, **kwargs)[source]#

Converts data at the model data resolution to model compatible input files.

Parameters:
  • self – the model Plugin

  • input_type (str) – one of ‘flux’, ‘obs’

  • datastore – data to convert if input_type == ‘flux’, a dictionary with flux maps if input_type == ‘obs’, a pandas dataframe with the observations

  • datei – date interval of the sub-simulation

  • datef – date interval of the sub-simulation

  • mode (str) – running mode: one of ‘fwd’, ‘adj’ and ‘tl’

  • runsubdir (str) – sub-directory for the current simulation

  • workdir (str) – the directory of the whole pycif simulation

Notes

  • LMDZ expects daily inputs; if the periods in the control vector are

longer than one day, period values are uniformly de-aggregated to the daily scale; this is done with pandas function ‘asfreq’ and the option ‘ffill’ as ‘forward-filling’ See Pandas page for details: https://pandas.pydata.org/pandas-docs/stable/generated/pandas .DataFrame.asfreq.html

pycif.plugins.models.dummy.io.native2inputs_adj.native2inputs_adj(self, datastore, input_type, datei, datef, runsubdir, mode='adj', onlyinit=False, do_simu=True, check_transforms=False, **kwargs)[source]#

Converts data at the model data resolution to model compatible input files.

Parameters:
  • self – the model Plugin

  • input_type (str) – one of ‘flux’, ‘obs’

  • datastore – data to convert if input_type == ‘flux’, a dictionary with flux maps if input_type == ‘obs’, a pandas dataframe with the observations

  • datei – date interval of the sub-simulation

  • datef – date interval of the sub-simulation

  • mode (str) – running mode: one of ‘fwd’, ‘adj’ and ‘tl’

  • runsubdir (str) – sub-directory for the current simulation

  • workdir (str) – the directory of the whole pycif simulation

Notes

  • LMDZ expects daily inputs; if the periods in the control vector are

longer than one day, period values are uniformly de-aggregated to the daily scale; this is done with pandas function ‘asfreq’ and the option ‘ffill’ as ‘forward-filling’ See Pandas page for details: https://pandas.pydata.org/pandas-docs/stable/generated/pandas .DataFrame.asfreq.html

pycif.plugins.models.dummy.io.outputs2native.outputs2native(self, data2dump, input_type, di, df, runsubdir, mode='fwd', dump=True, onlyinit=False, do_simu=True, check_transforms=False, **kwargs)[source]#

Reads outputs to pycif objects.

If the mode is ‘fwd’ or ‘tl’, only onservation-like outputs are extracted. For the ‘adj’ mode, all outputs relative to model sensitivity are extracted.

Dumps to a NetCDF file with output concentrations if needed

pycif.plugins.models.dummy.io.outputs2native_adj.outputs2native_adj(self, data2dump, input_type, di, df, runsubdir, mode='fwd', dump=True, check_transforms=False, **kwargs)[source]#

Reads outputs to pycif objects.

If the mode is ‘fwd’ or ‘tl’, only onservation-like outputs are extracted. For the ‘adj’ mode, all outputs relative to model sensitivity are extracted.

Dumps to a NetCDF file with output concentrations if needed

pycif.plugins.models.dummy.io.inputs.fluxes.make_fluxes(self, datastore, ddi, ddf)[source]#

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.

Parameters:
  • 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).

pycif.plugins.models.dummy.io.inputs.meteo.make_meteo(self, datastore, ddi, ddf)[source]#

Load a meteorological field from the CIF datastore into the dummy model.

Reads one meteorological parameter (e.g. 'winddir', 'windspeed') from the datastore and appends it as a column to self.meteo.data[ddi].

Parameters:
  • self – dummy model plugin instance with a meteo sub-plugin.

  • datastore (dict) – tracer-ID-keyed CIF data-store; only the first entry’s 'spec' array is used.

  • ddi (datetime) – period start date (key into self.meteo.data).

  • ddf (datetime) – period end date (unused).