Skip to content

add a compound_id which can compose a feature identifier along with with module identifiers into a single id - #1009

Open
hellkite500 wants to merge 1 commit into
NOAA-OWP:masterfrom
hellkite500:feat/bmi-compound-id
Open

add a compound_id which can compose a feature identifier along with with module identifiers into a single id#1009
hellkite500 wants to merge 1 commit into
NOAA-OWP:masterfrom
hellkite500:feat/bmi-compound-id

Conversation

@hellkite500

Copy link
Copy Markdown
Contributor

Introduce an engine-level compound identity for BMI formulation instances. Designed as a unique per-formulation key.

Default composition for a single-BMI formulation:

"<this->id>:<model_type_name>"
e.g. "cat-1:bmi_c_cfe"

For a Bmi_Multi_Formulation submodule, the parent injects a three-part compound via set_compound_id() inside init_nested_module, BEFORE the submodule's create_formulation() runs — so any engine-level consumer that reads compound_id() during submodule construction sees the full key:

"<this->id>:<submodule-mtn>:<multi-mtn>"
e.g. "cat-1.0:bmi_c_cfe:bmi_multi_noahowp_cfe"

The submodule's this->id is already <catchment>.<index> from Bmi_Multi_Formulation's existing identifier construction; we append its own model_type_name (peeked from the config map so it's available pre-create_formulation) and the enclosing multi's model_type_name.

this->id is not mutated — it stays the feature identifier used by current code paths (output naming, forcing lookup, logs). The compound is a read-only view of the formulation's place in the realization, built from fields already in hand.

This is used in #957, and was extracted as an independent feature from that effort.

Additions

  • a formulation compound_id_ member and getter/setters

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
  • Project documentation has been updated (including the "Unreleased" section of the CHANGELOG)
  • Reviewers requested with the Reviewers tool ➡️

…n injection

Introduce an engine-level compound identity for BMI formulation instances.
Designed as a unique per-formulation key.

Default composition for a single-BMI formulation:

    "<this->id>:<model_type_name>"
    e.g. "cat-1:bmi_c_cfe"

For a Bmi_Multi_Formulation submodule, the parent injects a
three-part compound via `set_compound_id()` inside `init_nested_module`,
BEFORE the submodule's `create_formulation()` runs — so any engine-level
consumer that reads `compound_id()` during submodule construction sees
the full key:

    "<this->id>:<submodule-mtn>:<multi-mtn>"
    e.g. "cat-1.0:bmi_c_cfe:bmi_multi_noahowp_cfe"

The submodule's `this->id` is already `<catchment>.<index>` from
Bmi_Multi_Formulation's existing identifier construction; we append its
own `model_type_name` (peeked from the config map so it's available
pre-create_formulation) and the enclosing multi's `model_type_name`.

`this->id` is not mutated — it stays the feature identifier used by
current code paths (output naming, forcing lookup, logs). The
compound is a read-only view of the formulation's place in the
realization, built from fields already in hand.

Assisted by Claude Opus 4.7 (1M context)
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.

1 participant