Skip to content
Draft
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
2 changes: 1 addition & 1 deletion fre/gfdl_msd_schemas
24 changes: 10 additions & 14 deletions fre/pp/configure_script_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ def rose_init(experiment: str, platform: str, target: str) -> metomi.rose.config
rose_suite = metomi.rose.config.ConfigNode()
# disagreeable; these should be optional
rose_suite.set(keys=['template variables', 'DO_ANALYSIS_ONLY'], value='False')
rose_suite.set(keys=['template variables', 'DO_MDTF'], value='False')
rose_suite.set(keys=['template variables', 'PP_DEFAULT_XYINTERP'], value='0,0')

# set some rose suite vars
rose_suite.set(keys=['template variables', 'EXPERIMENT'], value=f'"{experiment}"')
Expand Down Expand Up @@ -122,7 +120,7 @@ def set_rose_suite(yamlfile: dict, rose_suite: metomi.rose.config.ConfigNode) ->
"""
pp=yamlfile.get("postprocess")
dirs=yamlfile.get("directories")
analysis=yamlfile.get("analysis")
analysis=yamlfile.get("final-step-user-scripts")

if dirs is not None:
for key,value in dirs.items():
Expand All @@ -148,9 +146,9 @@ def set_rose_suite(yamlfile: dict, rose_suite: metomi.rose.config.ConfigNode) ->

# Account for multiple scripts for refinediag
# Fail if multiple scripts defined for preanalysis (not implemented yet)
if pp_key == "preanalysis":
if pp_key == "first-step-user-scripts":
for k2, v2 in pp_value.items():
switch = v2["do_preanalysis"]
switch = v2["user_script_on"]
if switch is True:
script = v2["script"]

Expand All @@ -162,9 +160,9 @@ def set_rose_suite(yamlfile: dict, rose_suite: metomi.rose.config.ConfigNode) ->

pa_scripts += f"{script} "

if pp_key == "refinediag":
if pp_key == "refinediag-user-scripts":
for k2, v2 in pp_value.items():
switch = v2["do_refinediag"]
switch = v2["user_script_on"]
if switch is True:
script = v2["script"]
rd_scripts += f"{script} "
Expand Down Expand Up @@ -205,16 +203,14 @@ def set_rose_suite(yamlfile: dict, rose_suite: metomi.rose.config.ConfigNode) ->

do_analysis_switch = []
for an_key, an_value in analysis.items():
an_workflow_info = an_value["workflow"]
# if analysis_on key is actually set, evaluate and save its value in a list
if "analysis_on" in an_workflow_info:
do_analysis_switch.append(an_workflow_info["analysis_on"])
#if analysis_on key is NOT set, save its value as True in the list
# if user_script_on key is set, save its value in a list
if "user_script_on" in an_value:
do_analysis_switch.append(an_value["user_script_on"])
# if it's not set, save its value as True (i.e. default on)
else:
do_analysis_switch.append("True")

# if ANY of the analysis components do not set analysis_on or set analysis_on as True,
# set DO_ANALYSIS=True in the rose_suite.conf
# if ANY of the analysis components are on set DO_ANALYSIS=True in the rose_suite.conf
if any(do_analysis_switch):
rose_suite.set( keys = ['template variables', 'DO_ANALYSIS'],
value = 'True' )
Expand Down
10 changes: 5 additions & 5 deletions fre/pp/tests/AM5_example/yaml_include/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ postprocess:
switches: &shared_switches
clean_work: True
do_atmos_plevel_masking: True
preanalysis:
first-step-user-scripts:
vitals:
script: "/path/to/vitals-script"
inputs: ['atmos_month', 'aerosol_month']
do_preanalysis: True
refinediag:
user_script_on: True
refinediag-user-scripts:
ocean:
script: "/path/to/ocean-script"
inputs: ['ocean_monthly', 'ocean_bgc']
outputs: ['ocean_refined']
do_refinediag: True
user_script_on: True
aerosol:
script: "/path/to/aerosol-script"
inputs: ['aerosol_month']
outputs: ['aerosol_refined']
do_refinediag: True
user_script_on: True
2 changes: 1 addition & 1 deletion fre/yamltools/tests/AM5_example/am5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ experiments:
pp:
- "pp_yamls/pp.c96_amip.yaml"
- "pp_yamls/pp-TEST.c96_amip.yaml"
analysis:
final-step-user-scripts:
- "analysis_yamls/clouds.yaml"
- "analysis_yamls/land.yaml"
cmor: # cmor-tool development, not part of official am5.yaml (yet)
Expand Down
Loading