Skip to content

Potential for unit mismatch between formulations providing variables with the same name #829

@donaldwj

Description

@donaldwj

In the current code there is nothing preventing a scenario where two Formulations both provide an output variable with the same name.
This is an issue because the netcdf output code creates variables for each output variable defined by any formulation in a layer. This means the variable would be created when first located in a formulation and ignored thereafter. However the units for later instance of the output variable name are not guaranteed to be the same, which can lead to either incorrect values in output or program termination.

##Example

Formulation A --> (stream-flow-excess cm^3/s float )
Formulation B --> (stream-flow-excess m^3/h double)
Formulation C --> (stream-flow-excess 'none' string)

The variable stream flow excess will only be created once with the type and units set by the first encountered formulation (we can not create separate variables for each formulation as there is currently no way to determine what formulation is bound to a BMI_Formulation object.)

Proposed Fix

Allow formulation name to be retrievable this would allow per formulation variables with maps used to combine compatible definitions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions