Skip to content

Commit

Permalink
Some fixes and updates to conditions
Browse files Browse the repository at this point in the history
- Replace all o_prefix with m_prefix and remove offset time
- Fix condition check for REPLAY_ICS (YES -> True)
- Add check against DO_JEDIOCNVAR for ice ICs
- Update model_start_date_current_cycle setting for MODE

Refs NOAA-EMC#2475
  • Loading branch information
KateFriedman-NOAA committed Aug 12, 2024
1 parent 9a0c642 commit 863ecee
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
5 changes: 2 additions & 3 deletions jobs/JGLOBAL_STAGE_IC
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ current_cycle="${PDY}${cyc}"
previous_cycle=$(date --utc -d "${PDY} ${cyc} - ${assim_freq} hours" +%Y%m%d%H)
current_cycle_begin=$(date --utc -d "${PDY} ${cyc} - ${half_window} hours" +%Y%m%d%H)
current_cycle_end=$(date --utc -d "${PDY} ${cyc} + ${half_window} hours" +%Y%m%d%H)
current_cycle_offset=$(date --utc -d "${PDY} ${cyc} + ${OFFSET_START_HOUR} hours" +%Y%m%d%H)

# Define model start date for current_cycle as the time the forecast will start
if [[ "${DOIAU:-NO}" == "YES" ]]; then
if [[ "${DOIAU:-NO}" == "YES" ]] && [[ "${MODE}" == "cycled" ]] ; then
model_start_date_current_cycle="${current_cycle_begin}"
else
if [[ "${REPLAY_ICS:-NO}" == "YES" ]]; then
Expand All @@ -22,7 +21,7 @@ else
model_start_date_current_cycle=${current_cycle}
fi
fi
export current_cycle previous_cycle current_cycle_offset model_start_date_current_cycle
export current_cycle previous_cycle model_start_date_current_cycle

# Initialize return code
err=0
Expand Down
28 changes: 18 additions & 10 deletions parm/stage/stage.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
{% set previous_cycle_YMD = previous_cycle | to_YMD %}
{% set previous_cycle_HH = previous_cycle | strftime("%H") %}
{% set m_prefix = model_start_date_current_cycle | to_YMD + "." + model_start_date_current_cycle | strftime("%H") + "0000" %}
{% set o_prefix = current_cycle_offset | to_YMD + "." + current_cycle_offset | strftime("%H") + "0000" %}
{% set p_prefix = previous_cycle | to_YMD + "." + previous_cycle | strftime("%H") + "0000" %}

####################################################################
Expand Down Expand Up @@ -102,7 +101,7 @@ atmosphere_cold:
{% endfor %} # ftype
{% endif %}

{% if REPLAY_ICS == "YES" %}
{% if REPLAY_ICS == True %}
{% set COMOUT_ATMOS_ANALYSIS = COM_ATMOS_ANALYSIS_TMPL | replace_tmpl(current_dict) %}
atmosphere_perturbation:
mkdir:
Expand All @@ -120,7 +119,7 @@ atmosphere_nest:
- "{{ COMOUT_ATMOS_RESTART_PREV }}"
copy:
{% for ftype in ["ca_data", "fv_core.res", "fv_srf_wnd.res", "fv_tracer.res", "phy_data", "sfc_data"] %}
- ["{{ ICSDIR }}/{{ COMOUT_ATMOS_RESTART_PREV | relpath(ROTDIR) }}/{{ o_prefix }}.{{ ftype }}.tile{{ ntile }}.nc", "{{ COMOUT_ATMOS_RESTART_PREV }}/{{ o_prefix }}.{{ ftype }}.nest0{{ ntile-5 }}.tile{{ ntile }}.nc"]
- ["{{ ICSDIR }}/{{ COMOUT_ATMOS_RESTART_PREV | relpath(ROTDIR) }}/{{ m_prefix }}.{{ ftype }}.tile{{ ntile }}.nc", "{{ COMOUT_ATMOS_RESTART_PREV }}/{{ m_prefix }}.{{ ftype }}.nest0{{ ntile-5 }}.tile{{ ntile }}.nc"]
{% endfor %}
{% else %} # cold start
{% set COMOUT_ATMOS_INPUT = COM_ATMOS_INPUT_TMPL | replace_tmpl(current_dict) %}
Expand All @@ -134,12 +133,21 @@ atmosphere_nest:
{% endif %}

