Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oifs48r1 further reading #1093

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions configs/components/oifs/oifs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,8 @@ choose_cloudfixer:
## specifics for 40r1 and 43r3
##

choose_major_version:
#choose_major_version:
choose_version:
40r1:
add_namelist_changes:
fort.4:
Expand Down Expand Up @@ -992,17 +993,9 @@ choose_major_version:
CNMEXP: "${oifs.input_expid}"
NAMPPC:
LRSACC: ".true." # reset accumulation of fluxes
environment_changes:
choose_computer.name:
levante:
compiler_mpi: gnu11_ompi2022
iolibraries: system_gnu_libs
juwels:
compiler_mpi: gnu2023_ompi2023

further_reading:
- oifs/oifs48.env.yaml

- "oifs/oifs48.env.yaml"

# If 1, use Coddington spectrum which reduced stratospheric warm bias
# Only available in 43r3-v2
Expand Down
11 changes: 7 additions & 4 deletions configs/components/oifs/oifs48.env.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Setup up compile and runtime environment i.e. what needs
# to be changed w.r.t the default config/machines/<computer>.yaml

environment_changes:
add_export_vars:
OIFS_CYCLE: 48r1
DATA: "${general.work_dir}"
OIFS_HOME: "${model_dir}"
LD_LIBRARY_PATH: '$LD_LIBRARY_PATH:${model_dir}/build/lib'
GRIB_SAMPLES_PATH: '${model_dir}/build/share/eccodes/ifs_samples/grib1_mlgrib2'
OIFS_LOGFILE: '${model_dir}/build/oifs_test_log.txt'
Expand All @@ -13,7 +14,9 @@ environment_changes:
compiler_mpi: gnu11_ompi2022
iolibraries: system_gnu_libs
add_add_export_vars:
OIFS_DATA_DIR: "/p/project/chhb19/streffing1/input/oifs-48r1/"
juwels:
compiler_mpi: gnu2023_ompi2023
OIFS_DATA_DIR: "/work/ab0246/a270092/input/oifs-48r1/"
#juwels:
# compiler_mpi: gnu2023_ompi2023
# add_export_vars:
# OIFS_DATA_DIR: "/p/project/chhb19/streffing1/input/oifs-48r1/"

24 changes: 21 additions & 3 deletions src/esm_parser/esm_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@

protected_adds = ["add_module_actions", "add_export_vars", "add_unset_vars"]
keep_as_str = ["branch"]
early_choose_vars = ["include_models", "version", "major_version", "omp_num_threads", "environment_changes", "further_reading"]
early_choose_vars = ["include_models", "version", "omp_num_threads", "further_reading"]


def flatten_nested_lists(lst):
Expand Down Expand Up @@ -275,6 +275,7 @@ def check_for_empty_components_in_user_config(user_config):
return user_config

def complete_config(user_config):
# user_config is config from runscript???
if not "general" in user_config:
user_config["general"] = {}
user_config["general"]["additional_files"] = []
Expand Down Expand Up @@ -1425,10 +1426,15 @@ def find_one_independent_choose(all_set_variables):
return task_list[0]


def resolve_basic_choose(config, config_to_replace_in, choose_key, blackdict={}):
def resolve_basic_choose(config, config_to_replace_in, choose_key, blackdict={}, component_with_key=""):
path_to_key = choose_key.replace("choose_", "").split(".")
try:
choice = recursive_get(config, path_to_key)
# if choose_key is defined in general section of e.g. standalone model
# when resolving early_choose_vars
# choose_key needs to be reset to correct component
if "general" in choose_key and component_with_key:
choose_key = choose_key.replace("general", component_with_key)
except ValueError:
if "*" not in config_to_replace_in[choose_key]:
raise KeyError("Key %s was not defined" % ".".join(path_to_key))
Expand Down Expand Up @@ -1621,6 +1627,10 @@ def resolve_choose_with_var(
config_to_search_into = None
if choose_key in user_config.get(component_with_key, []):
config_to_search_into = user_config
elif choose_key in user_config.get("general", []):
# if choose_key is defined in general section of user_config, e.g. for standalone models
config_to_search_into = user_config
choose_with_var = choose_with_var.replace(component_with_key, "general")
elif choose_key in setup_config.get(component_with_key, []):
config_to_search_into = setup_config
elif choose_key in model_config.get(component_with_key, []):
Expand All @@ -1629,7 +1639,7 @@ def resolve_choose_with_var(
if config_to_search_into:
# Resolve the case
resolve_basic_choose(
config_to_search_into, config_copy, choose_with_var
config_to_search_into, config_copy, choose_with_var, component_with_key=component_with_key
)
# If ``var`` was defined through the resolution of the ``choose_``, add
# the ``var`` value to the ``config``.
Expand Down Expand Up @@ -2851,6 +2861,14 @@ def __init__(self, model, version, user_config):
self.config = yaml_file_to_dict(include_path)
else:
self.config = include_path
for var in ["further_reading"]:
resolve_choose_with_var(
var,
self.config,
# current_model=self.config,
user_config=user_config)
# setup_config=self.config)

for attachment in CONFIGS_TO_ALWAYS_ATTACH_AND_REMOVE:
attach_to_config_and_remove(self.config, attachment, all_config=None)

Expand Down
Loading