Skip to content

Commit

Permalink
Update for COMOUT, replay, and add mediator
Browse files Browse the repository at this point in the history
- Convert COM variables to COMOUT variables
- Add mediator IC copy
- Add DTG_PREFIX to filename constructor
- Add replay updates

Refs NOAA-EMC#2475
  • Loading branch information
KateFriedman-NOAA committed Jun 20, 2024
1 parent 31bb29c commit e833c2a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 44 deletions.
30 changes: 17 additions & 13 deletions jobs/JGLOBAL_STAGE_IC
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,32 @@ for MEMDIR in "${MEMDIR_ARRAY[@]}"; do
export MEMDIR

# Declare COMs
YMD=${PDY} HH=${cyc} declare_from_tmpl -rx COM_ATMOS_ANALYSIS
export COM_ATMOS_ANALYSIS
YMD=${PDY} HH=${cyc} declare_from_tmpl -rx COMOUT_ATMOS_ANALYSIS:COM_ATMOS_ANALYSIS_TMPL
export COMOUT_ATMOS_ANALYSIS

if [[ ${EXP_WARM_START:-".false."} = ".true." ]]; then
RUN=${rCDUMP} YMD=${gPDY} HH=${gcyc} declare_from_tmpl COM_ATMOS_RESTART_PREV:COM_ATMOS_RESTART_TMPL
RUN=${rCDUMP} YMD=${gPDY} HH=${gcyc} declare_from_tmpl COM_MED_RESTART_PREV:COM_MED_RESTART_TMPL
export COM_ATMOS_RESTART_PREV COM_MED_RESTART_PREV
RUN=${rCDUMP} YMD=${gPDY} HH=${gcyc} declare_from_tmpl COMOUT_ATMOS_RESTART_PREV:COM_ATMOS_RESTART_TMPL
RUN=${rCDUMP} YMD=${gPDY} HH=${gcyc} declare_from_tmpl COMOUT_MED_RESTART_PREV:COM_MED_RESTART_TMPL
export COMOUT_ATMOS_RESTART_PREV COMOUT_MED_RESTART_PREV
else
YMD=${PDY} HH=${cyc} declare_from_tmpl COM_ATMOS_INPUT
export COM_ATMOS_INPUT
YMD=${PDY} HH=${cyc} declare_from_tmpl COMOUT_ATMOS_INPUT:COM_ATMOS_INPUT_TMPL
export COMOUT_ATMOS_INPUT
fi
if [[ "${DO_OCN:-}" = "YES" ]]; then
RUN=${rCDUMP} YMD=${gPDY} HH=${gcyc} declare_from_tmpl COM_OCEAN_RESTART_PREV:COM_OCEAN_RESTART_TMPL
export COM_OCEAN_RESTART_PREV
RUN=${rCDUMP} YMD=${gPDY} HH=${gcyc} declare_from_tmpl COMOUT_OCEAN_RESTART_PREV:COM_OCEAN_RESTART_TMPL
export COMOUT_OCEAN_RESTART_PREV
fi
if [[ "${REPLAY_ICS:-NO}" = "YES" ]]; then
YMD=${PDY} HH=${cyc} declare_from_tmpl COMOUT_OCEAN_ANALYSIS:COM_OCEAN_ANALYSIS_TMPL
export COMOUT_OCEAN_ANALYSIS
fi
if [[ "${DO_ICE:-}" = "YES" ]]; then
RUN=${rCDUMP} YMD=${gPDY} HH=${gcyc} declare_from_tmpl COM_ICE_RESTART_PREV:COM_ICE_RESTART_TMPL
export COM_ICE_RESTART_PREV
RUN=${rCDUMP} YMD=${gPDY} HH=${gcyc} declare_from_tmpl COMOUT_ICE_RESTART_PREV:COM_ICE_RESTART_TMPL
export COMOUT_ICE_RESTART_PREV
fi
if [[ "${DO_WAVE:-}" = "YES" ]]; then
YMD=${gPDY} HH=${gcyc} declare_from_tmpl COM_WAVE_RESTART_PREV:COM_WAVE_RESTART_TMPL
export COM_WAVE_RESTART_PREV
YMD=${gPDY} HH=${gcyc} declare_from_tmpl COMOUT_WAVE_RESTART_PREV:COM_WAVE_RESTART_TMPL
export COMOUT_WAVE_RESTART_PREV
fi

