Skip to content

Restructure and Add --environment CLI Argument#68

Merged
mxkpp merged 54 commits into
ngwpc-candidatefrom
maxkipp-prep-for-changes
May 12, 2026
Merged

Restructure and Add --environment CLI Argument#68
mxkpp merged 54 commits into
ngwpc-candidatefrom
maxkipp-prep-for-changes

Conversation

@mxkpp
Copy link
Copy Markdown
Contributor

@mxkpp mxkpp commented May 12, 2026

Scripts Moved and Made into Modules

This moves the executable scripts run_forecast.py, run_calibration.py, run_default.py, run_tests.py, and run_regionalization.py by moving them further down into the bin_mounted/ dir into bin_mounted/ngen_rte/ and turns them into executable modules rather than standalone scripts (affects how to call them and how their imports work).

For example:

Call previously:

python "/ngen-app/bin/bin_mounted/run_forecast.py" --help

Equivalent call going forward:

python -um "ngen_rte.run_forecast" --help

CLI Arguments Updated

run_forecast.py

➕ Added: -e / --environment

➖ Removed: -fprov / --forcing_provider

run_default.py

➡️ Renamed: -dur / --historical_sim_duration -> -dur / --duration

➕ Added: -e / --environment

➖ Removed: -fprov / --forcing_provider

run_calibration.py

➡️ Renamed: -dur / --calib_sim_duration -> -dur / --duration

➡️ Renamed: -fsrc / --forcing_source -> -fconfig / --forcing_configuration

➕ Added: -e / --environment

➖ Removed: -fprovider / --forcing_provider

run_regionalization.py

No changes

run_tests.py

➡️ Renamed: -fregion / --global_domain -> -gdomain / --global_domain

➡️ Renamed: -fcname / --fcst_run_name -> -rname / --fcst_run_name

➕ Added: -e / --environment

➖ Removed: -fprovider / --forcing_provider

Code Simplified

This simplifies the codebase by:

  1. Restructuring the various large Pydantic config classes that are exposed as CLI args, to significantly reduce duplicated logic and make the RealizationBuilder kwargs construction much easier to read and understand.
  2. Moving the CLI args list into a dedicated file where the applicable script(s) associated with each arg is an attribute of the arg.
  3. Moving code into subfolders and using a module structure, e.g. python -m ngen_rte.run_forecast instead of python bin_mounted/run_forecast.py.
  4. Breaking the reliance of run_calibration.py on a constructor that had been within execution_tests.py.

This also adds the -e aka --environment CLI arg for choosing 'test' or 'oe' which affects the MSWM GeneralConfig option by the same name, affecting the server URL used to fetch input data.

@mxkpp mxkpp marked this pull request as draft May 12, 2026 10:22
@mxkpp mxkpp marked this pull request as ready for review May 12, 2026 13:04
@mxkpp
Copy link
Copy Markdown
Contributor Author

mxkpp commented May 12, 2026

@ZareanBijan, @cosumi-rtx, this is ready for review. It includes some CLI arg changes and notably changes how the scripts are called (they are called as modules now). Please let me know if any concerns or if I should move / rename things before we merge, but I think these improvements should go into the pending release.

@mxkpp mxkpp merged commit f6f3f25 into ngwpc-candidate May 12, 2026
4 checks passed
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.

2 participants