Closed
Conversation
|
Nothing jumps out but my limited c/c++ knowledge does not allow me to fully understand the code changes in this PR so will defer to other reviewers |
…in UnitsHelper; have multi pass "" (not "1") for outputs; switch to shared unit-error dedupe; and soft-fail nested-provider paths—eliminating UDUNITS (“mm→1”) and recursion crashes.
4bf3cae to
18d4867
Compare
|
@mkarim-rtx |
|
This has been merged into development in PR 52. This PR is no longer necessary. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The UDUNITS package can’t parse "none", which caused warnings like “Unable to parse out_units value none.” Normalizing to "1" matches ngen's convention and avoids spurious conversion errors. This ensures variables defined with “no-units” in realization metadata are recorded as dimensionless from the start, preventing downstream unit-conversion attempts and warnings.
Changes
src/realizations/catchment/Bmi_Module_Formulation.cpp: Normalize “no-units” to dimensionless.
Before requesting data from a provider, Bmi_Module_Formulation::set_model_inputs_prior_to_update now canonicalizes consumer units: any of "", "none", "unitless", "dimensionless", or "-" → "1". This prevents UDUNITS from trying to parse "none" and eliminates mm → 1-type failures.
include/realizations/catchment/Bmi_Multi_Formulation.hpp: Don’t ask providers to convert to “1”.
When the consumer’s units are dimensionless ("1"), the selector passes empty units "" to the provider. This signals “give me native units” and avoids impossible conversions (e.g., m → 1) inside the provider.
Richer, de-duplicated diagnostics.
On conversion failure, the code now throws/propagates a unit_conversion_exception that includes the producer model name, producer BMI var, and producer units. The consumer catches it, logs a single warning per unique producer/consumer/variable pair (using data_access::unit_errors_reported), and falls back to using the unconverted value(s) instead of aborting.
Testing