NOAA-OWP / ngen

Next Generation Water Modeling Engine and Framework Prototype
Other
84 stars 62 forks source link

Linking external hydrofabric parameters in Global Config doesn't work per feature. #872

Closed hellkite500 closed 1 month ago

hellkite500 commented 1 month ago

This issues starts around here when a formulation manager is building individual formulations from a global config. We pass the location/feature associated with each feature which needs a formulation constructed, and proceed to link external data before constructing the formulation.

When we link the external data, the first global config formulation model_params are read and a source/from are found and the model_params are updated in place. This is the subtle bug here. These parameters are modified for the global formulation, and a parameterized formulation is correctly created by the formulation manager for the first missing feature. However, when the initial missing feature loop moves to the next feature, and link_external is called a second time, its model_parameters section no longer contains the appropriate source/from definition, but instead has the model_params from the last call. This will then trigger the short circuit here and simply copy the existing parameter into the formulation, but its value won't reflect the correct hydrofabric value associated with the feature being processed.

This is the root cause of #871