Skip to content

Merge dev/sfs into develop#4763

Draft
NeilBarton-NOAA wants to merge 260 commits intodevelopfrom
dev/sfs
Draft

Merge dev/sfs into develop#4763
NeilBarton-NOAA wants to merge 260 commits intodevelopfrom
dev/sfs

Conversation

@NeilBarton-NOAA
Copy link
Copy Markdown
Contributor

@NeilBarton-NOAA NeilBarton-NOAA commented Apr 7, 2026

Description

Draft PR to show changes between dev/sfs and develop. dev/sfs is tested bi-weekly(ish) with the CI test and code standards.

Any comments in changes is appreciated with the goal of easing the merge to develop

Major GW-updates include:

  • SFS products
  • SFS post jobs to create products
  • SFS initialization with GFSv17
  • Model Namelist Changes for SFS

Postprocessing for SFS products is dependent on #4733

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)? YES/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?
  • Does this change require an update to any of the following submodules? YES/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?

CI tests run on ursa and c6

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

NeilBarton-NOAA and others added 14 commits April 8, 2026 09:46
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
#---------------------------------------------------------
# LOOP THROUGH EACH DAY OF THE MONTH (1 to month_days)
#---------------------------------------------------------
for ((d = 1; d <= ${month_days}; d++)); do
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[shellcheck] reported by reviewdog 🐶
$/${} is unnecessary on arithmetic variables. SC2004

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
all_inst_exist=true
list_inst=""
for hr in $((end_of_day_fhr - 24)) $((end_of_day_fhr - 18)) $((end_of_day_fhr - 12)) $((end_of_day_fhr - 6)) $((end_of_day_fhr)); do
fpath="${COMIN_ATMOS_MASTER}/sfs.t${cyc}z.master.f$(printf "%03d" $hr).grib2"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[shellcheck] reported by reviewdog 🐶
Prefer double quoting even when variables don't contain special characters. SC2248

all_inst_exist=true
list_inst=""
for hr in $((end_of_day_fhr - 24)) $((end_of_day_fhr - 18)) $((end_of_day_fhr - 12)) $((end_of_day_fhr - 6)) $((end_of_day_fhr)); do
fpath="${COMIN_ATMOS_MASTER}/sfs.t${cyc}z.master.f$(printf "%03d" $hr).grib2"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[shellcheck] reported by reviewdog 🐶
Prefer putting braces around variable references even when not strictly required. SC2250

NeilBarton-NOAA and others added 3 commits April 8, 2026 10:10
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

if [ "$all_inst_exist" = true ]; then
raw_tmp_inst="${tmp_inst_work_dir}/day_${d}_raw.grb"
${GMERGE} "${raw_tmp_inst}" ${list_inst}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

mapfile -t acc_files < <(ls -v "${tmp_acc_work_dir}"/daily_acc*.grb 2>/dev/null)