# Execute staging
Expand Down
60 changes: 30 additions & 30 deletions parm/stage/stage.yaml.j2
Original file line number Diff line number Diff line change
@@ -1,98 +1,98 @@
{% set cycle_HH = current_cycle | strftime("%H") %}
{% set cycle_YMD = current_cycle | to_YMD %}
{% set cycle_YMDH = current_cycle | to_YMDH %}

{% if MODE == "cycled" %}
analysis:
mkdir:
- "{{ COM_ATMOS_ANALYSIS }}"
- "{{ COMOUT_ATMOS_ANALYSIS }}"
copy:
# TODO: Add abias_int?
{% for ftype in ["abias", "abias_air", "abias_pc", "radstat"] %}
- ["{{ ICSDIR }}/{{ COM_ATMOS_ANALYSIS | relpath(ROTDIR) }}/{{ RUN }}.t{{ cycle_HH }}z.{{ ftype }}", "{{ COM_ATMOS_ANALYSIS }}"]
- ["{{ ICSDIR }}/{{ COMOUT_ATMOS_ANALYSIS | relpath(ROTDIR) }}/{{ RUN }}.t{{ cycle_HH }}z.{{ ftype }}", "{{ COMOUT_ATMOS_ANALYSIS }}"]
{% endfor %}
{% endif %}

{% if EXP_WARM_START == True %}
atmosphere_warm:
mkdir:
- "{{ COM_ATMOS_RESTART_PREV }}"
- "{{ COMOUT_ATMOS_RESTART_PREV }}"
copy:
{% for ftype in ["coupler.res", "fv_core.res.nc"] %}
- ["{{ ICSDIR }}/{{ COM_ATMOS_RESTART_PREV | relpath(ROTDIR) }}/{{ DTG_PREFIX }}.{{ ftype }}", "{{ COM_ATMOS_RESTART_PREV }}"]
- ["{{ ICSDIR }}/{{ COMOUT_ATMOS_RESTART_PREV | relpath(ROTDIR) }}/{{ DTG_PREFIX }}.{{ ftype }}", "{{ COMOUT_ATMOS_RESTART_PREV }}"]
{% endfor %}
{% for ftype in ["ca_data", "fv_core.res", "fv_srf_wnd.res", "fv_tracer.res", "phy_data", "sfc_data"] %}
{% for ntile in range(1, ntiles + 1) %}
- ["{{ ICSDIR }}/{{ COM_ATMOS_RESTART_PREV | relpath(ROTDIR) }}/{{ DTG_PREFIX }}.{{ ftype }}.tile{{ ntile }}.nc", "{{ COM_ATMOS_RESTART_PREV }}"]
- ["{{ ICSDIR }}/{{ COMOUT_ATMOS_RESTART_PREV | relpath(ROTDIR) }}/{{ DTG_PREFIX }}.{{ ftype }}.tile{{ ntile }}.nc", "{{ COMOUT_ATMOS_RESTART_PREV }}"]
{% endfor %} # ntile
{% endfor %} # ftype
{% else %}
atmosphere_cold:
mkdir:
- "{{ COM_ATMOS_INPUT }}"
- "{{ COMOUT_ATMOS_INPUT }}"
copy:
- ["{{ ICSDIR }}/{{ COM_ATMOS_INPUT | relpath(ROTDIR) }}/gfs_ctrl.nc", "{{ COM_ATMOS_INPUT }}"]
- ["{{ ICSDIR }}/{{ COMOUT_ATMOS_INPUT | relpath(ROTDIR) }}/gfs_ctrl.nc", "{{ COMOUT_ATMOS_INPUT }}"]
{% for ftype in ["gfs_data", "sfc_data"] %}
{% for ntile in range(1, ntiles + 1) %}
- ["{{ ICSDIR }}/{{ COM_ATMOS_INPUT | relpath(ROTDIR) }}/{{ ftype }}.tile{{ ntile }}.nc", "{{ COM_ATMOS_INPUT }}"]
- ["{{ ICSDIR }}/{{ COMOUT_ATMOS_INPUT | relpath(ROTDIR) }}/{{ ftype }}.tile{{ ntile }}.nc", "{{ COMOUT_ATMOS_INPUT }}"]
{% endfor %} # ntile
{% endfor %} # ftype
{% endif %}

