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

pycif.plugins.models.iconart.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 stored in datastore to model compatible input files.

Native2inputs will be called for every couple component/tracer as defined in the mapper

Parameters:
  • self – the model Plugin

  • input_type (str) – the component name to be treated; please note that this information is redundant with the keys in datastore

  • datastore – data to convert

  • 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

Note

The format of datastore is a mixture of the model mapper and of the data format as defined here

For each component/tracer, the data itself is stored in the key data, and all the other keys come from the mapper, in case they are useful to dump inputs at the correct format

Note

If the input data was fully consistent with what the model expects, the data itself is not read by pyCIF. Instead, it is possible to directly link files defined by the key input_files (and defined in the fetch function of the corresponding flux plugin).

pycif.plugins.models.iconart.io.native2inputs_adj.native2inputs_adj(self, datastore, input_type, datei, datef, runsubdir, mode='fwd', check_transforms=False, **kwargs)[source]#

Read adjoint sensitivity and format them to pyCIF data format.

Warning

This function is used only when the adjoint of the model is available.

Parameters:
  • self – the model Plugin

  • input_type (str) – one of ‘flux’

  • datastore – data to convert if input_type == ‘flux’,

  • 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

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

Reads outputs to pyCIF objects.

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

Returns:

a dictionary with structure the components/tracers to be extracted

Return type:

dict

Note

The input data data2dump has a dictionary structure with two levels: component/tracer and date. This reads as:

data2dump = {
    (comp1, tracer1): {
        dd0: pd.DataFrame
        dd1: pd.DataFrame
        [...]
    }
}

In the output, the date level should be removed and only the outputs corresponding to the present simulation (di) should be included

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

Dumps and/or save information about outputs, so the model knows where to extract information.

In the present template, observations are simply saved for later use by outputs2native. If the model needs information to extract concentration on-the-fly, the information in data2dump should be used. In particular, the columns i and j are the row and columns of each observation in the domain. The column tstep indicates on which time stamp the observation spans, relative to what is indicated in the variable output_intervals in ini_mapper.

The function is called by loadfromoutputs.adjoint.

Parameters:
  • self – the model itself

  • data2dump (dict) – a dictionary with concentration data for each 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

pycif.plugins.models.iconart.io.inputs.endconcs.make_endconcs(self, datastore, ddi, ddf, runsubdir, mode)[source]#

Link the ICON-ART restart file into the period run directory for chaining.

Symlinks restart_ATMO_DOM01.nc (the ICON-ART restart file from the previous period) into runsubdir. Does nothing when self.dont_run=True.

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

  • datastore (dict) – tracer-ID-keyed data-store entries with fileorig restart paths.

  • ddi (datetime) – period start date.

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

  • runsubdir (str) – path to the period run directory.

  • mode (str) – 'fwd', 'tl', or 'adj' (unused here).

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

Native to input function for the oem module

pycif.plugins.models.iconart.io.inputs.inicond.make_inicond(self, datastore, ddi, ddf, runsubdir, mode)[source]#

Prepare the ICON-ART initial-condition file for one sub-simulation period.

Fetches the meteorological initial-condition file (via fetch_meteo_inicond_file()), inserts the CIF-modified tracer concentrations from datastore, and writes meteo_inicond.nc into runsubdir. Handles ensemble/perturbed species by mapping sample names back to their reference species.

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

  • datastore (dict) – tracer-ID-keyed CIF data-store entries.

  • ddi (datetime) – period start date.

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

  • runsubdir (str) – path to the period run directory.

  • mode (str) – 'fwd', 'tl', or 'adj'.

pycif.plugins.models.iconart.io.inputs.inicond.dump_inicond_file(self, ddi, runsubdir)[source]#

Write the accumulated initial-condition dataset to meteo_inicond.nc.

Retrieves the in-memory inicond dataset from self.dict_inicond_dataout[ddi], updates its time dimension to ddi, and writes it to the run directory.

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

  • ddi (datetime) – period start date (used as time coordinate).

  • runsubdir (str) – path to the period run directory.