if [ ${#acc_files[@]} -gt 0 ]; then
echo "INFO: Task $i merging ${#acc_files[@]} days for ACC using array expansion."
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[shellcheck] reported by reviewdog 🐶
Prefer putting braces around variable references even when not strictly required. SC2250

mapfile -t inst_files < <(ls -v "${tmp_inst_work_dir}"/daily_inst*.grb 2>/dev/null)

if [ ${#inst_files[@]} -gt 0 ]; then
echo "INFO: Task $i merging ${#inst_files[@]} days for INST using array expansion."
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[shellcheck] reported by reviewdog 🐶
Prefer putting braces around variable references even when not strictly required. SC2250


if [ "$all_inst_exist" = true ]; then
raw_tmp_inst="${tmp_inst_work_dir}/day_${d}_raw.grb"
${GMERGE} "${raw_tmp_inst}" ${list_inst}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[shellcheck (suggestion)] reported by reviewdog 🐶

Suggested change
${GMERGE} "${raw_tmp_inst}" ${list_inst}
${GMERGE} "${raw_tmp_inst}" "${list_inst}"

NeilBarton-NOAA and others added 2 commits April 8, 2026 10:13
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
end_of_day_fhr=$(((day_offset + d) * 24))

# Skip if we exceed the total available forecast length
if [[ "$end_of_day_fhr" -gt "$lastfhr" ]]; then
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[shfmt] reported by reviewdog 🐶

Suggested change
if [[ "$end_of_day_fhr" -gt "$lastfhr" ]]; then
if [[ "$end_of_day_fhr" -gt "$lastfhr" ]]; then

end_of_day_fhr=$(((day_offset + d) * 24))

# Skip if we exceed the total available forecast length
if [[ "$end_of_day_fhr" -gt "$lastfhr" ]]; then
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[shellcheck] reported by reviewdog 🐶
Prefer putting braces around variable references even when not strictly required. SC2250

end_of_day_fhr=$(((day_offset + d) * 24))

# Skip if we exceed the total available forecast length
if [[ "$end_of_day_fhr" -gt "$lastfhr" ]]; then
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[shellcheck] reported by reviewdog 🐶
Prefer putting braces around variable references even when not strictly required. SC2250

list_acc+="${fpath} "
done

if [[ "$all_acc_exist" = true ]]; then
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[shellcheck] reported by reviewdog 🐶
Prefer putting braces around variable references even when not strictly required. SC2250

Comment on lines +46 to +47
if [[ "$end_of_day_fhr" -gt "$lastfhr" ]]; then
echo "DEBUG: Skipping Day $d because $end_of_day_fhr > $lastfhr"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[shellcheck (suggestion)] reported by reviewdog 🐶

Suggested change
if [[ "$end_of_day_fhr" -gt "$lastfhr" ]]; then
echo "DEBUG: Skipping Day $d because $end_of_day_fhr > $lastfhr"
if [[ "${end_of_day_fhr}" -gt "${lastfhr}" ]]; then
echo "DEBUG: Skipping Day ${d} because ${end_of_day_fhr} > ${lastfhr}"

list_acc+="${fpath} "
done

if [[ "$all_acc_exist" = true ]]; then
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[shellcheck (suggestion)] reported by reviewdog 🐶

Suggested change
if [[ "$all_acc_exist" = true ]]; then
if [[ "${all_acc_exist}" = true ]]; then

all_inst_exist=true
list_inst=""
for hr in $((end_of_day_fhr - 24)) $((end_of_day_fhr - 18)) $((end_of_day_fhr - 12)) $((end_of_day_fhr - 6)) $((end_of_day_fhr)); do
fpath="${COMIN_ATMOS_MASTER}/sfs.t${cyc}z.master.f$(printf "%03d" $hr).grib2"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[shellcheck (suggestion)] reported by reviewdog 🐶

Suggested change
fpath="${COMIN_ATMOS_MASTER}/sfs.t${cyc}z.master.f$(printf "%03d" $hr).grib2"
fpath="${COMIN_ATMOS_MASTER}/sfs.t${cyc}z.master.f$(printf "%03d" "${hr}").grib2"

mapfile -t acc_files < <(ls -v "${tmp_acc_work_dir}"/daily_acc*.grb 2> /dev/null)

if [[ ${#acc_files[@]} -gt 0 ]]; then
echo "INFO: Task $i merging ${#acc_files[@]} days for ACC using array expansion."
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[shellcheck (suggestion)] reported by reviewdog 🐶

Suggested change
echo "INFO: Task $i merging ${#acc_files[@]} days for ACC using array expansion."
echo "INFO: Task ${i} merging ${#acc_files[@]} days for ACC using array expansion."

mapfile -t inst_files < <(ls -v "${tmp_inst_work_dir}"/daily_inst*.grb 2> /dev/null)

if [[ ${#inst_files[@]} -gt 0 ]]; then
echo "INFO: Task $i merging ${#inst_files[@]} days for INST using array expansion."
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[shellcheck (suggestion)] reported by reviewdog 🐶

Suggested change
echo "INFO: Task $i merging ${#inst_files[@]} days for INST using array expansion."
echo "INFO: Task ${i} merging ${#inst_files[@]} days for INST using array expansion."

Comment on lines +227 to +228
for ((i = 0; i < exp_months; i++ )); do

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[shfmt] reported by reviewdog 🐶

Suggested change
for ((i = 0; i < exp_months; i++ )); do
for ((i = 0; i < exp_months; i++)); do

Comment on lines +239 to +241
days_left=$(( total_fcst_days - m_start_day ))

if [[ "${days_left}" -le 0 ]]; then break; fi # No more data
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[shfmt] reported by reviewdog 🐶

Suggested change
days_left=$(( total_fcst_days - m_start_day ))
if [[ "${days_left}" -le 0 ]]; then break; fi # No more data
days_left=$((total_fcst_days - m_start_day))
if [[ "${days_left}" -le 0 ]]; then break; fi # No more data

# 3. Dynamically count tasks and execute
if [[ -s "${cmdfile_s2}" ]]; then
n_tasks=$(wc -l < "${cmdfile_s2}")
echo "INFO: Launching Stage 2 MPMD with ${n_tasks} months."
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[shfmt] reported by reviewdog 🐶

Suggested change
echo "INFO: Launching Stage 2 MPMD with ${n_tasks} months."
echo "INFO: Launching Stage 2 MPMD with ${n_tasks} months."

month_days_in_year=("31" "28" "31" "30" "31" "30" "31" "31" "30" "31" "30" "31")
# Leap Year Check

if [[ $((yy_init % 4)) -eq 0 ]] && ([[ $((yy_init % 100)) -ne 0 ]] || [[ $((yy_init % 400)) -eq 0 ]]); then
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[shellcheck] reported by reviewdog 🐶
Use { ..; } instead of (..) to avoid subshell overhead. SC2235

fi

cmdfile_s3="${DATA}/mpmd_s3_monthly.txt"
> "${cmdfile_s3}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ [shellcheck] reported by reviewdog 🐶
This redirection doesn't have a command. Move to its command (or use 'true' as no-op). SC2188

done

if [[ -s "${cmdfile_s3}" ]]; then
echo "INFO: Launching $(wc -l < ${cmdfile_s3}) monthly mean tasks in parallel."
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

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.

3 participants