Source code for pycif.plugins.models.chimere.utils
import os
[docs]
def check_inputs(self, runsubdir, mode):
"""Verify that all required CHIMERE input files exist in the run directory.
Checks for the presence of the mandatory input files before launching
the CHIMERE executable. The list of required files depends on whether
biogenic emissions are active (``self.useemisb``).
Mandatory files: ``METEO.nc``, ``BOUN_CONCS.nc``, ``AEMISSIONS.nc``,
``INI_CONCS.0.nc``, ``chimere.nml``, ``chimere.e``, and (if
``useemisb``) ``BEMISSIONS.nc``.
Args:
self (Plugin): CHIMERE model plugin instance.
runsubdir (str): sub-simulation run directory to check.
mode (str): execution mode (``'fwd'``, ``'tl'``, or ``'adj'``);
currently unused but kept for API consistency.
Raises:
Exception: if any required file is missing from *runsubdir*.
"""
# Check that all files are here
list_inputs = [
"METEO.nc", "BOUN_CONCS.nc", "AEMISSIONS.nc", "INI_CONCS.0.nc",
"chimere.nml", "chimere.e"
] + (
["BEMISSIONS.nc"] if self.useemisb else []
)
for f in list_inputs:
if not os.path.isfile(f"{runsubdir}/{f}"):
raise Exception(
f"WARNING! the file {f} was not initialized properly in {runsubdir}. "
"CHIMERE executable will not run properly."
)