{% if DO_ICE %}
{% if DO_JEDIOCNVAR == True %}
{% set COMOUT_ICE_ANALYSIS = COM_ICE_ANALYSIS_TMPL | replace_tmpl(current_dict) %}
ice:
mkdir:
- "{{ COMOUT_ICE_ANALYSIS }}"
copy:
- ["{{ ICSDIR }}/{{ COMOUT_ICE_ANALYSIS | relpath(ROTDIR) }}/{{ m_prefix }}.cice_model_anl.res.nc", "{{ COMOUT_ICE_ANALYSIS }}"]
{% else %}
{% set COMOUT_ICE_RESTART_PREV = COM_ICE_RESTART_TMPL | replace_tmpl(previous_dict) %}
ice:
mkdir:
- "{{ COMOUT_ICE_RESTART_PREV }}"
copy:
- ["{{ ICSDIR }}/{{ COMOUT_ICE_RESTART_PREV | relpath(ROTDIR) }}/{{ o_prefix }}.cice_model.res.nc", "{{ COMOUT_ICE_RESTART_PREV }}"]
- ["{{ ICSDIR }}/{{ COMOUT_ICE_RESTART_PREV | relpath(ROTDIR) }}/{{ m_prefix }}.cice_model.res.nc", "{{ COMOUT_ICE_RESTART_PREV }}"]
{% endif %}
{% endif %}

{% if DO_OCN %}
Expand All @@ -148,20 +156,20 @@ ocean:
mkdir:
- "{{ COMOUT_OCEAN_RESTART_PREV }}"
copy:
- ["{{ ICSDIR }}/{{ COMOUT_OCEAN_RESTART_PREV | relpath(ROTDIR) }}/{{ o_prefix }}.MOM.res.nc", "{{ COMOUT_OCEAN_RESTART_PREV }}"]
- ["{{ ICSDIR }}/{{ COMOUT_OCEAN_RESTART_PREV | relpath(ROTDIR) }}/{{ m_prefix }}.MOM.res.nc", "{{ COMOUT_OCEAN_RESTART_PREV }}"]
{% if OCNRES == "025" %}
{% for nn in range(1, 3) %}
- ["{{ ICSDIR }}/{{ COMOUT_OCEAN_RESTART_PREV | relpath(ROTDIR) }}/{{ o_prefix }}.MOM.res_{{ nn }}.nc", "{{ COMOUT_OCEAN_RESTART_PREV }}"]
- ["{{ ICSDIR }}/{{ COMOUT_OCEAN_RESTART_PREV | relpath(ROTDIR) }}/{{ m_prefix }}.MOM.res_{{ nn }}.nc", "{{ COMOUT_OCEAN_RESTART_PREV }}"]
{% endfor %}
{% endif %}

{% if REPLAY_ICS == "YES" %}
{% if REPLAY_ICS == True %}
{% set COMOUT_OCEAN_ANALYSIS = COM_OCEAN_ANALYSIS_TMPL | replace_tmpl(current_dict) %}
replay:
mkdir:
- "{{ COMOUT_OCEAN_ANALYSIS }}"
copy:
- ["{{ ICSDIR }}/{{ COMOUT_OCEAN_ANALYSIS | relpath(ROTDIR) }}/{{ o_prefix }}.mom6_perturbation.nc", "{{ COMOUT_OCEAN_ANALYSIS }}/mom6_increment.nc"]
- ["{{ ICSDIR }}/{{ COMOUT_OCEAN_ANALYSIS | relpath(ROTDIR) }}/{{ m_prefix }}.mom6_perturbation.nc", "{{ COMOUT_OCEAN_ANALYSIS }}/mom6_increment.nc"]
{% endif %}

{% if EXP_WARM_START == True %}
Expand All @@ -175,13 +183,13 @@ mediator:
{% endif %} # path exists
{% endif %} # warm start true

{% endif %} # DO_OCN=YES
{% endif %} # DO_OCN=True

{% if DO_WAVE %}
{% set COMOUT_WAVE_RESTART_PREV = COM_WAVE_RESTART_TMPL | replace_tmpl(previous_run_dict) %}
wave:
mkdir:
- "{{ COMOUT_WAVE_RESTART_PREV }}"
copy:
- ["{{ ICSDIR }}/{{ COMOUT_WAVE_RESTART_PREV | relpath(ROTDIR) }}/{{ o_prefix }}.restart.{{ waveGRD }}", "{{ COMOUT_WAVE_RESTART_PREV }}"]
- ["{{ ICSDIR }}/{{ COMOUT_WAVE_RESTART_PREV | relpath(ROTDIR) }}/{{ m_prefix }}.restart.{{ waveGRD }}", "{{ COMOUT_WAVE_RESTART_PREV }}"]
{% endif %}
4 changes: 2 additions & 2 deletions scripts/exglobal_stage_ic.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ def main():
# Pull out all the configuration keys needed to run stage job
keys = ['RUN', 'MODE', 'EXP_WARM_START', 'NMEM_ENS',
'previous_cycle', 'current_cycle',
'current_cycle_offset', 'model_start_date_current_cycle',
'model_start_date_current_cycle',
'ROTDIR', 'ICSDIR', 'STAGE_IC_YAML_TMPL',
'OCNRES', 'waveGRD', 'ntiles',
'OCNRES', 'waveGRD', 'ntiles', 'DO_JEDIOCNVAR',
'REPLAY_ICS', 'DO_WAVE', 'DO_OCN', 'DO_ICE', 'DO_NEST']

stage_dict = AttrDict()
Expand Down

0 comments on commit 863ecee

Please sign in to comment.