pycif.plugins.models.iconart.io.inputs.inicond.fetch_meteo_inicond_file(self, runsubdir)[source]#

Symlink or copy the IFS meteorological initial-condition file into the run directory.

Checks that self.meteo_inicond_file exists, links it as meteo_inicond.nc in runsubdir, and opens it as an xarray Dataset for in-place species modification.

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

  • runsubdir (str) – path to the period run directory.

Returns:

the opened meteorological initial-condition dataset.

Return type:

xr.Dataset

Raises:

FileNotFoundError – if self.meteo_inicond_file does not exist.

pycif.plugins.models.iconart.io.inputs.lbc.make_lbc(self, datastore, ddi, ddf, runsubdir, mode)[source]#

Fill the meteorological lbc files with lbc for tracers.

pycif.plugins.models.iconart.io.inputs.lbc.dump_lbc_files(self, ddi, runsubdir)[source]#

Write accumulated lateral boundary condition datasets to disk.

Iterates over all LBC dates stored in self.dict_lbc_dataout[ddi] and writes each as a separate ifs_YYYYMMDDHH_lbc.nc file in the LBC/ sub-directory of runsubdir, using parallel processes.

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

  • ddi (datetime) – period start date.

  • runsubdir (str) – path to the period run directory.

pycif.plugins.models.iconart.io.inputs.lbc.mp_read_data(varname, file)[source]#

Read a single variable from a NetCDF file (multiprocessing-safe helper).

Parameters:
  • varname (str) – variable name to extract.

  • file (str) – path to the NetCDF file.

Returns:

the variable’s values array.

Return type:

np.ndarray

pycif.plugins.models.iconart.io.inputs.lbc.mp_merge_data_with_meteo_lbc_file(ds_lbc, date, data, data_post, meteo_lbc_dir, meteo_lbc_file, spec_ref, is_ensemble, is_perturbed_comp, lbc_dry2moist, extpar_file, emi_specs)[source]#

Merge CIF tracer LBC data with the IFS meteorological LBC file for one date.

Reads the IFS LBC NetCDF for date, inserts CIF tracer fields (data / data_post), applies an optional dry-to-moist VMR conversion, and returns the merged dataset.

Parameters:
  • ds_lbc – in-progress LBC xr.Dataset accumulator.

  • date (datetime) – LBC date.

  • data – CIF tracer concentration array.

  • data_post – post-processed (interpolated) tracer array.

  • meteo_lbc_dir (str) – directory of IFS LBC files.

  • meteo_lbc_file (str) – IFS LBC filename pattern.

  • spec_ref (str) – reference species name.

  • is_ensemble (bool) – whether running in ensemble mode.

  • is_perturbed_comp (bool) – whether the component is a perturbed ensemble member.

  • lbc_dry2moist (bool) – convert dry VMR to moist VMR.

  • extpar_file (str) – external parameter file path.

  • emi_specs (list) – emitted species names.

Returns:

merged LBC dataset for date.

Return type:

xr.Dataset

pycif.plugins.models.iconart.io.inputs.lbc.mp_dump_lbc_files(date, ds_lbc, lbc_dir)[source]#

Write a single LBC dataset to disk (multiprocessing-safe helper).

Writes ds_lbc as {lbc_dir}/ifs_YYYYMMDDHH_lbc.nc, overwriting any existing file at the same path.

Parameters:
  • date (datetime) – LBC date (used to format the filename).

  • ds_lbc (xr.Dataset) – LBC dataset to write.

  • lbc_dir (str) – destination directory.

pycif.plugins.models.iconart.io.inputs.make_auxiliary.make_auxiliary(self, ddi, runsubdir, do_simu=True, mode='fwd', **kwargs)[source]#

Initialize every file or information needed by the model to run, excluding data that are initialized through the function native2inputs.

This includes name lists for Fortran, configuration files, etc.

Every basic files related to the model should be first initialized in self.workdir/model at the initialization step in the function compile.

