-
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
Changes from 15 commits
a8a5255
34ef1ba
295e98a
662ef4a
45c23c6
8c0bee5
b727e52
bade5e5
8b2f5de
83a86b3
4469b5a
dab508c
350ce7e
c647205
ac09a81
4711803
6cee909
4c31622
3bd29eb
0027124
977915a
9eb249e
166dca9
d465f57
57508ab
dabb70f
a0e6b2c
741cf9c
934acd6
35130e6
d9ce4cc
b383e1d
e8ed3b9
f5299f3
7ec00e9
733b35e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 }}atmensstat", | ||
DavidHuber-NOAA marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "{{ 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 %} | ||
| 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 %} |
| 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 %} |
Uh oh!
There was an error while loading. Please reload this page.