Skip to content

Conversation

@bbakernoaa
Copy link
Contributor

@bbakernoaa bbakernoaa commented May 20, 2025

Description

Resolves #3712
Resolves #3827
Resolves #4248

This pull request introduces significant updates to the aerosol configuration and emission handling in the UFS-Aerosols system, streamlining file management, improving modularity, and consolidating configuration files. Key changes include restructuring aerosol configuration files, enhancing biomass burning emissions handling, and updating the chemical input file linking process.

Aerosol Configuration Updates:

  • Refactored config.aero.j2 to organize settings into distinct sections for aerosol and emission configurations, including the addition of new variables like AERO_EMIS_FIRE_VERSION and AERO_EMIS_FIRE_HIST. [1] [2]

Emission Data Management:

  • Consolidated multiple emission configuration files (ExtData.gbbepx, ExtData.qfed, and ExtData.none) into a single file, AERO_ExtData.rc, for better modularity and maintainability. Removed redundant and unused emission entries. [1] [2] [3] [4]

Chemical Input File Handling:

  • Added linking of chemical input files (CHEM_INPUT) in forecast_predet.sh to ensure proper file availability during runtime.

Removal of Legacy Code:

  • Removed the automated generation of AERO_ExtData.rc in parsing_namelists_GOCART.sh, as the new consolidated configuration file eliminates the need for dynamic generation.

Additional Updates:

  • Updated config.com to include new template paths for chemical restart and input files, improving file organization.

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 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
    • EMC verif-global
    • GDAS
    • GFS-utils
    • GSI
    • GSI-monitor
    • GSI-utils
    • UFS-utils
    • UFS-weather-model
    • wxflow

How has this been tested?

  • GCAFS noDA cycled on URSA

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

@CoryMartin-NOAA CoryMartin-NOAA requested a review from Copilot May 20, 2025 20:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request updates aerosol configuration and emissions handling for the UFS-Aerosols system by consolidating file management and enhancing modularity. Key changes include:

  • Removing legacy logic for generating the AERO_ExtData.rc file and consolidating emission configuration files.
  • Adding a link to chemical input files in forecast_predet.sh and updating configuration templates in both aerosol and chemical configuration files.
  • Refactoring configuration files to improve clarity and maintainability.

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
ush/parsing_namelists_GOCART.sh Removed legacy dynamic generation of AERO_ExtData.rc.
ush/forecast_predet.sh Added linking for CHEM_INPUT to ensure chemical input file availability.
parm/ufs/gocart/ExtData.* Removed obsolete emission configuration files, consolidating them into AERO_ExtData.rc.
parm/ufs/gocart/AERO_ExtData.rc Updated emission entries to use chemical input paths and adjusted emission factors.
parm/chem/chem_emission.yaml.j2 Updated templating loops for QFED variables and file copying operations.
dev/parm/config/gfs/config.com Added new chemical template paths.
dev/parm/config/gcafs/config.aero.j2 Reorganized aerosol sections and introduced new aerosol emission settings.

@bbakernoaa bbakernoaa force-pushed the feature/prep_emis_rework branch from 2e06fb3 to b534a8b Compare July 31, 2025 19:47
@bbakernoaa bbakernoaa marked this pull request as ready for review August 7, 2025 15:21
@bbakernoaa bbakernoaa requested a review from aerorahul as a code owner August 7, 2025 15:21
@CoryMartin-NOAA
Copy link
Contributor

@bbakernoaa is this ready now after conflicts are resolved?

@bbakernoaa
Copy link
Contributor Author

@CoryMartin-NOAA Yes all tests passed on wcoss2.

I submitted with this command

./generate_workflows.sh -A GEFS-DEV -E -G -C -S /lfs/h2/emc/ptmp/barry.baker/GW_RTs

CoryMartin-NOAA
CoryMartin-NOAA previously approved these changes Dec 9, 2025
@emcbot emcbot added CI-Gaeac6-Ready **CM use only** PR is ready for CI testing on Gaea C6 CI-Hercules-Ready **CM use only** PR is ready for CI testing on Hercules CI-Ursa-Ready **CM use only** PR is ready for CI testing on Ursa CI-Ursa-Building **Bot use only** CI testing is cloning/building on Ursa CI-Gaeac6-Building **Bot use only** CI testing is cloning/building on Gaea C6 CI-Hercules-Building **Bot use only** CI testing is cloning/building on Hercules and removed CI-Ursa-Ready **CM use only** PR is ready for CI testing on Ursa CI-Gaeac6-Ready **CM use only** PR is ready for CI testing on Gaea C6 CI-Hercules-Ready **CM use only** PR is ready for CI testing on Hercules labels Dec 9, 2025
Copy link
Contributor