Hereafter, files are link/copied to runsubdir from the reference ones in self.workdir/model

Note

For configuration files, one should follow the following basic rules:

  • paths expected by the model should always point to the current runsubdir; thus the executable should be linked or copied in runsubdir; in addition, every extra file should be link with a fixed name and the corresponding name should be given in the name-list or configuration file.

  • as many model parameters should be easily modified through the yaml configuration file; however, for some reasons, it may be preferable to limit the possibilities for pyCIF by keeping some parameters fixed; this question is up to the developer implementing one model

Parameters:
  • self – the model plugin

  • ddi (datetime.datetime) – the start data identifying the present simulation period

  • runsubdir (str) – path to the current sub-simulation work directory

  • do_simu (bool) – if False, the simulation does not need to be run, hence, in principle, no auxiliary data needs to be initialized

  • mode (str) – the running mode to compute

pycif.plugins.models.iconart.io.inputs.namelist.update_namelist(self, ddi, runsubdir)[source]#

Update the namelist for running ICON-ART

Parameters:
  • self – the model plugin

  • ddi (datetime.datetime) – the start data identifying the present simulation period

  • runsubdir (str) – path to the current sub-simulation work directory

pycif.plugins.models.iconart.io.inputs.obs.make_obs(self, ddi, datastore, runsubdir, mode, tracer, input_type, do_simu=True)[source]#

Dumps observation locations and time steps to obs.txt to speed up ICON output post-processing

pycif.plugins.models.iconart.io.inputs.restart_inicond.make_restart_inicond(self, datastore, ddi, ddf, runsubdir, mode)[source]#

Link or modify the ICON-ART EnSRF restart initial-condition file.

Used in ensemble Kalman smoother (EnSRF) mode to initialise ICON-ART from a CIF-modified restart file rather than the standard meteo_inicond.nc. Reads the source restart dataset, applies the CIF tracer modifications, and writes the result to runsubdir.

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

  • datastore (dict) – tracer-ID-keyed CIF data-store entries.

  • ddi (datetime) – period start date.

  • ddf (datetime) – period end date.

  • runsubdir (str) – path to the period run directory.

  • mode (str) – 'fwd', 'tl', or 'adj'.

pycif.plugins.models.iconart.io.inputs.tracers.change_tracers_xml_fluxes(self, emspec, is_ensemble=False)[source]#

Update the ICON-ART tracers.xml entry for one emitted species.

