pycif.plugins.models.iconart — API reference

pycif.plugins.models.iconart — API reference#

Configuration reference: iconart plugin

pycif.plugins.models.iconart.compile.compile(self)[source]#

The compile function initializes all model information and executables prior to any run. Files must be copied in $workdir/model.

This includes:

  • copying executable if exist

    Warning

    It is recommended to copy executable files to make sure than later simulations in the present pyCIF computation use the same executable. Indeed, it can happen that one runs very long inversions in the background and carries on developments, forgetting about the background inversions, thus potentially breaking the background inversions, or worse, changing the result without error…

  • copy sources and compile if no executable is around, or if explicitly required to re-compile.

    Note

    As much as possible, the model should be compiled within pyCIF to guarantee a traceability of the options used for compiling and also dealing with platform specificities through the platform Plugin (see details here)

  • copy extra configuration files, e.g., templates for namelists, etc.

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

Cleaning the simulation directories to limit space usage

pycif.plugins.models.iconart.flushrun.flush_rundir(runsubdir)[source]#

Cleaning the simulation directories to limit space usage

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

Build the data-flow mapper for the ICON-ART model.

Registers:

  • Flux inputs per active species at the configured input resolution.

  • Lateral boundary condition inputs (lbc).

  • Initial-condition inputs (inicond) for the first period.

  • End-concentration inputs/outputs for period chaining (endconcs).

  • Concentration outputs per active species at the output resolution.

  • outputs2inputs linking each output to its source inputs.

Parameters:
  • model – ICON-ART plugin instance with all date arrays set.

  • general_mapper (dict) – unused.

  • backup_comps (dict) – updated in-place with fallback components.

  • transforms_order (list) – unused.

  • ref_transform (str) – unused.

  • transform_name (str) – unused.

  • **kwargs – unused.

Returns:

mapper with inputs, outputs, and outputs2inputs.

Return type:

dict

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

The function ini_periods is optional but very recommended. It is used to define the temporal variables subsimu_dates, input_dates, tstep_dates and tstep_all. The function is automatically called at the initialization of the model class if available. If not available, the temporal variables should be defined manually in the ini_data function (not recommended).

ini_periods is a class method that applies to the model plugin itself. Therefore, the only expected argument is self.

def ini_periods(self, **kwargs):

    self.subsimu_dates = XXXX
    self.tstep_dates = XXXXX
    self.input_dates = XXXXX
    self.tstep_all = XXXXX
pycif.plugins.models.iconart.perturb_model.perturb_model(self, nsamples, transf_mapper)[source]#

Extend the ICON-ART chemistry scheme to accommodate ensemble members.

Creates nsamples copies of each active species (acspecies) and corresponding emission-to-active-species mappings. Original species are removed after copies are added.

Parameters:
  • self – ICON-ART model plugin instance.

  • nsamples (int) – number of ensemble members.

  • transf_mapper (dict) – transform mapper (unused; kept for API consistency).

pycif.plugins.models.iconart.run.run(self, runsubdir, mode, workdir, ddi, nbproc=1, do_simu=True, approx_transf=False, ref_fwd_dir='', overlap=False, **kwargs)[source]#

Run the model in forward, tangent-linear or adjoint mode. This includes:

  • executing the model external executable

  • updating adj_refdir

  • moving files needed for chained simulations to f”{runsubdir}/../”

Note

For model for which the adjoint is not coded, make sure to return a clear error if the run function is called in adj mode and with do_simu = True

Parameters:
  • self – the model Plugin

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

  • mode (str) – forward or backward

  • workdir (str) – pyCIF working directory

  • do_simu (bool) – re-run or not existing simulation