Skip to content

Commit

Permalink
Add initial changes to pythonize and yamlize staging
Browse files Browse the repository at this point in the history
- Add initial new yaml files for staging information
- Add new stage.py to python tasks.
- Add first draft pythonization of stage ex-script.

Much more work is still to be done.

Refs NOAA-EMC#2475
  • Loading branch information
KateFriedman-NOAA committed May 14, 2024
1 parent ac9fe80 commit 04d75e3
Show file tree
Hide file tree
Showing 10 changed files with 352 additions and 182 deletions.
6 changes: 6 additions & 0 deletions parm/stage/da.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#for ftype in ['abias', 'abias_pc', 'abias_air', 'radstat']:
da:
name: "DA"
source: "{{ BASE_CPLIC }}/{{ CPL_ICEIC }}/{{ cycle_YMD }}{{ cycle_HH }}/{{ MEMDIR }}/ice"
required:
- "{{ COM_ICE_RESTART_PREV | relpath(ROTDIR) }}/{{ cycle_YMD }}.{{ cycle_HH }}0000.cice_model.res.nc"
36 changes: 36 additions & 0 deletions parm/stage/fv3.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# # First 1/2 cycle also needs a atmos increment if doing warm start
# if inputs.start in ['warm']:
# for ftype in ['atmi003.nc', 'atminc.nc', 'atmi009.nc']:
# if inputs.nens > 0:
#for ftype in ['ratmi003.nc', 'ratminc.nc', 'ratmi009.nc']
fv3:
name: "FV3"
source: "{{ BASE_CPLIC }}/{{ CPL_ATMIC }}/{{ cycle_YMD }}{{ cycle_HH }}/{{ MEMDIR }}/atmos"
required:
#---------------
# WARM START
#---------------
{% if EXP_WARM_START %}
{% set head = "{{ COM_ATMOS_RESTART_PREV | relpath(ROTDIR) }}/{{ cycle_YMD }}.{{ cycle_HH }}0000." %}
{% for ftype in coupler.res fv_core.res.nc %}
- "{{ head }}{{ ftype }}"
{% endfor %}
{% for ftype in ca_data fv_core.res fv_srf_wnd.res fv_tracer.res phy_data sfc_data %}
{% for ntile in $(seq 1 ntiles) %}
- "{{ head }}{{ ftype }}.tile{{ ntile }}.nc"
{% endfor %} # ntile
{% endfor %} # ftype
#--------------- # end warm start
{% else %}
#---------------
# COLD START
#---------------
{% set head = "{{ COM_ATMOS_INPUT | relpath(ROTDIR) }}" %}
- "{{ head }}/gfs_ctrl.nc"
{% for ftype in gfs_data sfc_data %}
{% for ntile in $(seq 1 ntiles) %}
- "{{ head }}/{{ ftype }}.tile{{ ntile }}.nc"
{% endfor %} # ntile
{% endfor %} # ftype
#--------------- # end cold start
{% endif %}
41 changes: 41 additions & 0 deletions parm/stage/fv3_nest.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#WARM
# for ftype in ca_data fv_core.res fv_srf_wnd.res fv_tracer.res phy_data sfc_data; do
# src="${BASE_CPLIC}/${CPL_ATMIC:-}/${PDY}${cyc}/${MEMDIR}/atmos/${PDY}.${cyc}0000.${ftype}.tile${tt}.nc"
# if (( tt > 6 )) ; then
# tgt="${COM_ATMOS_RESTART_PREV}/${PDY}.${cyc}0000.${ftype}.nest0$((tt-5)).tile${tt}.nc"
# fi
#COLD
# for ftype in gfs_data sfc_data; do
# for ((tt = 1; tt <= ntiles; tt++)); do
# src="${BASE_CPLIC}/${CPL_ATMIC:-}/${PDY}${cyc}/${MEMDIR}/atmos/${ftype}.tile${tt}.nc"
# tgt="${COM_ATMOS_INPUT}/${ftype}.tile${tt}.nc"
# if (( ntiles > 6 )); then
# ${NLN} "${COM_ATMOS_INPUT}/${ftype}.tile7.nc" "${COM_ATMOS_INPUT}/${ftype}.nest02.tile7.nc"
fv3:
name: "FV3"
source: "{{ BASE_CPLIC }}/{{ CPL_ATMIC }}/{{ cycle_YMD }}{{ cycle_HH }}/{{ MEMDIR }}/atmos"
{% set ntile = 7 %}
required:
#---------------
# WARM START
#---------------
{% if EXP_WARM_START %}
{% set head = "{{ COM_ATMOS_RESTART_PREV | relpath(ROTDIR) }}/{{ cycle_YMD }}.{{ cycle_HH }}0000." %}
{% set ntile = 7 %}
{% for ftype in ca_data fv_core.res fv_srf_wnd.res fv_tracer.res phy_data sfc_data %}
#TODO: figure out how to copy one name to the other in here
- "{{ head }}{{ ftype }}.nest0{{ ntile-5 }}.tile{{ ntile }}.nc"
{% endfor %} # ftype
#--------------- # end warm start
{% else %}
#---------------
# COLD START
#---------------
{% set head = "{{ COM_ATMOS_INPUT | relpath(ROTDIR) }}" %}
- "{{ head }}/gfs_ctrl.nc"
{% for ftype in gfs_data sfc_data %}
#TODO: figure out how to copy one name to the other in here
- "{{ head }}/{{ ftype }}.tile{{ ntile }}.nc"
{% endfor %} # ftype
#--------------- # end cold start
{% endif %}
5 changes: 5 additions & 0 deletions parm/stage/ice.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ice:
name: "ICE"
source: "{{ BASE_CPLIC }}/{{ CPL_ICEIC }}/{{ cycle_YMD }}{{ cycle_HH }}/{{ MEMDIR }}/ice"
required:
- "{{ COM_ICE_RESTART_PREV | relpath(ROTDIR) }}/{{ cycle_YMD }}.{{ cycle_HH }}0000.cice_model.res.nc"
39 changes: 39 additions & 0 deletions parm/stage/master_forecast_only.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{% set cycle_HH = current_cycle | strftime("%H") %}
{% set cycle_YMD = current_cycle | to_YMD %}
{% set cycle_YMDH = current_cycle | to_YMDH %}
datasets:
{% if EXP_WARM_START %}
{% filter indent(width=4) %}
{% include "fv3.yaml.j2" %}
{% endfilter %}
{% if DO_NEST %}
{% filter indent(width=4) %}
{% include "fv3_nest.yaml.j2" %}
{% endfilter %}
{% endif %}
{% endif %}