{% if MEMDIR and REPLAY_ICS == "YES" %}
atmosphere_perturbation:
mkdir:
- "{{ COMOUT_ATMOS_ANALYSIS }}"
copy:
- ["{{ ICSDIR }}/{{ COMOUT_ATMOS_ANALYSIS | relpath(ROTDIR) }}/{{ DTG_PREFIX }}.fv3_perturbation.nc", "{{ COMOUT_ATMOS_ANALYSIS }}/{{ RUN }}.t{{ cycle_HH }}z.atminc.nc"]
{% endif %}

{% if DO_NEST %}
atmosphere_nest:
{% set ntile = 7 %}
mkdir:
- "{{ COM_ATMOS_RESTART_PREV }}"
- "{{ COMOUT_ATMOS_RESTART_PREV }}"
copy:
{% if EXP_WARM_START == True %}
{% for ftype in ["ca_data", "fv_core.res", "fv_srf_wnd.res", "fv_tracer.res", "phy_data", "sfc_data"] %}
- ["{{ ICSDIR }}/{{ COM_ATMOS_RESTART_PREV | relpath(ROTDIR) }}/{{ cycle_YMD }}.{{ cycle_HH }}0000.{{ ftype }}.tile{{ ntile }}.nc", "{{ COM_ATMOS_RESTART_PREV }}/{{ cycle_YMD }}.{{ cycle_HH }}0000.{{ ftype }}.nest0{{ ntile-5 }}.tile{{ ntile }}.nc"]
- ["{{ ICSDIR }}/{{ COMOUT_ATMOS_RESTART_PREV | relpath(ROTDIR) }}/{{ DTG_PREFIX }}.{{ ftype }}.tile{{ ntile }}.nc", "{{ COMOUT_ATMOS_RESTART_PREV }}/{{ DTG_PREFIX }}.{{ ftype }}.nest0{{ ntile-5 }}.tile{{ ntile }}.nc"]
{% endfor %} # ftype
{% else %}
{% for ftype in ["gfs_data", "sfc_data"] %}
- ["{{ COM_ATMOS_INPUT }}/{{ ftype }}.tile{{ ntile }}.nc", "{{ COM_ATMOS_INPUT }}/{{ ftype }}.nest0{{ ntile-5 }}.tile{{ ntile }}.nc"]
- ["{{ COMOUT_ATMOS_INPUT }}/{{ ftype }}.tile{{ ntile }}.nc", "{{ COMOUT_ATMOS_INPUT }}/{{ ftype }}.nest0{{ ntile-5 }}.tile{{ ntile }}.nc"]
{% endfor %} # ftype
{% endif %} # cold-start
{% endif %}

{% if DO_WAVE %}
wave:
mkdir:
- "{{ COM_WAVE_RESTART_PREV }}"
- "{{ COMOUT_WAVE_RESTART_PREV }}"
copy:
- ["{{ ICSDIR }}/{{ COM_WAVE_RESTART_PREV | relpath(ROTDIR) }}/{{ cycle_YMD }}.{{ cycle_HH }}0000.restart.{{ waveGRD }}", "{{ COM_WAVE_RESTART_PREV }}"]
- ["{{ ICSDIR }}/{{ COMOUT_WAVE_RESTART_PREV | relpath(ROTDIR) }}/{{ DTG_PREFIX }}.restart.{{ waveGRD }}", "{{ COMOUT_WAVE_RESTART_PREV }}"]
{% endif %}

