Namelist and Runscript Templates

The namelists and run jobs for int2lm and COSMO, as well as for icontools and ICON are dynamically generated using templates located in the cases/<casename> directory. These templates are essentially text files containing “normal” namelist parameters alongside Python variables enclosed in curly braces.

During runtime, these template files are read by their respective jobs. The resulting strings are formatted through Python’s .format() function, facilitating the substitution of Python variables with their corresponding value. Subsequently, the formatted strings are then saved as the actual namelist and run scripts in the run directory of their respective jobs.

cases/example/example_namelist.cfg -> [read file] ->
"namelist_var = '{cfg.prefix}{cfg.suffix}'" -> ["".format(cfg)] ->
"namelist_var = 'pref_suff.nc'" -> [write to disk] ->
int2lm/run/example_namelist

A special case is INPUT_ART for int2lm and INPUT_GHG for COSMO . These namelists are generated by jobs.tools.write_int2lm_input_art.main() and jobs.tools.write_cosmo_input_ghg.main() from .csv-files containing all necessary information.


jobs.tools.write_int2lm_input_art.main(trcr_filename, set_filename, nml_filename, hstart=0)[source]

Write the INPUT_ART namelist file for int2lm from .csv files

Parameters:
  • trcr_filename (str) – csv file with tracer definitions

  • set_filename (str) – csv file with tracer datasets

  • nml_filename (str) – output filename (INPUT_ART)

  • hstart (int) – meteorology spin up in hours


jobs.tools.write_cosmo_input_ghg.main(csv_filename, namelist_filename, cfg=None)[source]

Convert a table (.csv file) to namelist file (INPUT_GHG) read by COSMO.

Parameters:
  • csv_filename (str) – Path to the source csv-file

  • namelist_filename (str) – Path to the namelist file that will be created

  • cfg (Config) – Object holding all user-configuration parameters as attributes.