{% if DO_WAVE %}
{% if EXP_WARM_START %}
{% filter indent(width=4) %}
{% include "wave.yaml.j2" %}
{% endfilter %}
{% endif %}
{% endif %}

{% if DO_OCEAN %}
{% if EXP_WARM_START %}
{% filter indent(width=4) %}
{% include "ocean.yaml.j2" %}
{% include "mediator.yaml.j2" %}
{% endfilter %}
{% endif %}
{% endif %}

{% if DO_ICE %}
{% if EXP_WARM_START %}
{% filter indent(width=4) %}
{% include "ice.yaml.j2" %}
{% endfilter %}
{% endif %}
{% endif %}
7 changes: 7 additions & 0 deletions parm/stage/mediator.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#src="${BASE_CPLIC}/${CPL_MEDIC:-}/${PDY}${cyc}/${MEMDIR}/med/${PDY}.${cyc}0000.ufs.cpld.cpl.r.nc"
# tgt="${COM_MED_RESTART_PREV}/${PDY}.${cyc}0000.ufs.cpld.cpl.r.nc"
mediator:
name: "MEDIATOR"
source: "{{ BASE_CPLIC }}/{{ CPL_MEDIC }}/{{ cycle_YMD }}{{ cycle_HH }}/{{ MEMDIR }}/med"
required:
- "{{ COM_MED_RESTART_PREV | relpath(ROTDIR) }}/{{ cycle_YMD }}.{{ cycle_HH }}0000.ufs.cpld.cpl.r.nc"
20 changes: 20 additions & 0 deletions parm/stage/ocean.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
ocean:
name: "OCEAN"
source: "{{ BASE_CPLIC }}/{{ CPL_OCNIC }}/{{ cycle_YMD }}{{ cycle_HH }}/{{ MEMDIR }}/ocean"
required:
# Ocean initial conditions
#-------------------------
- "{{ COM_OCEAN_RESTART_PREV | relpath(ROTDIR) }}/{{ cycle_YMD }}.{{ cycle_HH }}0000.MOM.res.nc"
# Resolution based initial conditions
#------------------------------------
#NOTE: {% if OCNRES == 500 or OCNRES == 100 %} # Nothing more to do for these resolutions
{% if OCNRES == 025 %}
{% for nn in $(seq 1 3) %}
- "{{ COM_OCEAN_RESTART_PREV | relpath(ROTDIR) }}/{{ cycle_YMD }}.{{ cycle_HH }}0000.MOM.res_{{ nn }}.nc"
{% endfor %}
{% endif %}
optional:
# Ocean Perturbation Files
#-------------------------
{% if MEMDIR > 0 and USE_OCN_PERTURB_FILES %}
- "{{ COM_OCEAN_RESTART_PREV | relpath(ROTDIR) }}/{{ cycle_YMD }}.{{ cycle_HH }}0000.mom6_increment.nc"
9 changes: 9 additions & 0 deletions parm/stage/wave.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#TODO: these should be placed in $RUN.$gPDY/$gcyc)
wave:
#TODO: check if BASE_CPLIC/CPL_WAVIC exists?
name: "WAVE"
source: "{{ BASE_CPLIC }}/{{ CPL_WAVIC }}/{{ cycle_YMD }}{{ cycle_HH }}/{{ MEMDIR }}/wave"
required:
{% for grdID in waveGRD %}
- "{{ COM_WAVE_RESTART | relpath(ROTDIR) }}/{{ cycle_YMD }}.{{ cycle_HH }}0000.restart.{{ grdID }}"
{% endfor %}
Loading

0 comments on commit 04d75e3

Please sign in to comment.