@aerorahul aerorahul left a comment

Choose a reason for hiding this comment

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

A few comments that should not be breaking anything, I hope

export tasks_per_node=$(( max_tasks_per_node / threads_per_task ))
export threads_per_task=${max_tasks_per_node}
export tasks_per_node=1
export OMP_NUM_THREADS="${threads_per_task}"
Copy link
Contributor

Choose a reason for hiding this comment

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

This is usually reserved till the executable is called. Perhaps in a follow-up PR.

export memory="1GB"
export threads_per_task=${max_tasks_per_node}
export tasks_per_node=1
export OMP_NUM_THREADS="${threads_per_task}"
Copy link
Contributor

Choose a reason for hiding this comment

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

same comment as before.

export memory="1GB"
export threads_per_task=${max_tasks_per_node}
export tasks_per_node=1
export OMP_NUM_THREADS="${threads_per_task}"
Copy link
Contributor

Choose a reason for hiding this comment

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

same

Comment on lines +758 to +804
# Create the ChemInput directory in the local run directory

# if [[ ! -d "${DATA}/ChemInput" ]]; then mkdir -p "${DATA}/ChemInput"; fi

# # Copy Fire Emission Files ChemInput directory
# local current
# local YYYYMMDDHH
# current="${current_cycle_begin}"
# cycleend=$(date -d "${current_cycle_end:0:8} ${current_cycle_end:8:2} +24 hour" +%Y%m%d%H)
# while [[ "${current}" -le "${cycleend}" ]]; do
# # Validate current is a valid date string
# if ! YYYYMMDD=$(date -d "${current:0:8} ${current:8:2}:00:00" +%Y%m%d 2>/dev/null); then
# echo "FATAL ERROR: Invalid date string '${current}' in GOCART_predet, ABORT!"
# exit 1
# fi
# local FireEmisFile="${COMIN_CHEM_INPUT}/FIRE_EMIS_${YYYYMMDD}.nc"
# if [[ -f "${FireEmisFile}" ]]; then
# cpreq "${FireEmisFile}" "${DATA}/ChemInput/"
# else
# echo "FATAL ERROR: GOCART input file '${FireEmisFile}' does not exist, ABORT!"
# exit 1
# fi

# # Increment by 1 day
# current=$(date -d "${current:0:8} ${current:8:2} +1 day" +%Y%m%d%H)
# done

# # Copy NXS Emission Files ChemInput directory
# # NXS files are hourly, so we need to loop through each hour in the cycle
# current=$(date -d "${current_cycle_begin:0:8} ${current_cycle_begin:8:2}" +%Y%m%d%H)
# cycleend=$(date -d "${current_cycle_end:0:8} ${current_cycle_end:8:2} +1 hour" +%Y%m%d%H)
# while [[ "${current}" -le "${cycleend}" ]]; do
# if ! YYYYMMDD=$(date -d "${current:0:8} ${current:8:2}:00:00" +%Y%m%d 2>/dev/null); then
# echo "FATAL ERROR: Invalid date string '${current}' in GOCART_predet, ABORT!"
# exit 1
# fi
# local NXSFile="${COMIN_CHEM_INPUT}/${NEXUS_DIAG_PREFIX}.${YYYYMMDD}.nc"
# if [[ -f "${NXSFile}" ]]; then
# cpreq "${NXSFile}" "${DATA}/ChemInput/"
# else
# echo "FATAL ERROR: GOCART input file '${NXSFile}' does not exist, ABORT!"
# exit 1
# fi
# # Increment by 1 hour
# current=$(date -d "${current:0:8} ${current:8:2} +1 hour" +%Y%m%d%H)
# done

Copy link
Contributor

Choose a reason for hiding this comment

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

why are we keeping this large commented section?

Copy link
Contributor

Choose a reason for hiding this comment

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

@bbakernoaa Can you please add yourself as a CODEOWNER for this and the next file please?

Comment on lines +776 to +777
logger.error(f"Error combining QFED files: {e}")
logger.error(f"Traceback: {traceback.format_exc()}")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be a Warning? An Error should stop processing, a warning can continue with processing

