Skip to content
This repository was archived by the owner on Oct 6, 2026. It is now read-only.

Add Coastal Forcing - #212

Merged
mxkpp merged 25 commits into
developmentfrom
coastalforcing
Sep 24, 2026
Merged

mxkpp merged 25 commits into
developmentfrom
coastalforcing

Conversation

@laurscham

@laurscham laurscham commented Aug 5, 2026 •

Copy link
Copy Markdown

Modifications to generate forcing data on a grid and output LDASOUT-style netcdfs of the forcing data for ingestion by coastal models.

Edited by @mxkpp

About

This primarily adds a new module NextGen_Forcings_Engine_BMI.coastal.gridded which is leveraged by nwm-rte's nwm-rte/bin_mounted/ngen_rte/coastal/make_coastal_forcing.py in PR: NGWPC/nwm-rte#36.

This also overhauls run_bmi_forcing.py to provide a high-level interface into leveraging the new module.

Some auxiliary changes were needed in config.py, model.py, and other core files in order to accommodate the needs of the coastal gridded workflow.

Not all Configurations are Supported

Not all configurations are supported.

For example, the default configuration file for Puerto Rico AnA uses CONUS MRMS data instead of Puerto Rico MRMS data. This causes the PR AnA to crash in the gridded forcing workflow.

T0 vs T1

For coastal modeling workflows, T0 must exist in the atmospheric forcing timeseries grids. So here, an optional parameter write_t0 was added to cause an additional T0 record to be written to the NetCDF file.

In this case, T0 has identical forcing values as T1. This method of copying the T1 data to T0 was necessary since some of the underlying forecast products do not provide a T0 state.

Inputs

For required static input data, see scripts/setup_data_coastal.sh in the nwm-coastal repository.

Usage

See: NGWPC/nwm-rte#36

Handling CONUS (large domain)

Warmup

A "warmup" mode is provided to handle the large memory requirements of generating ESMF weights files for large domains such as CONUS. The warmup writes weights to disk one product at a time, then quits. After the warmup runs, then the weights files are available for reuse for forecasts.

Additions

  • See above

Removals

  • None

Changes

  • See above

Testing

  1. ngen-forcing pytests were ran from the nwm-rte Dev Container: ( cd src/ngen-forcing && mpirun -n 2 pytest ) and ( cd src/ngen-forcing && pytest )
  2. make_coastal_forcing.py from the related nwm-rte PR was ran: Add Coastal Forcing nwm-rte#36

Screenshots

Notes

Todos

Checklist

  • PR has an informative and human-readable title
  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Code follows project standards (link if applicable)
  • Passes all existing automated tests
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future todos are captured in comments
  • Visually tested in supported browsers and devices (see checklist below 👇)
  • Project documentation has been updated (including the "Unreleased" section of the CHANGELOG)
  • Reviewers requested with the Reviewers tool ➡️

Testing checklist

Target Environment support

  • Linux

@mxkpp
mxkpp self-requested a review September 1, 2026 02:01

@mxkpp mxkpp left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@laurscham in addition to the individual comments listed here in this first round of review, the branch needs to be rebased against development. It would be better to do that rebase first, before addressing the comments.

Comment thread NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/core/geoMod.py
Comment thread NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/core/geoMod.py
Comment thread NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/core/parallel.py Outdated
Comment thread NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/core/regrid.py
Comment thread NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/bmi_model.py Outdated
Comment thread NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/bmi_model.py
Comment thread NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/core/geoMod.py Outdated
Comment thread NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/core/regrid.py Outdated
@mxkpp

mxkpp commented Sep 1, 2026

Copy link
Copy Markdown

@laurscham in addition to the individual comments listed above in this first round of review, the branch needs to be rebased against development. It would be better to do that rebase first, before addressing the comments.

@mxkpp

mxkpp commented Sep 2, 2026

Copy link
Copy Markdown

For managing the PRs of the 2 bases, development vs development-pw, IMO the PR into development (this one, #212) should be treated as the primary PR, with all review cycles and thorough PR description.

Then when review cycles are finished and this is merged into development, then the equivalent development-pw PR can be made to reflect the final changes from #212.

@mxkpp

mxkpp commented Sep 15, 2026

Copy link
Copy Markdown

Rebased against development

@mxkpp

mxkpp commented Sep 16, 2026 •

Copy link
Copy Markdown

For managing the PRs of the 2 bases, development vs development-pw, IMO the PR into development (this one, #212) should be treated as the primary PR, with all review cycles and thorough PR description.

Then when review cycles are finished and this is merged into development, then the equivalent development-pw PR can be made to reflect the final changes from #212.

Closing the other PR that points to development-pw. If this does need to be mirrored to it later, we can do that in a targeted cherry pick commit.

@mxkpp mxkpp mentioned this pull request Sep 16, 2026
laurscham and others added 21 commits September 18, 2026 11:20
…alues coming out of forcing engine on regular grids
…for the different config files. the bmi_model change is related to a crash that was being experienced when this wasn't commented out. the pyproject.toml change might not be needed, it was so the config templates get installed when building the rte
…grid type to control this conditional) and update README about this.
…steps argument to ConfigOptions and BMI model classes, and for scalability, avoid randomizing name of intermediary weights file to allow re-use.
@mxkpp mxkpp changed the title Coastalforcing Add Coastal Forcing Sep 18, 2026
@mxkpp

mxkpp commented Sep 24, 2026

Copy link
Copy Markdown

This was tested by multiple members of the team and found to produce the expected coastal forcing files, and they were ingestible into the coastal model.

@mxkpp
mxkpp self-requested a review September 24, 2026 16:57

@mxkpp mxkpp left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This was tested by multiple members of the team and found to produce the expected coastal forcing files, and they were ingestible into the coastal model.

EDIT: the equivalent coastalforcing-pw-2 branch for testing on ParallelWorks contains the same changes as this branch, relative to its respective base. That branch does not need to be maintained but was needed as a mirror for testing in that environment.

@mxkpp
mxkpp merged commit 396ef48 into development Sep 24, 2026
7 checks passed
@mxkpp
mxkpp deleted the coastalforcing branch September 24, 2026 17:01
mxkpp added a commit that referenced this pull request Sep 24, 2026
Mirror PR #212 for PW (Add Coastal Forcing)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants