Skip to content
Open
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
4 changes: 2 additions & 2 deletions fre/app/regrid_xy/regrid_xy.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,9 @@ def regrid_xy(yamlfile: str,
for component in components:
# If postprocess_on is not defined, it should have the default value of True
# If postprocess_on is defined, check for a True or False value
if "postprocess_on" in component:
if "postprocess-on" in component:
# skip component if postprocess_on = False
if not component["postprocess_on"]:
if not component["postprocess-on"]:
fre_logger.warning(f"postprocess_on=False for {source} in component {component['type']}." \
"Skipping {source}")
continue
Expand Down
6 changes: 3 additions & 3 deletions fre/app/regrid_xy/tests/test_regrid_xy.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@
"inputRealm": "atmos",
"type": "pride_and_prejudice",
"sources": input_files,
"postprocess_on": True},
"postprocess-on": True},
{"xyInterp": f"{nxy},{nxy}",
"interpMethod": "conserve_order2",
"inputRealm": "atmos",
"type": "my_component",
"sources": input_files,
"static": input_files_static,
"postprocess_on": True},
"postprocess-on": True},
{"xyInterp": f"{nxy},{nxy}",
"interpMethod": "conserve_order2",
"inputRealm": "atmos",
"type": "this_comp_is_off",
"sources": input_files_donotregrid,
"postprocess_on": False}
"postprocess-on": False}
]


Expand Down
10 changes: 5 additions & 5 deletions fre/app/remap_pp_components/tests/test-data/yaml_ex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ postprocess:
inputRealm: "atmos"
static:
- source: "atmos_static_cmip"
postprocess_on: False
postprocess-on: False

- type: "atmos_scalar_CNAME"
sources:
- history_file: "atmos_scalar"
inputRealm: "atmos"
static:
- source: "atmos_static_scalar"
postprocess_on: True
postprocess-on: True

# component used to test variable filtering for history files
- type: "atmos_scalar_test_vars_CNAME"
Expand All @@ -28,15 +28,15 @@ postprocess:
static:
- source: "atmos_static_scalar_test_vars"
variables: ["bk"]
postprocess_on: True
postprocess-on: True

# component used to test variable filtering failure for history file (variable incorrect)
- type: "atmos_scalar_test_vars_fail_CNAME"
sources:
- history_file: "atmos_scalar_test_vars_fail"
variables: ["co2mass", "bk", "no_var"]
inputRealm: "atmos"
postprocess_on: True
postprocess-on: True

# component used to test variable filtering failure for statics
- type: "atmos_scalar_static_test_vars_fail_CNAME"
Expand All @@ -46,4 +46,4 @@ postprocess:
static:
- source: "atmos_static_scalar_test_vars_fail"
variables: ["bk", "no_var"]
postprocess_on: True
postprocess-on: True
2 changes: 1 addition & 1 deletion fre/gfdl_msd_schemas
Submodule gfdl_msd_schemas updated 1 files
+99 −102 FRE/fre_pp.json
4 changes: 2 additions & 2 deletions fre/list_/list_pp_components_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def list_ppcomps_subtool(yamlfile: str, experiment: str):
# log the experiment names, which should show up on screen for sure
fre_logger.info("Components to be post-processed:")
for i in yml_dict["postprocess"]["components"]:
if "postprocess_on" in i:
if i.get("postprocess_on") is True:
if "postprocess-on" in i:
if i.get("postprocess-on") is True:
fre_logger.info(' - %s', i.get("type"))
else:
fre_logger.info(' - %s', i.get("type"))
Expand Down
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
6 changes: 3 additions & 3 deletions fre/pp/tests/AM5_example/yaml_include/pp-test.c96_amip.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ postprocess:
xyInterp: *custom_interp
interpMethod: "conserve_order2"
inputRealm: 'atmos'
postprocess_on: False
postprocess-on: False
- type: "atmos-TEST"
sources:
- history_file: "atmos_month"
sourceGrid: "cubedsphere"
xyInterp: *PP_XYINTERP96
interpMethod: "conserve_order2"
inputRealm: 'atmos'
postprocess_on: False
postprocess-on: False
- type: "atmos_level_cmip-TEST"
sources:
- history_file: "atmos_level_cmip"
sourceGrid: "cubedsphere"
xyInterp: *PP_XYINTERP96
interpMethod: "conserve_order2"
inputRealm: 'atmos'
postprocess_on: False
postprocess-on: False
8 changes: 4 additions & 4 deletions fre/pp/tests/AM5_example/yaml_include/pp.c96_amip.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,28 +60,28 @@ postprocess:
sourceGrid: "cubedsphere"
interpMethod: "conserve_order1"
inputRealm: 'atmos'
postprocess_on: False
postprocess-on: False
- type: "land"
sources:
- history_file: "land_month"
sourceGrid: "cubedsphere"
xyInterp: *PP_XYINTERP96
interpMethod: "conserve_order1"
inputRealm: 'land'
postprocess_on: False
postprocess-on: False
- type: "land_cmip"
sources:
- history_file: "land_month_cmip"
sourceGrid: "cubedsphere"
xyInterp: *PP_XYINTERP96
interpMethod: "conserve_order1"
inputRealm: 'land'
postprocess_on: False
postprocess-on: False
- type: "tracer_level"
sources:
- history_file: "atmos_tracer"
sourceGrid: "cubedsphere"
xyInterp: *PP_XYINTERP96
interpMethod: "conserve_order1"
inputRealm: 'atmos'
postprocess_on: False
postprocess-on: False
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,68 +24,68 @@ postprocess:
- history_file: "atmos_daily"
- history_file: "atmos_month"
<<: *regrid-c2
postprocess_on: True
postprocess-on: True
- type: 'atmos_cmip'
sources:
- history_file: "atmos_8xdaily_cmip"
- history_file: "atmos_daily_cmip"
- history_file: "atmos_month_cmip"
<<: *regrid-c2
postprocess_on: True
postprocess-on: True
- type: 'atmos_scalar'
sources:
- history_file: "atmos_global_cmip"
- history_file: "atmos_scalar"
postprocess_on: True
postprocess-on: True
- type: 'atmos_diurnal'
sources:
- history_file: "atmos_diurnal"
<<: *regrid-c2
postprocess_on: True
postprocess-on: True
- type: 'aerosol'
sources:
- history_file: "aerosol_month_cmip"
<<: *regrid-c2
postprocess_on: True
postprocess-on: True
- type: 'atmos_level'
sources:
- history_file: "atmos_level_cmip"
<<: *regrid-c2
postprocess_on: True
postprocess-on: True
- type: 'atmos_month_aer'
sources:
- history_file: "atmos_month_aer"
<<: *regrid-c1
postprocess_on: True
postprocess-on: True
- type: 'tracer_level'
sources:
- history_file: "atmos_tracer"
<<: *regrid-c2
postprocess_on: True
postprocess-on: True
- type: 'land'
sources:
- history_file: "land_month"
<<: *regrid-land
postprocess_on: True
postprocess-on: True
- type: 'land_cmip'
sources:
- history_file: "land_daily_cmip"
- history_file: "land_month_cmip"
<<: *regrid-land
postprocess_on: True
postprocess-on: True
- type: 'land_inst'
sources:
- history_file: "land_month_inst"
<<: *regrid-land
postprocess_on: True
postprocess-on: True
- type: 'river'
sources:
- history_file: "river_daily"
- history_file: "river_month"
<<: *regrid-land
postprocess_on: True
postprocess-on: True
- type: 'river_inst'
sources:
- history_file: "river_month_inst"
<<: *regrid-land
postprocess_on: True
postprocess-on: True
Loading
Loading