11#!/usr/bin/env python
22# -*- coding: utf-8 -*-
3-
43"""
54era5_ic.py
65Processing-chain job that generates ICON initial conditions (IC) from ERA5 input.
1918import logging
2019from pathlib import Path
2120from . import tools , prepare_icon
21+
2222BASIC_PYTHON_JOB = True
2323
24+
2425def _compute_inidata_filename (cfg ) -> Path :
2526 """
2627 Replicate the same IC filename logic used by jobs/icon.py,
@@ -39,6 +40,7 @@ def _compute_inidata_filename(cfg) -> Path:
3940 cfg .startdate_sim .strftime (cfg .meteo ['prefix' ] +
4041 cfg .meteo ['nameformat' ]) + '.nc' )
4142
43+
4244def main (cfg ):
4345 """
4446 1) Prepare standard ICON paths (same helper as other jobs)
@@ -53,23 +55,25 @@ def main(cfg):
5355
5456 prepare_icon .set_cfg_variables (cfg )
5557 tools .change_logfile (cfg .logfile )
56- logging .info ("Generate global ICON initial conditions from ERA5 (IC only)." )
58+ logging .info (
59+ "Generate global ICON initial conditions from ERA5 (IC only)." )
5760
5861 # Ensure run + icbc directories exist (prepare_icon usually created them,
5962 # but being explicit makes the job robust if invoked in isolation).
6063 tools .create_dir (cfg .icon_work , "icon_work" )
6164 tools .create_dir (cfg .icon_input_icbc , "icon_input_icbc" )
6265
6366 # Useful formatted dates for the template (avoid bash date gymnastics)
64- cfg .era5_ymd = cfg .startdate_sim .strftime ('%Y-%m-%d' ) # e.g. 2021-01-01
67+ cfg .era5_ymd = cfg .startdate_sim .strftime ('%Y-%m-%d' ) # e.g. 2021-01-01
6568 cfg .era5_yyyymmddhh = cfg .startdate_sim .strftime ('%Y%m%d%H' ) # 2021010100
6669
6770 # Compute the *exact* file that ICON will later read
6871 inidata_filename = _compute_inidata_filename (cfg )
6972
7073 # Case template name (kept configurable)
7174 # Put in config.yaml: era5_ic_runjob_filename: era5_ic_runjob.cfg
72- template_name = getattr (cfg , 'era5_ic_runjob_filename' , 'era5_ic_runjob.cfg' )
75+ template_name = getattr (cfg , 'era5_ic_runjob_filename' ,
76+ 'era5_ic_runjob.cfg' )
7377 template = (cfg .case_path / template_name ).read_text ()
7478 script_str = template .format (
7579 cfg = cfg ,
0 commit comments