Skip to content

Commit

Permalink
In order for the temporal consistency checks on various vx parameters…
Browse files Browse the repository at this point in the history
… and corresponding adjustments to them to be effective (i.e. in order for any necessary adjustments to make it into the rocoto xml file), move the call to the function that performs these checks and adjustments to a place BEFORE the call to extend_yaml() that "freezes" (hard-codes) the accumulations for which the PcpCombine and other tasks are run (this freezing should happen AFTER any adjustments are made to the list of user-specified accumulations).
  • Loading branch information
gsketefian committed Oct 18, 2024
1 parent dbcbcaf commit 7545d25
Showing 1 changed file with 44 additions and 15 deletions.
59 changes: 44 additions & 15 deletions ush/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,46 @@ def _add_jobname(tasks):
except:
pass
cfg_d["workflow"]["EXPT_BASEDIR"] = os.path.abspath(expt_basedir)
#
# -----------------------------------------------------------------------
#
# Ensure that the configuration parameters associated with cumulative
# fields (e.g. APCP) in the verification section of the experiment
# dicitonary are temporally consistent, e.g. that accumulation intervals
# are less than or equal to the forecast length. Update the verification
# section of the dictionary to remove inconsistencies.
#
# -----------------------------------------------------------------------
#
vx_config = cfg_d["verification"]
workflow_config = cfg_d["workflow"]

date_first_cycl = workflow_config.get("DATE_FIRST_CYCL")
date_last_cycl = workflow_config.get("DATE_LAST_CYCL")
incr_cycl_freq = int(workflow_config.get("INCR_CYCL_FREQ"))
fcst_len_hrs = workflow_config.get("FCST_LEN_HRS")
vx_fcst_output_intvl_hrs = vx_config.get("VX_FCST_OUTPUT_INTVL_HRS")

# Convert various times and time intervals from integers or strings to
# datetime or timedelta objects.
date_first_cycl_dt = datetime.datetime.strptime(date_first_cycl, "%Y%m%d%H")
date_last_cycl_dt = datetime.datetime.strptime(date_last_cycl, "%Y%m%d%H")
cycl_intvl_dt = datetime.timedelta(hours=incr_cycl_freq)
fcst_len_dt = datetime.timedelta(hours=fcst_len_hrs)
vx_fcst_output_intvl_dt = datetime.timedelta(hours=vx_fcst_output_intvl_hrs)

# Generate a list containing the starting times of the cycles.
cycle_start_times \
= set_cycle_dates(date_first_cycl_dt, date_last_cycl_dt, cycl_intvl_dt,
return_type='datetime')

# Call function that runs the consistency checks on the vx parameters.
vx_config, fcst_obs_matched_times_all_cycles_cumul \
= check_temporal_consistency_cumul_fields(
vx_config, cycle_start_times, fcst_len_dt, vx_fcst_output_intvl_dt)


cfg_d['verification'] = vx_config
extend_yaml(cfg_d)

# Do any conversions of data types
Expand Down Expand Up @@ -603,21 +642,11 @@ def _remove_tag(tasks, tag):
cycle_start_times \
= set_cycle_dates(date_first_cycl, date_last_cycl, cycl_intvl_dt,
return_type='datetime')
#
# -----------------------------------------------------------------------
#
# Ensure that the configuration parameters associated with cumulative
# fields (e.g. APCP) in the verification section of the experiment
# dicitonary are temporally consistent, e.g. that accumulation intervals
# are less than or equal to the forecast length. Update the verification
# section of the dictionary to remove inconsistencies.
#
# -----------------------------------------------------------------------
#
vx_config, fcst_obs_matched_times_all_cycles_cumul \
= check_temporal_consistency_cumul_fields(
vx_config, cycle_start_times, fcst_len_dt, vx_fcst_output_intvl_dt)
expt_config["verification"] = vx_config
print(f"")
print(f"IIIIIIIIIIIIIII")
print(f"cycle_start_times = ")
pprint(cycle_start_times)
#mnmnmnmnmnmnmn
#
# -----------------------------------------------------------------------
#
Expand Down

0 comments on commit 7545d25

Please sign in to comment.