You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enable unit conversion for model_params, especially when the parameter values come from some "source" instead of explicit values in the realization config.
Current behavior
In #588 the ability was added to retrieve values from the hydrofabric and pass them to modules as model_params, e.g. area_sqkm. Similarly, #639 will add the ability to communicate simulation_time parameters such as simulation_timestep, which will be in seconds. With either of these values, it is conceivable that a receiving model may want to be parameterized with these quantities in different units. However, ngen does not currently call GetVarUnits or attempt any unit conversion when setting model_params. There is actually currently no path to record/pass unit metadata to the part of the code that calls SetValue to set the paramters.
In the case of a hydrofabric-sourced value, units are not necessarily known and should be specifiable via this mechanism.
Note that the above second_static_param introduces a new value-specified param format that allows for specified units. This is bonus and could be dropped from this issue, but probably comes nearly free (see below) and adds value. The non-object format used above with some_static_param should be preserved.
Modify (Bmi_Module_Formulation::set_initial_bmi_parameters)[https://github.com/NOAA-OWP/ngen/blame/944f8fe45448f11ee0d11255e0a69c45336824d8/include/realizations/catchment/Bmi_Module_Formulation.hpp#L614] to accept a property tree instead of a value directly, and change the code that was added in Allow passing feature properties to BMI models through model_params #588 to "wrap" value-only params (like some_static_param above) with an object-style representation, such that the "units" key-value-pair can be passed through to the function. That way set_initial_bmi_parameters can perform unit conversion between any units in the config and any returned from the module's GetVarUnits function. If either is unspecified, no unit conversion need be attempted.
Steps to replicate behavior (include URLs)
Screenshots
The text was updated successfully, but these errors were encountered:
Enable unit conversion for model_params, especially when the parameter values come from some "source" instead of explicit values in the realization config.
Current behavior
In #588 the ability was added to retrieve values from the hydrofabric and pass them to modules as
model_params
, e.g.area_sqkm
. Similarly, #639 will add the ability to communicate simulation_time parameters such assimulation_timestep
, which will be in seconds. With either of these values, it is conceivable that a receiving model may want to be parameterized with these quantities in different units. However, ngen does not currently callGetVarUnits
or attempt any unit conversion when settingmodel_params
. There is actually currently no path to record/pass unit metadata to the part of the code that callsSetValue
to set the paramters.Expected behavior
"units"
key to the object-style definition of parameters that was added in Allow passing feature properties to BMI models throughmodel_params
#588, similar to the following:In the case of a hydrofabric-sourced value, units are not necessarily known and should be specifiable via this mechanism.
Note that the above
second_static_param
introduces a new value-specified param format that allows for specified units. This is bonus and could be dropped from this issue, but probably comes nearly free (see below) and adds value. The non-object format used above withsome_static_param
should be preserved.Bmi_Module_Formulation::set_initial_bmi_parameters
)[https://github.com/NOAA-OWP/ngen/blame/944f8fe45448f11ee0d11255e0a69c45336824d8/include/realizations/catchment/Bmi_Module_Formulation.hpp#L614] to accept a property tree instead of a value directly, and change the code that was added in Allow passing feature properties to BMI models throughmodel_params
#588 to "wrap" value-only params (likesome_static_param
above) with an object-style representation, such that the"units"
key-value-pair can be passed through to the function. That wayset_initial_bmi_parameters
can perform unit conversion between any units in the config and any returned from the module'sGetVarUnits
function. If either is unspecified, no unit conversion need be attempted.Steps to replicate behavior (include URLs)
Screenshots
The text was updated successfully, but these errors were encountered: