Skip to content

Commit

Permalink
Improve output
Browse files Browse the repository at this point in the history
  • Loading branch information
mjaehn committed Sep 20, 2023
1 parent d3e23a2 commit 302ce35
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 27 deletions.
43 changes: 22 additions & 21 deletions cases/cosmo-ghg-11km-test/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@ constraint: gpu
restart_step: 12
variant: spinup
spinup: 6
input_root: ./input/cosmo-ghg

# METEO
meteo_prefix: laf
meteo_nameformat: "laf%Y%m%d%H"
meteo_inc: 1
meteo:
dir: ./input/cosmo-ghg/meteo
prefix: laf
nameformat: "laf%Y%m%d%H"
inc: 1

# ICBC
cams_dir_orig: null # Set this value based on your use case
cams_dir_proc: null # Set this value based on your use case
cams_dir_orig: ./input/cosmo-ghg/icbc
cams_dir_proc: ./input/cosmo-ghg/icbc/processed
cams_parameters:
- suffix: cams_co2
suffix: cams_co2
inc: 3

# EMISSIONS
Expand Down Expand Up @@ -87,18 +88,18 @@ output_root: null # Set this value based on your use case
reference_dir: null # Set this value based on your use case
output_dir: null # Set this value based on your use case
values_to_check:
- - cosmo-ghg_pgi_gpu_e5e9e5a_lffd2015010200.nc
- lffd2015010200.nc
- T
- P
- U
- V
- W
- CO2_BG
- CO2_A
- CO2_GPP
- CO2_RA
- CO2_A2
- CO2_GPP2
- CO2_RA2
- cosmo-ghg_pgi_gpu_e5e9e5a_lffd2015010200.nc
- lffd2015010200.nc
- T
- P
- U
- V
- W
- CO2_BG
- CO2_A
- CO2_GPP
- CO2_RA
- CO2_A2
- CO2_GPP2
- CO2_RA2

30 changes: 24 additions & 6 deletions run_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,26 @@ def print_config(self):
# Print the configuration
max_col_width = max(len(key) for key in vars(self)) + 1

print("\nConfiguration:")
print(f"{'Attribute':<{max_col_width}} Type Value")
print("-" * 80)
for key, value in vars(self).items():
print(f"{key:<{max_col_width}} {value}")
if isinstance(value, list):
# If the value is a list, format it with indentation
print(f"{key:<{max_col_width}} list")
for item in value:
item_type = type(item).__name__
print(f" - {item:<{max_col_width-4}} {item_type}")
elif isinstance(value, dict):
# If the value is a dictionary, format it as before
print(f"{key:<{max_col_width}} dict")
for sub_key, sub_value in value.items():
sub_value_type = type(sub_value).__name__
print(f" - {sub_key:<{max_col_width-4}} {sub_value_type:<4} {sub_value}")
else:
# Standard output
key_type = type(key).__name__
print(f"{key:<{max_col_width}} {key_type:<4} {value}")


def run_chain(work_root, model_cfg, cfg, start_time, hstart, hstop, job_names,
Expand Down Expand Up @@ -363,14 +381,14 @@ def run_chain(work_root, model_cfg, cfg, start_time, hstart, hstop, job_names,

# if nested run: use output of mother-simulation
if 'nesting' in model_cfg['models'][
cfg.model]['features'] and not os.path.isdir(cfg.meteo_dir):
cfg.model]['features'] and not os.path.isdir(cfg.meteo.dir):
# if ifs_hres_dir doesn't point to a directory,
# it is the name of the mother run
mother_name = cfg.meteo_dir
cfg.meteo_dir = os.path.join(work_root, mother_name, job_id, 'cosmo',
mother_name = cfg.meteo.dir
cfg.meteo.dir = os.path.join(work_root, mother_name, job_id, 'cosmo',
'output')
cfg.meteo_inc = 1
cfg.meteo_prefix = 'lffd'
cfg.meteo.inc = 1
cfg.meteo.prefix = 'lffd'

# ICON
if cfg.model.startswith('icon'):
Expand Down

0 comments on commit 302ce35

Please sign in to comment.