Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds staging jinja/yaml file for letkf task #1137

Merged
merged 16 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from 9 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 parm/soca/letkf/letkf.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ background:
members from template:
template:
date: '{{ ATM_WINDOW_MIDDLE }}'
ocn_filename: enkfgdas.ocean.t06z.inst.f009.nc
ice_filename: enkfgdas.ice.t06z.inst.f009.nc
ocn_filename: "enkf{{ RUN }}.ocean.t{{ gcyc }}z.inst.f006.nc"
ice_filename: "enkf{{ RUN }}.ice.t{{ gcyc }}z.inst.f006.nc"
AndrewEichmann-NOAA marked this conversation as resolved.
Show resolved Hide resolved
read_from_file: 1
basename: ./ens/mem%mem%
state variables: [socn, tocn, ssh, uocn, vocn, cicen]
Expand Down
78 changes: 78 additions & 0 deletions parm/soca/letkf/letkf_stage.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
######################################
# set some variables
######################################
{% set gPDY = previous_cycle | to_YMD %}
{% set gcyc = previous_cycle | strftime("%H") %}
{% set PDY = current_cycle | to_YMD %}
{% set cyc = current_cycle | strftime("%H") %}
{% if DOIAU %}
{% set bkg_time = SNOW_WINDOW_BEGIN | to_fv3time %}
AndrewEichmann-NOAA marked this conversation as resolved.
Show resolved Hide resolved
{% else %}
{% set bkg_time = current_cycle | to_fv3time %}
{% endif %}
######################################
# create working directories
######################################
mkdir:
- "{{ DATA }}/bkg"
AndrewEichmann-NOAA marked this conversation as resolved.
Show resolved Hide resolved
- "{{ DATA }}/data_output"
AndrewEichmann-NOAA marked this conversation as resolved.
Show resolved Hide resolved
- "{{ DATA }}/obs"
- "{{ DATA }}/INPUT"
{% for mem in range(1, NMEM_ENS + 1) %}
- "{{ DATA }}/ens/mem{{ '%03d' % mem }}"
{% endfor %}
copy:
######################################
# copy mom input template
######################################
- ["{{ PARMgfs }}/gdas/soca/fms/input.nml", "{{ DATA }}/mom_input.nml.tmpl"]
######################################
# copy ensemble background files
######################################
{% for mem in range(1, NMEM_ENS + 1) %}
# define variables
# Declare a dict of search and replace terms to run on each template
{% set tmpl_dict = {'ROTDIR':ROTDIR,
'RUN':'enkf' + RUN,
'YMD':gPDY,
'HH':gcyc,
'MEMDIR':"mem" + '%03d' % mem} %}

