Skip to content

Remove path_exists Calls from stage_ic YAMLs or Move them to link_opt Sections#4492

Draft
AntonMFernando-NOAA wants to merge 30 commits intoNOAA-EMC:developfrom
AntonMFernando-NOAA:maint/path
Draft

Remove path_exists Calls from stage_ic YAMLs or Move them to link_opt Sections#4492
AntonMFernando-NOAA wants to merge 30 commits intoNOAA-EMC:developfrom
AntonMFernando-NOAA:maint/path

Conversation

@AntonMFernando-NOAA
Copy link
Contributor

@AntonMFernando-NOAA AntonMFernando-NOAA commented Jan 29, 2026

Description

Type of change

  • Bug fix (fixes something broken)
  • New feature (adds functionality)
  • Maintenance (code refactor, clean-up, new CI test, etc.)

Change characteristics

  • Is this change expected to change outputs (e.g. value changes to existing outputs, new files stored in COM, files removed from COM, filename changes, additions/subtractions to archives)? NO (If YES, please indicate to which system(s))
    • GFS
    • GEFS
    • SFS
    • GCAFS
  • Is this a breaking change (a change in existing functionality)? NO
  • Does this change require a documentation update? NO
  • Does this change require an update to any of the following submodules? NO (If YES, please add a link to any PRs that are pending.)
    • EMC verif-global
    • GDAS
    • GFS-utils
    • GSI
    • GSI-monitor
    • GSI-utils
    • UFS-utils
    • UFS-weather-model
    • wxflow

How has this been tested?

  • run the stage_ic job on hera and wcoss2 and make sure all necessary files are staged

Checklist

  • Any dependent changes have been merged and published
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have documented my code, including function, input, and output descriptions
  • My changes generate no new warnings
  • New and existing tests pass with my changes
  • This change is covered by an existing CI test or a new one has been added
  • Any new scripts have been added to the .github/CODEOWNERS file with owners
  • I have made corresponding changes to the system documentation if necessary

link_req:
{% if path_exists(ICSDIR ~ "/" ~ COMOUT_CHEM_ANALYSIS | relpath(ROTDIR) ~ "/" ~ RUN ~ ".t" ~ current_cycle_HH ~ "z." ~ ftype) %}
link_opt:
- ["{{ ICSDIR }}/{{ COMOUT_CHEM_ANALYSIS | relpath(ROTDIR) }}/{{ RUN }}.t{{ current_cycle_HH }}z.aero_varbc_params.tar",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bbakernoaa @CoryMartin-NOAA is there a case where the aero_varbc_params.tar file will not be present? Is there a flag available to identify that case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We actually aren't using VarBc for aerosols for GCAFSv1, we thought we might but decided against it. When cycling it makes an empty file I believe. Can we check if it's the first half cycle or not and only expect to copy it when not the first cycle?

@CoryMartin-NOAA
Copy link
Contributor

I haven't looked closely at this, but in general the cold vs warm start needs are significantly different, so might want to keep that in mind

{% endif %}
{% endfor %} # ntile
link_opt:
- ["{{ ICSDIR }}/{{ COMOUT_ATMOS_RESTART_PREV | relpath(ROTDIR) }}/{{ m_prefix }}.atm_stoch.res.nc", "{{ COMOUT_ATMOS_RESTART_PREV }}"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a GEFS-required (and maybe SFS) file. Is that correct @EricSinsky-NOAA?

Copy link
Contributor

@TravisElless-NOAA TravisElless-NOAA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried running the C96C48_hybatmDA ci test on WCOSS. I removed a if path_exists line that are still included in the analysis.yaml.j2 file (line 67). The test failed because the cold start test case was looking for files that would only be present during a warm start. In order to remove all of the path_exists calls there will likely need to be some warm start and cold start flags. I highlighted just a few files in that one block, but should likely be applied throughout the rest of the files.

Comment on lines 65 to 66
{% for ftype in ["increment.atm.i003.nc", "increment.atm.i009.nc",
"recentered_increment.atm.i003.nc", "recentered_increment.atm.i009.nc"] %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are going to be files present only during warm starts, but the cold start tests are trying to access these without line 67. Probably going to need a warm start flag here.

Comment on lines 74 to 75
"increment.atm.i006.nc", "radstat.tar",
"recentered_increment.atm.i006.nc", "rad_varbc_params.tar"] %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Increment files are again warm starts. the abias and radstat files will be needed by both cold and warm. rad_varbc_params is a JEDI file and will need a DO_JEDIVAR=YES flag

@@ -81,21 +84,19 @@ analysis:
{# GSI Soil Analysis (Land DA) #}
{# -------------------------------------------------------------------- #}
{% if DO_GSISOILDA %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably another warm start only file

Comment on lines 7 to 8
- ["{{ ww3_file }}.nc" , "{{ COMOUT_WAVE_RESTART_PREV }}/{{ m_prefix }}.restart.ww3.nc"]
{% else %}
{% if path_exists(ww3_file) %}
- ["{{ ww3_file }}" , "{{ COMOUT_WAVE_RESTART_PREV }}/{{ m_prefix }}.restart.ww3"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AntonMFernando-NOAA I think this is one location where path_exists would be fine to keep. We still need to support the binary and netcdf versions.

What I would suggest is

pseudocode

link_opt:
   if path_exists(ww3_file ~ ".nc")
       - [ ..., ...ww3.nc ]
   else
       - [ ..., ...ww3 ]

In other words, only add one path_exists. If both files are absent, then it should raise a warning.

- "{{ COMOUT_WAVE_RESTART_PREV }}"
link_req:
link_opt:
{% if DO_WAVE %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DO_WAVE here is implied, so I think you can remove it.


{% if path_exists(ICSDIR) %}
{% for ftype in ["MOM.res.nc", "MOM.res_1.nc", "MOM.res_2.nc", "MOM.res_3.nc"] %}
{% if DO_OCN %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, DO_OCN is implied.

mkdir:
- "{{ COMOUT_MED_RESTART_PREV }}"
link_req:
{% if DO_OCN and EXP_WARM_START %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only needs to be EXP_WARM_START as DO_OCN is implied.

"increment.atm.i006.nc", "increment.atm.i009.nc", "increment.atm.i003.nc", "radstat.tar",
"recentered_increment.atm.i006.nc", "recentered_increment.atm.i009.nc", "recentered_increment.atm.i003.nc", "rad_varbc_params.tar"] %}
{% if path_exists(ICSDIR ~ "/" ~ COMOUT_ATMOS_ANALYSIS | relpath(ROTDIR) ~ "/" ~ RUN ~ ".t" ~ current_cycle_HH ~ "z." ~ ftype) %}
{% if DOIAU or DOIAU_ENKF %}
Copy link
Contributor

@DavidHuber-NOAA DavidHuber-NOAA Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be worth it to check the RUN in stage_ic.py and set doiau = DOIAU for deterministic and doiau = DOIAU_ENKF for ensemble RUNs. Then you could just check for doiau here. Not sure if that is easier/harder.

{# Cubed Sphere Grid Configuration #}
{% if ATMINC_GRID == "cubed_sphere_grid" %}

{% if (DO_JEDIATMVAR or DO_JEDIATMENS) and EXP_WARM_START %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, perhaps setting do_jediatm in stage_ic.py based on the RUN. Again, not sure that is easier/harder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove path_exists calls from stage_ic YAMLs or move them to link_opt sections

4 participants