Skip to content

Commit ed8e7ee

Browse files
committed
Merge branch 'update_euler' of github.com:C2SM/processing-chain into update_euler
2 parents 657dd2c + dc7e742 commit ed8e7ee

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

jobs/era5_ic.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
3-
43
"""
54
era5_ic.py
65
Processing-chain job that generates ICON initial conditions (IC) from ERA5 input.
@@ -19,8 +18,10 @@
1918
import logging
2019
from pathlib import Path
2120
from . import tools, prepare_icon
21+
2222
BASIC_PYTHON_JOB = True
2323

24+
2425
def _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+
4244
def 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

Comments
 (0)