# Replace template variables with tmpl_dict, one key at a time
# This must be done in a namespace to overcome jinja scoping
# Variables set inside of a for loop are lost at the end of the loop
# unless they are part of a namespace
{% set com_prev_ocn = namespace(COM_OCEAN_HISTORY_MEM = COM_OCEAN_HISTORY_TMPL) %}
{% set com_prev_ice = namespace(COM_ICE_HISTORY_MEM = COM_ICE_HISTORY_TMPL) %}
{% for key in tmpl_dict.keys() %}
{% set search_term = '${' + key + '}' %}
{% set replace_term = tmpl_dict[key] %}
{% set com_prev_ocn.COM_OCEAN_HISTORY_MEM = com_prev_ocn.COM_OCEAN_HISTORY_MEM.replace(search_term, replace_term) %}
{% set com_prev_ice.COM_ICE_HISTORY_MEM = com_prev_ice.COM_ICE_HISTORY_MEM.replace(search_term, replace_term) %}
{% endfor %}
- ["{{ com_prev_ocn.COM_OCEAN_HISTORY_MEM }}/enkf{{ RUN }}.ocean.t{{ gcyc }}z.inst.f006.nc", "{{ DATA }}/ens/mem{{ '%03d' % mem }}/enkf{{ RUN }}.ocean.t{{ gcyc }}z.inst.f006.nc"]
- ["{{ com_prev_ice.COM_ICE_HISTORY_MEM }}/enkf{{ RUN }}.ice.t{{ gcyc }}z.inst.f006.nc", "{{ DATA }}/ens/mem{{ '%03d' % mem }}/enkf{{ RUN }}.ice.t{{ gcyc }}z.inst.f006.nc"]
{% endfor %}
######################################
# copy fix files
######################################
# TODO(AFE): maybe make this a separate file to make available to other tasks
AndrewEichmann-NOAA marked this conversation as resolved.
Show resolved Hide resolved
- ["{{ SOCA_INPUT_FIX_DIR }}/rossrad.dat", "{{ DATA }}/rossrad.dat"]
- ["{{ SOCA_INPUT_FIX_DIR }}/field_table", "{{ DATA }}/field_table"]
- ["{{ SOCA_INPUT_FIX_DIR }}/diag_table", "{{ DATA }}/diag_table"]
- ["{{ SOCA_INPUT_FIX_DIR }}/MOM_input", "{{ DATA }}/MOM_input"]
- ["{{ SOCA_INPUT_FIX_DIR }}/fields_metadata.yaml", "{{ DATA }}/fields_metadata.yaml"]
- ["{{ SOCA_INPUT_FIX_DIR }}/obsop_name_map.yaml", "{{ DATA }}/obsop_name_map.yaml"]
- ["{{ SOCA_INPUT_FIX_DIR }}/INPUT/grid_spec.nc", "{{ DATA }}/INPUT/grid_spec.nc"]
- ["{{ SOCA_INPUT_FIX_DIR }}/INPUT/hycom1_25.nc", "{{ DATA }}/INPUT/hycom1_25.nc"]
- ["{{ SOCA_INPUT_FIX_DIR }}/INPUT/layer_coord25.nc", "{{ DATA }}/INPUT/layer_coord25.nc"]
- ["{{ SOCA_INPUT_FIX_DIR }}/INPUT/ocean_hgrid.nc", "{{ DATA }}/INPUT/ocean_hgrid.nc"]
- ["{{ SOCA_INPUT_FIX_DIR }}/INPUT/ocean_mosaic.nc", "{{ DATA }}/INPUT/ocean_mosaic.nc"]
AndrewEichmann-NOAA marked this conversation as resolved.
Show resolved Hide resolved
- ["{{ SOCA_INPUT_FIX_DIR }}/INPUT/ocean_topog.nc", "{{ DATA }}/INPUT/ocean_topog.nc"]
######################################
AndrewEichmann-NOAA marked this conversation as resolved.
Show resolved Hide resolved
# copy deterministic background
######################################
- ["{{ COM_ICE_HISTORY_PREV}}/{{ RUN }}.ice.t{{ gcyc }}z.inst.f006.nc", "{{ DATA }}/bkg/{{ RUN }}.ice.t{{ gcyc }}z.inst.f006.nc"]
- ["{{ COM_ICE_HISTORY_PREV}}/{{ RUN }}.ice.t{{ gcyc }}z.inst.f006.nc", "{{ DATA }}/INPUT/cice.res.nc" ]
- ["{{ COM_OCEAN_HISTORY_PREV}}/{{ RUN }}.ocean.t{{ gcyc }}z.inst.f006.nc", "{{ DATA }}/bkg/{{ RUN }}.ocean.t{{ gcyc }}z.inst.f006.nc"]
- ["{{ COM_OCEAN_HISTORY_PREV}}/{{ RUN }}.ocean.t{{ gcyc }}z.inst.f006.nc", "{{ DATA }}/INPUT/MOM.res.nc"]
AndrewEichmann-NOAA marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion test/soca/gw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ set(jjob_list "JGLOBAL_PREP_OCEAN_OBS"
"JGDAS_GLOBAL_OCEAN_ANALYSIS_BMAT"
"JGDAS_GLOBAL_OCEAN_ANALYSIS_RUN"
"JGDAS_GLOBAL_OCEAN_ANALYSIS_ECEN"
# "JGDAS_GLOBAL_OCEAN_ANALYSIS_LETKF"
# "JGDAS_GLOBAL_OCEAN_ANALYSIS_LETKF"
"JGDAS_GLOBAL_OCEAN_ANALYSIS_CHKPT"
"JGDAS_GLOBAL_OCEAN_ANALYSIS_POST"
"JGDAS_GLOBAL_OCEAN_ANALYSIS_VRFY")
Expand Down
Loading