{% if DO_OCN %}
ocean:
mkdir:
- "{{ COM_OCEAN_RESTART_PREV }}"
- "{{ COMOUT_OCEAN_RESTART_PREV }}"
copy:
#-------------------------
# Ocean initial conditions
#-------------------------
- ["{{ ICSDIR }}/{{ COM_OCEAN_RESTART_PREV | relpath(ROTDIR) }}/{{ cycle_YMD }}.{{ cycle_HH }}0000.MOM.res.nc", "{{ COM_OCEAN_RESTART_PREV }}"]
#------------------------------------
# Resolution based initial conditions
#------------------------------------
- ["{{ ICSDIR }}/{{ COMOUT_OCEAN_RESTART_PREV | relpath(ROTDIR) }}/{{ DTG_PREFIX }}.MOM.res.nc", "{{ COMOUT_OCEAN_RESTART_PREV }}"]
{% if OCNRES == "025" %}
{% for nn in range(1, 3) %}
- ["{{ ICSDIR }}/{{ COM_OCEAN_RESTART_PREV | relpath(ROTDIR) }}/{{ cycle_YMD }}.{{ cycle_HH }}0000.MOM.res_{{ nn }}.nc", "{{ COM_OCEAN_RESTART_PREV }}"]
- ["{{ ICSDIR }}/{{ COMOUT_OCEAN_RESTART_PREV | relpath(ROTDIR) }}/{{ DTG_PREFIX }}.MOM.res_{{ nn }}.nc", "{{ COMOUT_OCEAN_RESTART_PREV }}"]
{% endfor %}
{% endif %}
#-------------------------
# Ocean Perturbation Files
#-------------------------
{% if MEMDIR and REPLAY_ICS == "YES" %}
- ["{{ ICSDIR }}/{{ COM_OCEAN_RESTART_PREV | relpath(ROTDIR) }}/{{ cycle_YMD }}.{{ cycle_HH }}0000.mom6_increment.nc", "{{ COM_OCEAN_RESTART_PREV }}"]
- ["{{ ICSDIR }}/{{ COMOUT_OCEAN_ANALYSIS | relpath(ROTDIR) }}/{{ DTG_PREFIX }}.mom6_perturbation.nc", "{{ COMOUT_OCEAN_ANALYSIS }}/mom6_increment.nc"]
{% endif %}
{% if EXP_WARM_START == True %}
- ["{{ ICSDIR }}/{{ COMOUT_MED_RESTART_PREV | relpath(ROTDIR) }}/{{ DTG_PREFIX }}.ufs.cpld.cpl.r.nc", "{{ COMOUT_MED_RESTART_PREV }}"]
{% endif %}
{% endif %}

{% if DO_ICE %}
ice:
mkdir:
- "{{ COM_ICE_RESTART_PREV }}"
- "{{ COMOUT_ICE_RESTART_PREV }}"
copy:
- ["{{ ICSDIR }}/{{ COM_ICE_RESTART_PREV | relpath(ROTDIR) }}/{{ cycle_YMD }}.{{ cycle_HH }}0000.cice_model.res.nc", "{{ COM_ICE_RESTART_PREV }}"]
- ["{{ ICSDIR }}/{{ COMOUT_ICE_RESTART_PREV | relpath(ROTDIR) }}/{{ DTG_PREFIX }}.cice_model.res.nc", "{{ COMOUT_ICE_RESTART_PREV }}"]
{% endif %}
2 changes: 1 addition & 1 deletion scripts/exglobal_stage_ic.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def main():
'EXP_WARM_START', 'current_cycle', 'CDUMP', 'rCDUMP',
'ROTDIR', 'PARMgfs', 'ICSDIR', 'DTG_PREFIX',
'ntiles', 'MEMDIR', 'REPLAY_ICS',
'DO_WAVE', 'DO_OCN', 'DO_ICE', 'DO_NEST', # TODO: Add DO_MED
'DO_WAVE', 'DO_OCN', 'DO_ICE', 'DO_NEST',
'CPL_ATMIC', 'CPL_ICEIC', 'CPL_OCNIC', 'CPL_WAVIC']

stage_dict = AttrDict()
Expand Down

0 comments on commit e833c2a

Please sign in to comment.