-
Notifications
You must be signed in to change notification settings - Fork 207
Refactor Local Archiving: Move YAML Logic to archive_vars.py and Handle Ensemble/Deterministic Archiving #4298
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
Merged
DavidHuber-NOAA
merged 36 commits into
NOAA-EMC:develop
from
AntonMFernando-NOAA:enabler/archive
Dec 11, 2025
Merged
Changes from 19 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
a8a5255
Archive Verify (-ens) var creation
AntonMFernando-NOAA 34ef1ba
arch_vrfy var creation yamls and exscripts
AntonMFernando-NOAA 295e98a
create nested function ush/python/pygfs/task/archive_vars.py
AntonMFernando-NOAA 662ef4a
add missing key default
AntonMFernando-NOAA 45c23c6
update ush/python/pygfs/task/archive_vars.py
AntonMFernando-NOAA 8c0bee5
update all files
AntonMFernando-NOAA b727e52
update yamls and arch.py
AntonMFernando-NOAA bade5e5
update ush/python/pygfs/task/archive_vars.py
AntonMFernando-NOAA 8b2f5de
add filehandler logic
AntonMFernando-NOAA 83a86b3
edits yamls to look more clean
AntonMFernando-NOAA 4469b5a
further edits to yamls
AntonMFernando-NOAA dab508c
tabbed jinja
AntonMFernando-NOAA 350ce7e
resolve conflicts
AntonMFernando-NOAA c647205
resolve conflicts
AntonMFernando-NOAA ac09a81
Merge branch 'NOAA-EMC:develop' into enabler/archive
AntonMFernando-NOAA 4711803
Merge remote-tracking branch 'origin/develop' into enabler/archive
AntonMFernando-NOAA 6cee909
typo
AntonMFernando-NOAA 4c31622
addressed suggestions
AntonMFernando-NOAA 3bd29eb
typo
AntonMFernando-NOAA 0027124
update class attributes
AntonMFernando-NOAA 977915a
update scripts/exglobal_enkf_earc_vrfy.py
AntonMFernando-NOAA 9eb249e
Merge remote-tracking branch 'origin/develop' into enabler/archive
AntonMFernando-NOAA 166dca9
changed location head string
AntonMFernando-NOAA d465f57
Merge branch 'NOAA-EMC:develop' into enabler/archive
AntonMFernando-NOAA 57508ab
added suggestions
AntonMFernando-NOAA dabb70f
corrected a typo
AntonMFernando-NOAA a0e6b2c
update comments
AntonMFernando-NOAA 741cf9c
Merge branch 'NOAA-EMC:develop' into enabler/archive
AntonMFernando-NOAA 934acd6
Update dev/scripts/exglobal_archive_vrfy.py
AntonMFernando-NOAA 35130e6
Update dev/scripts/exglobal_enkf_earc_vrfy.py
AntonMFernando-NOAA d9ce4cc
Update ush/python/pygfs/utils/archive_vars.py
AntonMFernando-NOAA b383e1d
change copy_req to copy_opt
AntonMFernando-NOAA e8ed3b9
typo
AntonMFernando-NOAA f5299f3
suggestions
AntonMFernando-NOAA 7ec00e9
Merge branch 'NOAA-EMC:develop' into enabler/archive
AntonMFernando-NOAA 733b35e
typo
AntonMFernando-NOAA File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # Variables provided by archive_vars.py: | ||
| # - cycle_HH, cycle_YMDH, cycle_YMD, head | ||
| # - ARCDIR | ||
| # - All COMIN_* paths | ||
|
|
||
| # Ensemble (EnKF) archiving template | ||
| # Used for: enkfgdas, enkfgfs, enkfgcafs, enkfgcdas | ||
|
|
||
| mkdir: | ||
| - "{{ ARCDIR }}" | ||
|
|
||
| copy_req: | ||
| # Ensemble analysis statistics - REQUIRED | ||
| {% if DO_JEDIATMENS == True %} | ||
| - ["{{ COMIN_ATMOS_ANALYSIS_ENSSTAT }}/{{ head }}stat.atm.tar", | ||
| "{{ ARCDIR }}/atmensstat.{{ RUN }}.{{ cycle_YMDH }}"] | ||
| {% else %} | ||
| - ["{{ COMIN_ATMOS_ANALYSIS_ENSSTAT }}/{{ head }}enkfstat.txt", | ||
| "{{ ARCDIR }}/enkfstat.{{ RUN }}.{{ cycle_YMDH }}"] | ||
| - ["{{ COMIN_ATMOS_ANALYSIS_ENSSTAT }}/{{ head }}gsistat_ensmean.txt", | ||
| "{{ ARCDIR }}/gsistat.{{ RUN }}.{{ cycle_YMDH }}.ensmean"] | ||
| {% endif %} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,107 +1,55 @@ | ||
| {% set cycle_HH = current_cycle | strftime("%H") %} | ||
| {% set cycle_YMDH = current_cycle | to_YMDH %} | ||
| {% set cycle_YMD = current_cycle | to_YMD %} | ||
| {% set head = RUN + ".t" + cycle_HH + "z." %} | ||
| # Variables provided by archive_vars.py: | ||
| # - cycle_HH, cycle_YMDH, cycle_YMD, head | ||
| # - VFYARC | ||
| # - All COMIN_* paths | ||
|
|
||
| # Select data to store in the ARCDIR and VFYARC from deterministic runs | ||
| # This file set will contain all source-destination pairs to send to the FileHandler for copying | ||
| {% set file_set = [] %} | ||
| # Deterministic GCAFS/GCDAS archiving template | ||
| # Used for: gcafs, gcdas | ||
|
|
||
| # Declare the VFYARC where Fit2Obs data will be sent | ||
| {% set VFYARC = ROTDIR ~ "/vrfyarch" %} | ||
|
|
||
| # Deterministic files | ||
| {% if "enkf" not in RUN %} | ||
| # Common files to be added to both the gcafs and gcdas keys below | ||
| {% set det_files = [] %} | ||
|
|
||
| # Deterministic analysis files (generated for cycled experiments) | ||
| {% set det_anl_files = [] %} | ||
|
|
||
| {% if DO_AERO_ANL %} | ||
| {% do det_anl_files.append([COMIN_CHEM_ANALYSIS ~ "/" ~ head ~ "aerostat.tgz", | ||
| ARCDIR ~ "/aerostat." ~ RUN ~ "." ~ cycle_YMDH ~ ".tgz"]) %} | ||
| {% endif %} | ||
|
|
||
| {% if DO_PREP_OBS_AERO == True %} | ||
| {% do det_anl_files.append([COMIN_OBS ~ "/" ~ head ~ "aeroobs", | ||
| ARCDIR ~ "/aeroobs." ~ RUN ~ "." ~ cycle_YMDH]) %} | ||
| {% do det_anl_files.append([COMIN_OBS ~ "/" ~ head ~ "aeroawobs", | ||
| ARCDIR ~ "/aeroawobs." ~ RUN ~ "." ~ cycle_YMDH]) %} | ||
| {% endif %} | ||
| mkdir: | ||
| - "{{ ARCDIR }}" | ||
| {% if DO_FIT2OBS == True %} | ||
| - "{{ VFYARC }}/{{ RUN }}.{{ cycle_YMD }}/{{ cycle_HH }}" | ||
| {% endif %} | ||
|
|
||
| # GCAFS-specific files | ||
| {% set gfs_files = [] %} | ||
| copy_req: | ||
| {% if RUN == "gcafs" %} | ||
| # GCAFS forecast files - REQUIRED | ||
| {% for fhr in range(0, FHMAX_GFS + 1, FHOUT_GFS) %} | ||
| {% do gfs_files.append([COMIN_ATMOS_GRIB_1p00 ~ "/" ~ head ~ "pres_a.1p00.f" ~ '%03d'|format(fhr) ~ ".grib2", | ||
| ARCDIR ~ "/pgbf" ~ '%02d'|format(fhr) ~ "." ~ RUN ~ "." ~ cycle_YMDH ~ ".grib2"]) %} | ||
| - ["{{ COMIN_ATMOS_GRIB_1p00 }}/{{ head }}pres_a.1p00.f{{ '%03d'|format(fhr) }}.grib2", | ||
| "{{ ARCDIR }}/pgbf{{ '%02d'|format(fhr) }}.{{ RUN }}.{{ cycle_YMDH }}.grib2"] | ||
| {% endfor %} | ||
|
|
||
| # GCAFS Fit2Obs data | ||
| {% set fit2obs_files = [] %} | ||
| {% for fhr in range(0, FHMAX_FITS + 1, 6) %} | ||
| {% set sfcfile = "/" + head + "sfc.f" + '%03d'|format(fhr) + ".nc" %} | ||
| {% set sigfile = "/" + head + "atm.f" + '%03d'|format(fhr) + ".nc" %} | ||
| {% do fit2obs_files.append([COMIN_ATMOS_HISTORY ~ "/" ~ sfcfile, | ||
| VFYARC ~ "/" ~ RUN ~ "." ~ cycle_YMD ~ "/" ~ cycle_HH ~ "/" ~ sfcfile ]) %} | ||
| {% do fit2obs_files.append([COMIN_ATMOS_HISTORY ~ "/" ~ sigfile, | ||
| VFYARC ~ "/" ~ RUN ~ "." ~ cycle_YMD ~ "/" ~ cycle_HH ~ "/" ~ sigfile ]) %} | ||
| {% endfor %} | ||
| {% if DO_FIT2OBS == True %} | ||
| # GCAFS Fit2Obs data - REQUIRED if DO_FIT2OBS is enabled | ||
| {% for fhr in range(0, FHMAX_FITS + 1, 6) %} | ||
| - ["{{ COMIN_ATMOS_HISTORY }}/{{ head }}sfc.f{{ '%03d'|format(fhr) }}.nc", | ||
| "{{ VFYARC }}/{{ RUN }}.{{ cycle_YMD }}/{{ cycle_HH }}/{{ head }}sfc.f{{ '%03d'|format(fhr) }}.nc"] | ||
| - ["{{ COMIN_ATMOS_HISTORY }}/{{ head }}atm.f{{ '%03d'|format(fhr) }}.nc", | ||
| "{{ VFYARC }}/{{ RUN }}.{{ cycle_YMD }}/{{ cycle_HH }}/{{ head }}atm.f{{ '%03d'|format(fhr) }}.nc"] | ||
| {% endfor %} | ||
| {% endif %} | ||
| {% endif %} | ||
|
|
||
| # GCDAS-specific files | ||
| {% set gdas_files = [] %} | ||
| {% if RUN == "gcdas" %} | ||
| # GCDAS forecast files - REQUIRED | ||
| {% for fhr in range(0, FHMAX + 1, FHOUT) %} | ||
| {% do gdas_files.append([COMIN_ATMOS_GRIB_1p00 ~ "/" ~ head ~ "pres_a.1p00.f" ~ '%03d'|format(fhr) ~ ".grib2", | ||
| ARCDIR ~ "/pgbf" ~ '%02d'|format(fhr) ~ "." ~ RUN ~ "." ~ cycle_YMDH ~ ".grib2"]) %} | ||
| - ["{{ COMIN_ATMOS_GRIB_1p00 }}/{{ head }}pres_a.1p00.f{{ '%03d'|format(fhr) }}.grib2", | ||
| "{{ ARCDIR }}/pgbf{{ '%02d'|format(fhr) }}.{{ RUN }}.{{ cycle_YMDH }}.grib2"] | ||
| {% endfor %} | ||
| {% endif %} | ||
|
|
||
| # Now append the necessary file pairs to file_set | ||
| # Common deterministic files | ||
| {% set file_set = file_set + det_files %} | ||
| {% if MODE == "cycled" %} | ||
| {% set file_set = file_set + det_anl_files %} | ||
| {% endif %} | ||
|
|
||
| # Run-specific deterministic files | ||
| {% if RUN == "gcafs" %} | ||
| {% set file_set = file_set + gfs_files %} | ||
| # Fit2Obs files | ||
| {% if DO_FIT2OBS == True %} | ||
| {% set file_set = file_set + fit2obs_files %} | ||
| {% endif %} | ||
| {% elif RUN == "gcdas" %} | ||
| {% set file_set = file_set + gdas_files %} | ||
| {% if MODE == "cycled" %} | ||
| # Deterministic analysis files (cycled mode only) - REQUIRED | ||
| {% if DO_AERO_ANL %} | ||
| - ["{{ COMIN_CHEM_ANALYSIS }}/{{ head }}aerostat.tgz", | ||
| "{{ ARCDIR }}/aerostat.{{ RUN }}.{{ cycle_YMDH }}.tgz"] | ||
| {% endif %} | ||
|
|
||
| {% else %} # End of deterministic files | ||
|
|
||
| # Ensemble analysis files | ||
| {% set enkf_files = [] %} | ||
| {% if DO_JEDIATMENS == True %} | ||
| {% do enkf_files.append([COMIN_ATMOS_ANALYSIS_ENSSTAT ~ "/" ~ head ~ "atmensstat", | ||
| ARCDIR ~ "/atmensstat." ~ RUN ~ "." ~ cycle_YMDH ]) %} | ||
| {% else %} | ||
| {% do enkf_files.append([COMIN_ATMOS_ANALYSIS_ENSSTAT ~ "/" ~ head ~ "enkfstat.txt", | ||
| ARCDIR ~ "/enkfstat." ~ RUN ~ "." ~ cycle_YMDH ]) %} | ||
| {% do enkf_files.append([COMIN_ATMOS_ANALYSIS_ENSSTAT ~ "/" ~ head ~ "gsistat_ensmean.txt", | ||
| ARCDIR ~ "/gsistat." ~ RUN ~ "." ~ cycle_YMDH ~ ".ensmean"]) %} | ||
| {% if DO_PREP_OBS_AERO == True %} | ||
| - ["{{ COMIN_OBS }}/{{ head }}aeroobs", | ||
| "{{ ARCDIR }}/aeroobs.{{ RUN }}.{{ cycle_YMDH }}"] | ||
| - ["{{ COMIN_OBS }}/{{ head }}aeroawobs", | ||
| "{{ ARCDIR }}/aeroawobs.{{ RUN }}.{{ cycle_YMDH }}"] | ||
| {% endif %} | ||
|
|
||
| # Construct the final file set | ||
| {% set file_set = file_set + enkf_files %} | ||
|
|
||
| {% endif %} | ||
|
|
||
|
|
||
| # Actually write the yaml | ||
| mkdir: | ||
| - "{{ ARCDIR }}" | ||
|
|
||
| {% if DO_FIT2OBS == True %} | ||
| - "{{ VFYARC }}/{{ RUN }}.{{ cycle_YMD }}/{{ cycle_HH }}" | ||
| {% endif %} | ||
|
|
||
| copy: | ||
| {% for source_dest_pair in file_set %} | ||
| - {{ source_dest_pair }} | ||
| {% endfor %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,36 +1,17 @@ | ||
| {% set cycle_HH = current_cycle | strftime("%H") %} | ||
| {% set cycle_YMDH = current_cycle | to_YMDH %} | ||
| {% set cycle_YMD = current_cycle | to_YMD %} | ||
| {% set head = RUN + ".t" + cycle_HH + "z." %} | ||
| # Variables provided by archive_vars.py: | ||
| # - cycle_HH, cycle_YMDH, cycle_YMD, head | ||
| # - VFYARC (archive directory) | ||
| # - COMIN_ATMOS_ENSSTAT_1p00 (calculated in Python with MEMDIR='ensstat') | ||
|
|
||
| # Declare the GEFS_ARCH where atmos data will be sent | ||
| {% set GEFS_ARCH = ROTDIR ~ "/gefsarch" %} | ||
|
|
||
| {% set file_set = [] %} | ||
|
|
||
| {% set tmpl_dict = ({ '${ROTDIR}':ROTDIR, | ||
| '${RUN}':RUN, | ||
| '${YMD}':cycle_YMD, | ||
| '${HH}':cycle_HH, | ||
| '${GRID}': '1p00', | ||
| '${MEMDIR}': 'ensstat' }) %} | ||
|
|
||
| {% set COMIN_ATMOS_ENSSTAT_1p00 = COM_ATMOS_GRIB_GRID_TMPL | replace_tmpl(tmpl_dict) %} | ||
| # Create directories first | ||
| mkdir: | ||
| - "{{ VFYARC }}" | ||
|
|
||
| # Select ensstat files to copy to the arcdir | ||
| {% set ensstat_files = [] %} | ||
| {% if path_exists(COMIN_ATMOS_ENSSTAT_1p00) %} | ||
| # Define all source-destination pairs for archiving | ||
| # Use copy_req for files that MUST exist (raise error if missing) | ||
| copy_req: | ||
| # GEFS ensemble mean forecast files - REQUIRED | ||
| {% for fhr in range(FHMIN_GFS, FHMAX_GFS + FHOUT_GFS, FHOUT_GFS) %} | ||
| {% do ensstat_files.append([COMIN_ATMOS_ENSSTAT_1p00 ~ "/" ~ head ~ "mean.pres_." ~ | ||
| "1p00" ~ ".f" ~ '%03d'|format(fhr) ~ ".grib2", | ||
| GEFS_ARCH]) %} | ||
| - ["{{ COMIN_ATMOS_ENSSTAT_1p00 }}/{{ head }}mean.pres_.1p00.f{{ '%03d'|format(fhr) }}.grib2", | ||
| "{{ VFYARC }}/{{ head }}mean.pres_.1p00.f{{ '%03d'|format(fhr) }}.grib2"] | ||
| {% endfor %} | ||
| {% endif %} | ||
| {% set file_set = ensstat_files %} | ||
| # Actually write the yaml | ||
| mkdir: | ||
| - "{{ GEFS_ARCH }}" | ||
| copy: | ||
| {% for source_dest_pair in file_set %} | ||
| - {{ source_dest_pair }} | ||
| {% endfor %} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is a
copy_optshould this comment say this files are optional or is the comment correct that these are required files and should becopy_req?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Removed
Required.