logger.info(f"Number of forecast hours: {nforecast_hours}")

# Create start date based on SDATE
self.start_date = self.task_config["CDATE"] - to_timedelta('24H') # include previous day
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 we eliminated the use of CDATE. Here, you can use current_cycle

logger.info(f"Start date: {self.start_date}")

# end date = SDATE + nforecast hours + 36
self.end_date = self.task_config["CDATE"] + to_timedelta(f'{nforecast_hours + 36}H')
Copy link
Contributor

Choose a reason for hiding this comment

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

same.

nforecast_hours = self.task_config["FHMAX_GFS"]

# Create start date based on SDATE
self.start_date = self.task_config["CDATE"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Use current_cycle

# Create start date based on SDATE
self.start_date = self.task_config["CDATE"]
self.total_hrs = nforecast_hours + 3
self.end_date = self.task_config["CDATE"] + to_timedelta(f'{self.total_hrs}H')
Copy link
Contributor

Choose a reason for hiding this comment

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

current_cycle in place of CDATE.

@bbakernoaa
Copy link
Contributor Author

@aerorahul I don't think any of these will break it. I'll fix it first thing tomorrow

@emcbot emcbot added CI-Hercules-Running **Bot use only** CI testing on Hercules for this PR is in-progress and removed CI-Hercules-Building **Bot use only** CI testing is cloning/building on Hercules labels Dec 9, 2025
@emcbot
Copy link

emcbot commented Dec 9, 2025

C96_gcafs_cycled FAILED on Hercules (pipeline ID: 6185)

In directory: /work2/noaa/global/role-global/GFS_CI_CD/HERCULES/BUILDS/GITLAB/pr_cases_3713_cf7039af_6185/RUNTESTS/EXPDIR/C96_gcafs_cycled_cf7039af-6185

This failure was detected automatically by global-workflow's CI/CD Pipeline

@emcbot emcbot added CI-Hercules-Failed **Bot use only** CI testing on Hercules for this PR has failed CI-Gaeac6-Running **Bot use only** CI testing on Gaea C6 for this PR is in-progress and removed CI-Hercules-Running **Bot use only** CI testing on Hercules for this PR is in-progress CI-Gaeac6-Building **Bot use only** CI testing is cloning/building on Gaea C6 labels Dec 9, 2025
@emcbot
Copy link

emcbot commented Dec 9, 2025

C96_gcafs_cycled_noDA FAILED on Gaeac6 (pipeline ID: 6185)

In directory: /gpfs/f6/drsa-precip3/world-shared/global/CI/GITLAB/pr_cases_3713_cf7039af_6185/RUNTESTS/EXPDIR/C96_gcafs_cycled_noDA_cf7039af-6185

This failure was detected automatically by global-workflow's CI/CD Pipeline

@emcbot emcbot added CI-Gaeac6-Failed **Bot use only** CI testing on Gaea C6 for this PR has failed and removed CI-Gaeac6-Running **Bot use only** CI testing on Gaea C6 for this PR is in-progress labels Dec 9, 2025
@emcbot
Copy link

emcbot commented Dec 9, 2025

C96_gcafs_cycled FAILED on Gaeac6 (pipeline ID: 6185)

In directory: /gpfs/f6/drsa-precip3/world-shared/global/CI/GITLAB/pr_cases_3713_cf7039af_6185/RUNTESTS/EXPDIR/C96_gcafs_cycled_cf7039af-6185

This failure was detected automatically by global-workflow's CI/CD Pipeline

@bbakernoaa
Copy link
Contributor Author

@aerorahul I fixed why it was crashing. The cycledef in the prep_emissions job was changed to self.run after resolving the conflicts. This means that the prep_emissions job wasn't run for the gcdas half cycles. I missed that. I'll fix your comments tomorrow morning

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

Labels

CI-Gaeac6-Failed **Bot use only** CI testing on Gaea C6 for this PR has failed CI-Hercules-Failed **Bot use only** CI testing on Hercules for this PR has failed CI-Ursa-Building **Bot use only** CI testing is cloning/building on Ursa CI-Wcoss2-Failed CI testing on WCOSS for this PR has failed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GCAFSv1 Input data Add NEXUS as a submodule to the global-workflow GCAFS Prep emissions - fire update

8 participants