Skip to content

Commit

Permalink
Adapt oem
Browse files Browse the repository at this point in the history
  • Loading branch information
mjaehn committed Sep 20, 2023
1 parent 69e3ecd commit 8b3e311
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 28 deletions.
17 changes: 8 additions & 9 deletions cases/cosmo-ghg-11km-test/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@ vprm:
prefix:
- vprm2_


# OAE
oem_dir: null # Set this value based on your use case
oem_gridded_emissions_nc: emissions.nc
oem_vertical_profiles_nc: vertical_profiles.nc
oem_hourofday_nc: hourofday.nc
oem_hourofyear_nc: hourofyear.nc
oem_dayofweek_nc: dayofweek.nc
oem_monthofyear_nc: monthofyear.nc
oem:
dir: ./input/cosmo-ghg/oem
gridded_emissions_nc: emissions.nc
vertical_profiles_nc: vertical_profiles.nc
hourofday_nc: hourofday.nc
hourofyear_nc: hourofyear.nc
dayofweek_nc: dayofweek.nc
monthofyear_nc: monthofyear.nc

# ONLINE_VPRM
online_vprm_dir: null # Set this value based on your use case
Expand Down
38 changes: 19 additions & 19 deletions jobs/oem.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,25 @@ def main(starttime, hstart, hstop, cfg, model_cfg):
Object holding all user-configuration parameters as attributes
"""

oem_dir = cfg.oem_dir
oem_dir = cfg.oem['dir']
oem_gridded_emissions_nc = os.path.join(oem_dir,
cfg.oem_gridded_emissions_nc)
cfg.oem['gridded_emissions_nc'])
oem_vertical_profiles_nc = os.path.join(oem_dir,
cfg.oem_vertical_profiles_nc)
cfg.oem['vertical_profiles_nc'])

# Temporal profiles can be given as hourofday, dayofweek, monthofyear
# AND/OR as hourofyear. We copy all files indicated in cfg, but make
# sure at least one type is present
hod_tps = True
hoy_tps = True
try:
oem_hourofday_nc = os.path.join(oem_dir, cfg.oem_hourofday_nc)
oem_dayofweek_nc = os.path.join(oem_dir, cfg.oem_dayofweek_nc)
oem_monthofyear_nc = os.path.join(oem_dir, cfg.oem_monthofyear_nc)
oem_hourofday_nc = os.path.join(oem_dir, cfg.oem['hourofday_nc'])
oem_dayofweek_nc = os.path.join(oem_dir, cfg.oem['dayofweek_nc'])
oem_monthofyear_nc = os.path.join(oem_dir, cfg.oem['monthofyear_nc'])
except AttributeError:
hod_tps = False
try:
oem_hourofyear_nc = os.path.join(oem_dir, cfg.oem_hourofyear_nc)
oem_hourofyear_nc = os.path.join(oem_dir, cfg.oem['hourofyear_nc'])
except AttributeError:
hoy_tps = False

Expand All @@ -61,23 +61,23 @@ def main(starttime, hstart, hstop, cfg, model_cfg):

if hod_tps:
tools.copy_file(oem_gridded_emissions_nc,
os.path.join(dest_dir, cfg.oem_gridded_emissions_nc))
os.path.join(dest_dir, cfg.oem['gridded_emissions_nc']))
tools.copy_file(oem_vertical_profiles_nc,
os.path.join(dest_dir, cfg.oem_vertical_profiles_nc))
os.path.join(dest_dir, cfg.oem['vertical_profiles_nc']))
tools.copy_file(oem_hourofday_nc,
os.path.join(dest_dir, cfg.oem_hourofday_nc))
os.path.join(dest_dir, cfg.oem['hourofday_nc']))
tools.copy_file(oem_dayofweek_nc,
os.path.join(dest_dir, cfg.oem_dayofweek_nc))
os.path.join(dest_dir, cfg.oem['dayofweek_nc']))
tools.copy_file(oem_monthofyear_nc,
os.path.join(dest_dir, cfg.oem_monthofyear_nc))
os.path.join(dest_dir, cfg.oem['monthofyear_nc']))
if hoy_tps:
tools.copy_file(oem_hourofyear_nc,
os.path.join(dest_dir, cfg.oem_hourofyear_nc))
os.path.join(dest_dir, cfg.oem['hourofyear_nc']))

# Additional files for ICON simulations
if hasattr(cfg, 'oem_ens_reg_nc'):
tools.copy_file(os.path.join(oem_dir, cfg.oem_ens_reg_nc),
os.path.join(dest_dir, cfg.oem_ens_reg_nc))
if hasattr(cfg, 'oem_ens_lambda_nc'):
tools.copy_file(os.path.join(oem_dir, cfg.oem_ens_lambda_nc),
os.path.join(dest_dir, cfg.oem_ens_lambda_nc))
if cfg.oem.get('ens_reg_nc') is not None:
tools.copy_file(os.path.join(oem_dir, cfg.oem['ens_reg_nc']),
os.path.join(dest_dir, cfg.oem['ens_reg_nc']))
if cfg.oem.get('oem_ens_lambda_nc') is not None:
tools.copy_file(os.path.join(oem_dir, cfg.oem['ens_lambda_nc']),
os.path.join(dest_dir, cfg.oem['ens_lambda_nc']))

0 comments on commit 8b3e311

Please sign in to comment.