Sets OEM temporal-scaling options (oem_tscale) for the reference emitted tracer and, in ensemble mode, for each perturbed sample.

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

  • emspec (str) – emitted species name (may include __sample#NNN).

  • is_ensemble (bool) – whether running in ensemble mode.

pycif.plugins.models.iconart.io.inputs.tracers.change_tracers_xml_inicond(self, spec, is_ensemble=False, is_perturbed_comp=False)[source]#

Update the ICON-ART tracers.xml entry for initial-condition tracer.

Configures the tracer entry so ICON-ART reads initial conditions from the CIF-prepared meteo_inicond.nc file.

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

  • spec (str) – active species name.

  • is_ensemble (bool) – whether running in ensemble mode.

  • is_perturbed_comp (bool) – whether this is a perturbed ensemble member.

pycif.plugins.models.iconart.io.inputs.tracers.change_tracers_xml_lbc(self, spec, is_ensemble=False)[source]#

Update the ICON-ART tracers.xml entry for lateral boundary conditions.

Configures the tracer entry to read LBC from the CIF-prepared ifs_YYYYMMDDHH_lbc.nc files.

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

  • spec (str) – active species name.

  • is_ensemble (bool) – whether running in ensemble mode.

pycif.plugins.models.iconart.io.inputs.tv_scalef_oem.create_oem_tv_scaling_factors(self, ddi, ddf, data, oem_dir, tfactors_oem_group)[source]#

Write the OEM temporal scaling-factor file for one sub-period.

When self.use_hourofyear=True, extracts the hourly temporal profiles for the period [ddi, ddf] from the full-year profile file and writes a reduced hour_of_year.nc to oem_dir that ICON-ART reads at runtime.

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

  • ddi (datetime) – period start date.

  • ddf (datetime) – period end date.

  • data (xr.Dataset) – CIF flux data for the period.

  • oem_dir (str) – OEM output directory.

  • tfactors_oem_group – OEM temporal-factor group object.

pycif.plugins.models.iconart.io.outputs.apply_interpolation.apply_interpolation_by_chunk_full(segment_idx_obs, ds_icon, ds_interp, all_trcrs)[source]#

Apply full 3-D interpolation to a chunk of observations.

Uses pre-computed adjacent-cell indices and vertical level indices (ilev_below, ilev_above) from ds_interp to perform bilinear horizontal + linear vertical interpolation from the ICON icosahedral grid to observation coordinates.

Parameters:
  • segment_idx_obs (tuple[int, int]) – (start, end) slice of the observation index in ds_interp.

  • ds_icon (xr.Dataset) – ICON output dataset on the icosahedral grid.

  • ds_interp (xr.Dataset) – pre-computed interpolation metadata.

  • all_trcrs (list[str]) – tracer variable names to interpolate.

Returns:

interpolated concentrations for the observation chunk.

Return type:

xr.Dataset

pycif.plugins.models.iconart.io.outputs.apply_interpolation.apply_interpolation_by_chunk_reduced(segment_idx_obs, ds_icon, ds_interp, df_metadata, all_trcrs)[source]#

Apply reduced (level-fixed) interpolation to a chunk of observations.

Like apply_interpolation_by_chunk_full() but does not perform vertical interpolation: uses the observation’s prescribed level index directly. Used when full_interpolation=False or when observations specify only a pressure level without altitude.

Parameters:
  • segment_idx_obs (tuple[int, int]) – (start, end) observation slice.

  • ds_icon (xr.Dataset) – ICON output on icosahedral grid.

  • ds_interp (xr.Dataset) – pre-computed interpolation metadata.

  • df_metadata – observation metadata DataFrame (carries level column).

  • all_trcrs (list[str]) – tracer variable names to interpolate.

Returns:

interpolated concentrations for the observation chunk.

Return type:

xr.Dataset

pycif.plugins.models.iconart.io.outputs.apply_interpolation.apply_interpolation(self, runsubdir, data2dump)[source]#

Interpolate ICON-ART output fields to all observation locations.

Reads NetCDF output files from {runsubdir}/OUTPUT/, computes distance-weighted horizontal interpolation to observation station coordinates using pre-computed adjacent-cell metadata, applies vertical interpolation (full or reduced), and stores results in self.sim_data.

Uses apply_interpolation_by_chunk_full() or apply_interpolation_by_chunk_reduced() depending on whether altitude is available in the observation metadata.

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

  • runsubdir (str) – path to the period run directory.

  • data2dump (dict) – tracer-ID-keyed data-store (provides the observation metadata for interpolation targets).

pycif.plugins.models.iconart.io.outputs.endconcs.fetch_end(self, data2dump, runsubdir, mode, ddi, ddf)[source]#

Register the ICON-ART restart file path after a run.

Records the path to the chained restart file (chain/restart_YYYYMMDDHH.nc) in data2dump so the next period can link it as its initial conditions.

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

  • data2dump (dict) – tracer-ID-keyed data-store entries to update.

  • runsubdir (str) – path to the period run directory.

  • mode (str) – 'fwd', 'tl', or 'adj' (unused).

  • ddi (datetime) – period start date.

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

Returns:

updated data2dump with fileorig set.

Return type:

dict

pycif.plugins.models.iconart.io.outputs.process_output.reduce_size(file, output_path, cells, levs, nlev, ncells, model_timestep)[source]#

Reduce the size of the file by selecting relevant cells and levels only.

Parameters:
  • file (str) – Path of the file

  • output_path (str) – Path of the output directory

  • cells (list) – List of indexes to cells

  • levs (list) – List of indexes to levels

  • nlev (int) – Number of levels

  • ncells (int) – Number of cells

  • model_timestep (float) – Timestep of the model

pycif.plugins.models.iconart.io.outputs.process_output.concatenate_byday(output_path, files2concatenate)[source]#

Concatenate the files by day to make the subsequent processing faster.

pycif.plugins.models.iconart.io.outputs.process_output.apply_interpolation_by_chunk_full(segment_idx_obs, ds_icon, ds_interp, all_trcrs)[source]#

Apply full 3-D horizontal+vertical interpolation to a chunk of observations.

Identical in semantics to apply_interpolation.apply_interpolation_by_chunk_full() but operates on a reduced ICON output with dimension names height and ncells.

Parameters:
  • segment_idx_obs (tuple[int, int]) – (start, end) observation slice.

  • ds_icon (xr.Dataset) – reduced ICON output on the icosahedral grid.

  • ds_interp (xr.Dataset) – pre-computed interpolation metadata.

  • all_trcrs (list[str]) – tracer variable names.

Returns:

interpolated concentrations for the observation chunk.

Return type:

xr.Dataset

pycif.plugins.models.iconart.io.outputs.process_output.apply_interpolation_by_chunk_reduced(segment_idx_obs, ds_icon, ds_interp, all_trcrs)[source]#

Apply reduced (level-fixed) horizontal interpolation to a chunk of observations.

Identical in semantics to apply_interpolation.apply_interpolation_by_chunk_reduced() but operates on a pre-reduced ICON output dataset.

Parameters:
  • segment_idx_obs (tuple[int, int]) – (start, end) observation slice.

  • ds_icon (xr.Dataset) – reduced ICON output on the icosahedral grid.

  • ds_interp (xr.Dataset) – pre-computed interpolation metadata.

  • all_trcrs (list[str]) – tracer variable names.

Returns:

interpolated concentrations for the observation chunk.

Return type:

xr.Dataset

pycif.plugins.models.iconart.io.outputs.process_output.process_output(self, runsubdir, ddi)[source]#

Post-process ICON-ART output: reduce size, concatenate, and interpolate.

  1. Reduces each output NetCDF to the observation-relevant cells and levels using reduce_size() to limit disk and memory usage.

  2. Concatenates daily files using concatenate_byday().

  3. Applies horizontal + vertical interpolation to all observation locations using apply_interpolation_by_chunk_full() or apply_interpolation_by_chunk_reduced().

Results are stored in self.sim_data for later extraction by read_sim.

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

  • runsubdir (str) – path to the period run directory.

  • ddi (datetime) – sub-simulation period start.

pycif.plugins.models.iconart.io.outputs.read_sim.fetch_sim(self, runsubdir, mode, ddi)[source]#

Read ICON-ART output files and interpolate to observation locations.

Scans the OUTPUT/ sub-directory for NetCDF output files, calls apply_interpolation() to interpolate each field to the observation metadata (station coordinates and levels), and stores results in self.sim_data.

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

  • runsubdir (str) – path to the period run directory.

  • mode (str) – 'fwd', 'tl', or 'adj'.

  • ddi (datetime) – sub-simulation period start.

Raises:

FileNotFoundError – if no ICON-ART output files are found.

pycif.plugins.models.iconart.io.outputs.read_sim.read_sim(self, data2load, runsubdir, mode, ddi, ddf)[source]#

Extract simulated concentrations from pre-fetched ICON-ART output data.

For each tracer in data2load, reads the corresponding interpolated concentration values from self.sim_data and writes them into the CIF data-store ('spec' column for forward, 'incr' for TL).

Parameters:
  • self – ICON-ART model plugin instance (carries sim_data).

  • data2load (dict) – tracer-ID-keyed CIF data-store entries to fill.

  • runsubdir (str) – path to the period run directory (unused).

  • mode (str) – 'fwd', 'tl', or 'adj'.

  • ddi (datetime) – period start date.

  • ddf (datetime) – period end date.

Returns:

updated data-store with simulated concentrations.

Return type:

dict